UiPath Documentation
getting-started
latest
false
Guide de démarrage du développeur
  • Introduction
    • Vue d'ensemble (Overview)
    • Environment set up
  • Commencer avec les agents UiPath
  • Premiers pas avec les agents UiPath utilisant LangGraph
    • Introduction
    • Configurer votre environnement
    • Créer l'agent
    • Add a tool
    • Évaluer l'agent
    • Se connecter à Studio Web
  • Créer un agent low-code dans Studio Web
  • Ajouter des outils à votre agent UiPath
  • Getting Started with UiPath Maestro Flow
Important :
Ce contenu a été traduit à l'aide d'une traduction automatique. La localisation du contenu nouvellement publié peut prendre 1 à 2 semaines avant d’être disponible.

Créer l'agent

Utilisez votre agent de codage et les compétences UiPath pour créer, configurer et exécuter un agent LangGraph localement.

Une fois la CLI installée, les compétences en place et votre compte authentifié, vous êtes prêt à élaborer le projet local.

Étape 4 - Configurer le projet local​

Créez un nouveau dossier pour votre projet d'agent et ouvrez-le dans VS Code (Fichier → Ouvrir le dossier). Toutes les commandes de cette étape sont ensuite exécutées à partir de la racine du dossier du projet.

Créer l’environnement Python​

Créez un environnement virtuel épinglé à une version de Python prise en charge et activez-le:

mkdir QuestIntake
cd QuestIntake

uv venv --python 3.13
source .venv/bin/activate
mkdir QuestIntake
cd QuestIntake

uv venv --python 3.13
source .venv/bin/activate
Remarque :

Windows: utilisez .venv\Scripts\activate au lieu de source .venv/bin/activate.

Remarque :

Version Python: uv télécharge et gère automatiquement Python si la version 3.13 ne se trouve pas sur votre PATH. Les versions prises en charge sont les versions 3.11, 3.12 et 3.13.

Installer l'intégration LangGraph​

LangGraph est une infrastructure Python permettant de créer des agents LLM à l'état sous forme de graphiques de nœuds et de bords. uipath-langchain est la couche d'intégration UiPath qui empaquète un agent LangGraph pour le déploiement et l'évaluation sur la plate-forme UiPath.

Installez le package UiPath LangGraph dans le venv actif. Cela rend également l'infrastructure disponible pour l'élaboration du projet à l'étape suivante:

uv pip install uipath-langchain
uv pip install uipath-langchain

Enregistrer Python avec la UiPath CLI​

Indiquez à la CLI où se trouve l'exécutable Python compatible UiPath:

uip codedagent setup --force
uip codedagent setup --force

Vous devriez voir "Result": "Success". Cette étape est requise une fois par machine (et après toute modification venv) avant d’utiliser les commandes uip codedagent .

Élaborer le projet​

Créez la structure du projet UiPath. uip codedagent new détecte l'infrastructure installée et génère les fichiers d'élaboration du bon:

uip codedagent new QuestIntake
uip codedagent new QuestIntake

Cela crée des fichiers pyproject.toml, main.py, langgraph.json, uipath.json, entry-points.json, bindings.json et de contexte d'agent de codage (AGENTS.md, CLAUDE.md, .agent/). Le main.py est un espace réservé; votre agent de codage le remplace à l'étape 5.

Ajoutez la dépendance du serveur de développement local et synchronisez le fichier de verrouillage:

uv add uipath-dev --dev
uv sync
uv add uipath-dev --dev
uv sync

Générer des points d’entrée​

Exécutez init pour générer les schémas de point d'entrée à partir du code sBuild:

uip codedagent init
uip codedagent init

Le projet dispose d'un point d'entrée d'espace réservé à cette étape. Réexécutez init à l'étape 5 après que votre agent de codage a écrit le code réel de l'agent.


Étape 5 - Créer l’agent avec votre agent de codage​

C’est là que les compétences UiPath sont payantes. Ouvrez votre agent de codage et invitez-le à créer la logique de l’agent. L'invite ci-dessous est courte: elle décrit ce que l'agent doit faire, pas comment le créer.

The uipath-agents skill your coding agent has installed already knows the LangGraph integration patterns, correct SDK imports, Pydantic schema conventions, and relevant SDK requirements. Without these skills, you would need to specify all of this in the prompt itself.

Utilisez l’invite suivante (ou adaptez-la à votre cas d’utilisation):

Update main.py to implement this UiPath coded agent using LangGraph as a single-node graph with no tools and no retry or error-handling logic.

