UiPath Documentation
getting-started
latest
false
Guia de introdução do desenvolvedor
  • Introdução
    • Visão geral
    • Environment set up
  • Introdução aos agentes da UiPath
  • Introdução aos agentes da UiPath usando o LangGraph
    • Introdução
    • Configure seu ambiente
    • Crie o agente
    • Add a tool
    • Avaliar o agente
    • Conecte-se ao Studio Web
  • Construção de um agente de pouco código no Studio Web
  • Adicionando ferramentas ao seu agente UiPath
  • Getting Started with UiPath Maestro Flow
Importante :
Este conteúdo foi traduzido com auxílio de tradução automática. A localização de um conteúdo recém-publicado pode levar de 1 a 2 semanas para ficar disponível.

Crie o agente

Use seu agente de codificação e as habilidades da UiPath para criar, configurar e executar um agente do LangGraph localmente.

Com a CLI instalada, habilidades implementadas e sua conta autenticada, você está pronto para estruturar o projeto local.

Etapa 4 - Configurar o projeto local​

Crie uma nova pasta para seu projeto de agente e abra-a no VS Code (Arquivo → Abrir pasta). Todos os comandos dessa etapa em diante são executados a partir da raiz da pasta do projeto.

Crie o ambiente do Python​

Crie um ambiente virtual fixado a uma versão do Python compatível e ative-o:

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
Observação:

Windows: use .venv\Scripts\activate em vez de source .venv/bin/activate.

Observação:

Versão do Python: uv baixa e gerencia o Python automaticamente se a 3.13 não estiver no seu PATH. As versões compatíveis são 3.11, 3.12 e 3.13.

Instale a integração do LangGraph​

LangGraph é uma estrutura Python para criar agentes de LLM com estado como gráficos de nós e bordas. uipath-langchain é a camada de integração da UiPath que empacota um agente do LangGraph para implantação e avaliação na UiPath Platform.

Instale o pacote UiPath LangGraph no vencimento ativo. Isso também disponibiliza a estrutura para a estruturação do projeto na próxima etapa:

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

Registre o Python com a UiPath CLI​

Informe a CLI onde o executável do Python compatível com a UiPath reside:

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

Você deve ver "Result": "Success" Essa etapa é necessária uma vez por máquina (e após quaisquer alterações variáveis) antes de usar comandos uip codedagent .

Estruturar o projeto​

Crie a estrutura do projeto da UiPath. uip codedagent new a estrutura instalada e gera os arquivos de estrutura corretos:

uip codedagent new QuestIntake
uip codedagent new QuestIntake

Isso cria pyproject.toml, main.py, langgraph.json, uipath.json, entry-points.json, bindings.json, e arquivos de contexto de agente de codificação (AGENTS.md, CLAUDE.md, .agent/). main.py é um espaço reservado; seu agente de codificação o substitui na Etapa 5.

Adicione a dependência do servidor de desenvolvimento local e sincronize o arquivo de bloqueio:

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

Gerar pontos de entrada​

Execute o init para gerar os esquemas de entry point do código de framework:

uip codedagent init
uip codedagent init

O projeto tem um ponto de entrada de espaço reservado neste estágio. Execute init na Etapa 5 após seu agente de codificação escrever o código do agente real.


Etapa 5 - Criar o agente com seu agente de codificação​

É aqui que as habilidades da UiPath valem a pena. Abra seu agente de codificação e solicite que ele crie a lógica do agente. A solicitação abaixo é curta: descreve o que o agente deve fazer, não como criá-lo.

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.

Use o seguinte prompt (ou adapte-o ao seu caso de uso):

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.
Observação:

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.

Importante:

Os agentes de codificação não são determinísticos. Seu código gerado será diferente de quaisquer exemplos mostrados aqui; isso é esperado. O que importa é que main.py seja executado sem erros e retorne uma classificação.

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.

Após o término do agente de codificação, execute novamente o init para selecionar os pontos de entrada atualizados dos novos esquemas Pydentic:

uip codedagent init
uip codedagent init

Você deve ver a saída confirmando que o ponto de entrada foi detectado junto com um diagrama de gráfico ASCII:

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

Antes de continuar, pyproject.toml e adicione uma entrada authors em [project] se ainda não houver nenhuma. A UiPath exige esse campo para empacotar o projeto:

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.

Etapa 6 - Executar o agente localmente​

Execute o agente com o arquivo de entrada de amostra que seu agente de codificação criou:

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

Você deve ver o agente classificar a solicitação e retornar um nível com raciocínio.

Você também pode passar a entrada em linha. Esses exemplos usam a sintaxe de aspas simples do Bash; se você estiver no PowerShell, use --file com um arquivo 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.

Esta página foi útil?

Conectar

Precisa de ajuda? Suporte

Quer aprender? Academia UiPath

Tem perguntas? Fórum do UiPath

Fique por dentro das novidades