UiPath Documentation
getting-started
latest
false
スタート アップ ガイド - 開発者向け
  • はじめに
    • 概要
    • 環境の設定
  • UiPath Agents の利用を開始する
  • LangGraph を使用した UiPath Agents の利用を開始する
    • はじめに
    • 環境をセットアップする
    • エージェントを構築する
    • ツールを追加する
    • エージェントを評価する
    • Studio Web に接続
  • Studio Web でローコード エージェントを構築する
  • UiPath エージェントにツールを追加する
  • Getting Started with UiPath Maestro Flow
重要 :
このコンテンツは機械翻訳によって処理されています。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

エージェントを構築する

コーディング エージェントと UiPath のスキルを使用して、LangGraph エージェントをローカルで構築、設定、実行します。

CLI をインストールし、スキルを配置し、アカウントが認証されたら、ローカル プロジェクトをスキャフォールディングする準備が整いました。

手順 4 - ローカル プロジェクトを設定する​

エージェント プロジェクトの新しいフォルダーを作成し、VS Code で開きます ([ファイル] → [フォルダーを開く])。この手順以降のすべてのコマンドは、プロジェクト フォルダーのルートから実行されます。

Python 環境を作成する​

サポートされている Python のバージョンにピン留めされた仮想環境を作成し、アクティブ化します。

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
注:

Windows:ではなく .venv\Scripts\activatesource .venv/bin/activateを使用してください。

注:

Python バージョン: 3.13 が PATH にない場合、 uv は Python を自動的にダウンロードして管理します。サポートされているバージョンは 3.11、3.12、3.13 です。

LangGraph 連携をインストールする​

LangGraph は、ノードとエッジのグラフとしてステートフル LLM エージェントを構築するための Python フレームワークです。uipath-langchain は、UiPath Platform でのデプロイと評価のために LangGraph エージェントをパッケージ化する UiPath 統合レイヤーです。

アクティブな venv に UiPath LangGraph パッケージをインストールします。これにより、次のステップのプロジェクト スキャフォールディングにもフレームワークが利用できるようになります。

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

UiPath CLI に Python を登録する​

UiPath 互換の Python 実行可能ファイルが存在する場所を CLI に指示します。

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

が表示されます "Result": "Success"。この手順は、 uip codedagent コマンドを使用する前に、マシンごとに 1 回 (および venv の変更後に) 必要です。

プロジェクトのスキャフォールディング​

UiPath プロジェクトの構造を作成します。uip codedagent new インストールされているフレームワークを検出し、適切なスキャフォールディング ファイルを生成します。

uip codedagent new QuestIntake
uip codedagent new QuestIntake

これにより、 pyproject.toml、 main.py、 langgraph.json、 uipath.json、 entry-points.json、 bindings.json、およびコーディング エージェントのコンテキスト ファイル (AGENTS.md、 CLAUDE.md、 .agent/) が作成されます。main.pyはプレースホルダーです。手順 5 でコーディング エージェントがこれを置き換えます。

ローカルの開発サーバー依存関係を追加し、ロックファイルを同期します。

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

エントリ ポイントを生成する​

init を実行して、スキャフォールド コードからエントリ ポイント スキーマを生成します。

uip codedagent init
uip codedagent init

この段階では、プロジェクトにプレースホルダーのエントリ ポイントがあります。コーディング エージェントが実際のエージェント コードを記述した後、手順 5 で init を再実行します。


手順 5 - コーディング エージェントでエージェントを構築する​

ここで UiPath のスキルが実を結びます。コーディング エージェントを開き、エージェント ロジックを作成するようプロンプトで指示します。以下のプロンプトは簡潔で、エージェントを構築する方法ではなく、エージェントが何をすべきかを説明しています。

コーディング エージェントがインストールした uipath-agents スキルは、LangGraph の連携パターン、正しい SDK のインポート、Pydantic スキーマの規則、および関連する SDK の要件をすでに理解しています。これらのスキルがなければ、これらすべてをプロンプト自体で指定する必要があります。

次のプロンプトを使用します (または、ユース ケースに合わせて調整してください)。

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.
注:

このプロンプトがなぜこれほど具体的であるのか。タッチする正確なファイルに名前を付け、コーディング エージェントに uip codedagent コマンドを実行したり、自身の動作を検証したりしないように指示します。このラボの残りの部分では、次のステップで同じ CLI コマンドを直接実行するため、コーディング エージェントが最初に実行するのではなく、検証はユーザーに委ねられます。

上記のプロンプトは、独自のプロジェクトで始めるのに適したテンプレートですが、コーディング エージェントが自分の作業をテストし、独自の判断でファイルを整理できるように、最後の 2 つの文を削除する必要があります。

重要:

コーディング エージェントは非決定論的です。生成されるコードは、ここに示す例とは異なります。それは予想通りです。重要なのは、 main.py がエラーなしで実行され、分類が返されることです。

また、コーディング エージェントから「配信」に関する質問 (Studio Web、ローカル開発サーバー、またはスキップ) が提示された場合は、[ス キップ - 今のところ完了] を選択します。手順 10 で Studio Web に接続します。

コーディングエージェントが終了したら、 init を再実行して、新しい Pydantic スキーマから更新されたエントリポイントを取得します。

uip codedagent init
uip codedagent init

エントリ ポイントが検出されたことを確認する出力が ASCII グラフ ダイアグラムとともに表示されます。

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

続行する前に、pyproject.toml を開き、[[project]] にauthorsエントリがまだ存在しない場合は追加します。UiPath では、プロジェクトをパッケージ化するためにこのフィールドが必要です。

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

エージェントをローカルで実行し、エントリ ポイントを登録したら、次の手順に進む準備が整いました。

手順 6 - エージェントをローカルで実行する​

コーディング エージェントが作成したサンプル入力ファイルを使用してエージェントを実行します。

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

エージェントが要求を分類し、推論とともに層を返すのがわかります。

入力をインラインで渡すこともできます。これらの例では、Bash の一重引用符構文を使用します。PowerShell を使用している場合は、代わりに JSON ファイルで --file を使用します。

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"}'

独自の入力を試して、分類が理にかなっていることを確認します。たとえば、次のとおりです。

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"}'

エージェントが正しく分類されたら、回答を検証するための何かを提供する準備が整いました。

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得