The agent is a quest intake classifier for a fantasy adventurer's guild. Given a
description of an incoming quest, it classifies the difficulty as one of four tiers:
- Trivial: Simple errands anyone can handle (e.g., deliver a letter, clear rats from a cellar)
- Standard: Moderate quests requiring some skill (e.g., escort a merchant caravan)
- Heroic: Difficult quests requiring significant expertise (e.g., slay a wyvern, infiltrate a thieves' guild)
- Legendary: Extreme quests requiring top-tier heroes and special approval (e.g., defeat a lich, close a planar rift)

Return the classification tier and a brief reasoning. Use these exact field names in the State schema:
- Input field: `description` (string)
- Output fields: `tier` (a Literal type constrained to exactly "Trivial", "Standard", "Heroic", "Legendary" — not a plain string, so the model can't emit an out-of-vocabulary tier) and `reasoning` (string)

Update the existing langgraph.json to point at the new graph, and create an input.json with this exact sample quest: {"description": "Clear the rats out of the inn cellar"}.

Only touch main.py, langgraph.json, and input.json.

Don't run any uip codedagent commands or otherwise verify that the agent runs — I will do this myself.
Update main.py to implement this UiPath coded agent using LangGraph as a single-node graph with no tools and no retry or error-handling logic.

The agent is a quest intake classifier for a fantasy adventurer's guild. Given a
description of an incoming quest, it classifies the difficulty as one of four tiers:
- Trivial: Simple errands anyone can handle (e.g., deliver a letter, clear rats from a cellar)
- Standard: Moderate quests requiring some skill (e.g., escort a merchant caravan)
- Heroic: Difficult quests requiring significant expertise (e.g., slay a wyvern, infiltrate a thieves' guild)
- Legendary: Extreme quests requiring top-tier heroes and special approval (e.g., defeat a lich, close a planar rift)

Return the classification tier and a brief reasoning. Use these exact field names in the State schema:
- Input field: `description` (string)
- Output fields: `tier` (a Literal type constrained to exactly "Trivial", "Standard", "Heroic", "Legendary" — not a plain string, so the model can't emit an out-of-vocabulary tier) and `reasoning` (string)

Update the existing langgraph.json to point at the new graph, and create an input.json with this exact sample quest: {"description": "Clear the rats out of the inn cellar"}.

Only touch main.py, langgraph.json, and input.json.

Don't run any uip codedagent commands or otherwise verify that the agent runs — I will do this myself.
Remarque :

Why this prompt is so specific. It names the exact files to touch and tells the coding agent not to run any uip codedagent commands or verify its own work. That's deliberate here: the rest of this lab exercises those same CLI commands directly in the next steps, so verification is left to you instead of the coding agent running it first.

The prompt above is a good template to start from in your own projects, but you should remove the last two sentences to enable the coding agent to test its work and organize files to its own judgment.

Important :

Les agents de codage sont non déterministes. Votre code généré sera différent de tous les exemples affichés ici; ce qui est attendu. Ce qui compte, c'est que main.py s'exécute sans erreur et renvoie une classification.

And note that if your coding agent presents a 'Delivery' question (Studio Web, local dev server, or skip), select Skip - I'm done for now. Connect to Studio Web in Step 10.

Une fois l'agent de codage terminé, réexécutez init pour récupérer les points d'entrée mis à jour des nouveaux schémas Pyexécution:

uip codedagent init
uip codedagent init

Vous devriez voir la sortie confirmant que le point d'entrée a été détecté avec un diagramme graphique ASCII:

Created 'entry-points.json' file with 1 entrypoint(s).
Created 'entry-points.json' file with 1 entrypoint(s).

Avant de continuer, ouvrez pyproject.toml et ajoutez une entrée authors sous [project] si ce n’est déjà fait. UiPath requiert ce champ pour compresser le projet:

authors = [{ name = "Your Name" }]
authors = [{ name = "Your Name" }]

With the agent running locally and the entry points registered, you are ready to run it in the next step.

Étape 6 - Exécuter l’agent localement​

Exécutez l'agent avec le fichier d'entrée exemple votre agent de codage créé:

uip codedagent run agent --file input.json
uip codedagent run agent --file input.json

Vous devriez voir l'agent classer la demande et renvoyer un niveau avec un raisonnement.

Vous pouvez également transmettre l'entrée en ligne. Ces exemples utilisent la syntaxe à apostrophes Bash; si vous êtes dans PowerShell, utilisez plutôt --file avec un fichier JSON:

uip codedagent run agent '{"description": "Clear the rats out of the inn cellar"}'
uip codedagent run agent '{"description": "Clear the rats out of the inn cellar"}'

Try your own inputs to verify the classifications make sense, for example:

uip codedagent run agent '{"description": "Slay the ancient red dragon terrorizing the countryside"}'
uip codedagent run agent '{"description": "Slay the ancient red dragon terrorizing the countryside"}'

With the agent classifying correctly, you are ready to give it something to verify its answers against.

Cette page vous a-t-elle été utile ?

Connecter

Besoin d'aide ? Assistance

Vous souhaitez apprendre ? UiPath Academy

Vous avez des questions ? UiPath Forum

Rester à jour