- 概要
- UiPath Agents の利用を開始する
- はじめに
- 環境をセットアップする
- エージェントを構築する
- エージェントをテストする
- LangGraph を使用した UiPath Agents の利用を開始する
- Studio Web でローコード エージェントを構築する
- UiPath エージェントにツールを追加する
エージェント コントラクトを定義し、システム プロンプトを記述して、agent.json で入力スキーマと出力スキーマを設定します。
CLI がインストールされ、UiPath アカウントが接続されたら、エージェントのスキャフォールディングを行う準備は完了です。
手順 4 - ソリューションとエージェントの足場を作成する
ローコード エージェント はソリューション 内に存在します。これは、CLI が Studio Web にアップロードするデプロイ可能なユニットです。まずソリューションを作成してから、その中にエージェントを素早く配置します。
-
作業ディレクトリを作成し、ソリューションをスキャフォールディングします。
mkdir Monster-Selector-Lab cd Monster-Selector-Lab uip solution init MonsterSelectormkdir Monster-Selector-Lab cd Monster-Selector-Lab uip solution init MonsterSelectorこれにより、
MonsterSelector.uipx(ソリューション マニフェスト) に加えて、コーディング エージェントをソリューション構造に向けるためのAGENTS.mdファイルとCLAUDE.mdブリーフィング ファイルを含むMonsterSelector/ディレクトリが作成されます。 -
ソリューション ディレクトリ内のエージェント プロジェクトを素早く作成します。
uip agent init MonsterSelector/MonsterSelectoruip agent init MonsterSelector/MonsterSelector指定したパスにエージェント プロジェクトが作成され
uip agent init <path>、ソリューションに自動的に登録されます。agent.json(システム プロンプト、スキーマ、モデル設定)、entry-points.json、空のevals/のスキャフォールド、および自動生成されたプロジェクト ID が生成されます。 -
残りの手順については、ソリューション ディレクトリに移動します。
cd MonsterSelectorcd MonsterSelector
MonsterSelector という名前の 2 つのディレクトリ。これで、ラボ ディレクトリに MonsterSelector/ (ソリューション) が含まれるようになりました。このディレクトリには別の MonsterSelector/ (エージェント プロジェクト) が含まれます。これは正常な現象です。ソリューションとエージェント プロジェクトは名前を共有できます。次の手順を実行するときは、自分がどのディレクトリにいるかに注意してください。手順 4 は、ソリューション ディレクトリ (Monster-Selector-Lab/MonsterSelector/) 内で終了します。
手順 5 - エージェントを設定する
エージェントの設定は、 agent.json ファイルと entry-points.json ファイルで定義されます。これらを直接編集して、このラボの冒頭から設計を実装し、スキャフォールドによって生成されたプレースホルダー コンテンツを置き換えます。
設定agent.json
スキャフォールドを置き換えるには、 MonsterSelector/agent.json を開きます (現在のソリューション ディレクトリを基準にして)。その内容全体を次のように置き換えます。1 つの例外は、最後の行の projectId 値です。ここに示されているプレースホルダーを使用するのではなく、スキャフォールドで生成された UUID を保持します。
以下の JSON は、 構築しているものからのデザインを実装したものです。
- 入力スキーマ:
questDescription(文字列) とmonsters(配列) の両方が必要です。 - 出力スキーマ:
monsterIndex(文字列)。 - システム プロンプト: モデルに推論方法を指示する、
messages[0](systemロール) の指示テキストです。 - ユーザー ターン: 実行時にプロンプトに
questDescriptionとmonstersを運ぶmessages[1](userロール) のメッセージです。これは LLM の会話ターンであり、人間のエンド ユーザーではありません。
{
"version": "1.1.0",
"settings": {
"model": "gpt-4.1-2025-04-14",
"maxTokens": 16384,
"temperature": 0,
"engine": "basic-v2",
"maxIterations": 25,
"mode": "standard"
},
"inputSchema": {
"type": "object",
"properties": {
"questDescription": {
"type": "string",
"description": "Description of the quest"
},
"monsters": {
"type": "array",
"description": "Candidate monsters from the D&D 5e API"
}
},
"required": ["questDescription", "monsters"]
},
"outputSchema": {
"type": "object",
"properties": {
"monsterIndex": {
"type": "string",
"description": "The index slug of the chosen monster"
}
}
},
"metadata": {
"storageVersion": "50.0.0",
"isConversational": false,
"showProjectCreationExperience": false,
"targetRuntime": "pythonAgent"
},
"type": "lowCode",
"messages": [
{
"role": "system",
"content": "You are an RPG game master helping to select the most thematically appropriate monster for a quest. Given a quest description and a list of candidate monsters (each with a name and an index slug), pick the ONE monster whose lore, environment, or threat level best fits the quest. Return ONLY the index slug of your chosen monster. Do not return the full object or any commentary - just the string slug. If multiple candidates fit, favor the most iconic or thematically resonant choice.",
"contentTokens": [
{
"type": "simpleText",
"rawString": "You are an RPG game master helping to select the most thematically appropriate monster for a quest. Given a quest description and a list of candidate monsters (each with a name and an index slug), pick the ONE monster whose lore, environment, or threat level best fits the quest. Return ONLY the index slug of your chosen monster. Do not return the full object or any commentary - just the string slug. If multiple candidates fit, favor the most iconic or thematically resonant choice."
}
]
},
{
"role": "user",
"content": "{{input.questDescription}} {{input.monsters}}",
"contentTokens": [
{ "type": "variable", "rawString": "input.questDescription" },
{ "type": "simpleText", "rawString": " " },
{ "type": "variable", "rawString": "input.monsters" }
]
}
],
"projectId": "your-scaffold-generated-uuid-here"
}
{
"version": "1.1.0",
"settings": {
"model": "gpt-4.1-2025-04-14",
"maxTokens": 16384,
"temperature": 0,
"engine": "basic-v2",
"maxIterations": 25,
"mode": "standard"
},
"inputSchema": {
"type": "object",
"properties": {
"questDescription": {
"type": "string",
"description": "Description of the quest"
},
"monsters": {
"type": "array",
"description": "Candidate monsters from the D&D 5e API"
}
},
"required": ["questDescription", "monsters"]
},
"outputSchema": {
"type": "object",
"properties": {
"monsterIndex": {
"type": "string",
"description": "The index slug of the chosen monster"
}
}
},
"metadata": {
"storageVersion": "50.0.0",
"isConversational": false,
"showProjectCreationExperience": false,
"targetRuntime": "pythonAgent"
},
"type": "lowCode",
"messages": [
{
"role": "system",
"content": "You are an RPG game master helping to select the most thematically appropriate monster for a quest. Given a quest description and a list of candidate monsters (each with a name and an index slug), pick the ONE monster whose lore, environment, or threat level best fits the quest. Return ONLY the index slug of your chosen monster. Do not return the full object or any commentary - just the string slug. If multiple candidates fit, favor the most iconic or thematically resonant choice.",
"contentTokens": [
{
"type": "simpleText",
"rawString": "You are an RPG game master helping to select the most thematically appropriate monster for a quest. Given a quest description and a list of candidate monsters (each with a name and an index slug), pick the ONE monster whose lore, environment, or threat level best fits the quest. Return ONLY the index slug of your chosen monster. Do not return the full object or any commentary - just the string slug. If multiple candidates fit, favor the most iconic or thematically resonant choice."
}
]
},
{
"role": "user",
"content": "{{input.questDescription}} {{input.monsters}}",
"contentTokens": [
{ "type": "variable", "rawString": "input.questDescription" },
{ "type": "simpleText", "rawString": " " },
{ "type": "variable", "rawString": "input.monsters" }
]
}
],
"projectId": "your-scaffold-generated-uuid-here"
}
temperature: 0です。出力の変動は減少しますが、モデルが完全に決定論的になるわけではありません。0 であっても、モデルが実行間で異なる有効な出力を返すことがあります。このエージェントにとって、防御可能なモンスターのピックは正しいです。正確な文字列の再現性は目標ではありません。
設定entry-points.json
次に MonsterSelector/entry-points.json を開き、その内容全体を次のように置き換えます。ここでも、プレースホルダーを使用するのではなく、スキャフォールドで生成された uniqueId 値を保持します。
以下の JSON は、1 つの agent エントリ ポイントを定義します。これを以下の手順で呼び出します。ソリューションで複数のエントリ ポイント (たとえば、同じエージェントの単純なバリアントと拡張入力バリアント) を公開できますが、ここで必要なのは 1 つだけです。
{
"$schema": "https://cloud.uipath.com/draft/2024-12/entry-point",
"$id": "entry-points.json",
"entryPoints": [
{
"filePath": "/content/agent.json",
"uniqueId": "your-scaffold-generated-uuid-here",
"type": "agent",
"input": {
"type": "object",
"properties": {
"questDescription": {
"type": "string",
"description": "Description of the quest"
},
"monsters": {
"type": "array",
"description": "Candidate monsters from the D&D 5e API"
}
},
"required": ["questDescription", "monsters"]
},
"output": {
"type": "object",
"properties": {
"monsterIndex": {
"type": "string",
"description": "The index slug of the chosen monster"
}
}
}
}
]
}
{
"$schema": "https://cloud.uipath.com/draft/2024-12/entry-point",
"$id": "entry-points.json",
"entryPoints": [
{
"filePath": "/content/agent.json",
"uniqueId": "your-scaffold-generated-uuid-here",
"type": "agent",
"input": {
"type": "object",
"properties": {
"questDescription": {
"type": "string",
"description": "Description of the quest"
},
"monsters": {
"type": "array",
"description": "Candidate monsters from the D&D 5e API"
}
},
"required": ["questDescription", "monsters"]
},
"output": {
"type": "object",
"properties": {
"monsterIndex": {
"type": "string",
"description": "The index slug of the chosen monster"
}
}
}
}
]
}
agent.jsonとentry-points.jsonを理解する
- エージェントの定義は
agent.jsonです。モデルの設定、システム プロンプト、入力スキーマと出力スキーマです。 entry-points.json、これらのスキーマをソリューション ランタイムに公開します。- 重要:
inputSchemaブロックとoutputSchemaブロックは両方のファイルで同一である必要があります。一致しない場合、検証は失敗します。
ユース ケースに適応する別のエージェントを構築するには、messages[0] のcontent文字列をシステム プロンプトに置き換え、プロンプトが参照するフィールドと一致するように inputSchema と outputSchema のpropertiesブロックを更新します。同じ変更を entry-points.jsonに反映します。settings、metadata、type、メッセージの構造は変わりません。
手順 6 - エージェントを検証する
ソリューション ディレクトリから、エージェントを検証します。
uip agent validate MonsterSelector
uip agent validate MonsterSelector
"Status": "Valid"に "StorageVersion": "50.0.0"が表示され、"Validated"の概要に agent: trueが表示されます。検証により、Studio Web で使用される .agent-builder/ ファイルも生成されます。これらに触れる必要はありません。
検証に失敗した場合は、 inputSchema と outputSchema が agent.json と entry-points.jsonの両方で同一であること、および messages[1].content のすべての変数参照で input. プレフィックスが使用されていることを確認します (例: {{input.questDescription}})。
エージェントをローカルで検証したら、Studio Web にアップロードして次のセクションでライブ テストを実行する準備が整います。