- 概要
- UiPath Agents の利用を開始する
- LangGraph を使用した UiPath Agents の利用を開始する
- Studio Web でローコード エージェントを構築する
- UiPath エージェントにツールを追加する
- はじめに
- API ワークフローを構築する
- エージェントに接続する
- エンドツーエンドでテストする
モンスターセレクターエージェントにAPIワークフローをツールとして登録し、エージェントの入力スキーマを更新します。
ワークフローがパブリッシュされると、Agent Builder で接続可能なツールとして利用できるようになります。
ステップ 2 - モンスター セレクター エージェントを開く
Studio Web で MonsterSelector ソリューションに移動し、Agent Builder で開きます。
変更を加える前に、少し時間を取って現在の状態を確認してください。
- 入力:
questDescription(文字列) とmonsters(呼び出し元によって渡された候補の配列) - Output:
monsterIndex(string): thekeyof the chosen monster, for examplesrd_goblin - システム プロンプト: 提供されたリストから最適な一致を選択するようエージェントに指示します
このラボでは、 monsters 入力と、候補を事前に設定する必要性を削除します。エージェントは、作成したツールを使用して自動的にデータを取得します。
手順 3 - API ワークフローをツールとして接続する
ツールを追加する
キャンバス ビューが表示されていることを確認します。Agent Builder の上部にある [キャンバス]/[フォーム] トグルを使用します。[ツール] の下の [+ ] ボタンは、キャンバス ビューにのみ表示されます。
-
エージェント キャンバスの [ツール] で [+] を選択します。
-
In the Choose tool panel, select API workflow under Toolbox.
-
Under Available resources, select the workflow you created in Step 1.
Your workflow is listed by its project name, nested under a
<workspace>/<solution>folder line - so if you renamed the solution in Step 1, look forAPI Query - 5e Monsters, not the solution name. You can also filter with the Search API workflows box above the list.
Available resources empty, or showing "No tools found"? The workflow must be published before it appears here. Return to Step 1 and complete the Publish to your feed sub-step, then come back and try again.
ツールの説明を設定します
ツールに名前と説明を付けます。説明は、ツールをいつ、どのように呼び出すかを決定するためにエージェントが実行時に読み取る内容です。これは、人間用のラベルではなく、エージェントへの指示として記述します。
- Name (名前):
Monster Query - 説明:
Searches the 5e SRD for monsters matching a name or creature type. Returns up to 10 candidates with key, name, type, size, challenge rating, and alignment. Call this tool when you need to find monster candidates for a quest.
ツールの選択は、説明によって決定されます。エージェントは、ツール名ではなくこの説明を読み取って、ツールをいつ、どのように呼び出すかを決定します。曖昧な説明は、ツールの使用法を曖昧にします。ツールが返す内容と、それをいつ使用するかを具体的に指定します。
手順 4 - エージェントの契約を更新する
ツールを接続した状態で、新しいコントラクトを反映するようにエージェント定義を更新します。エージェントは、事前に入力されたモンスターリストを不要にし、独自の推論を含む構造化されたモンスターデータを返すようになりました。
このステップの 3 つの変更は連携して機能します。削除 monsters 、エージェントのデータに対する呼び出し元への依存関係が終了します。出力スキーマでは、エージェントが返すことを約束する内容を宣言します。更新されたプロンプトは、新機能の使用方法をエージェントに指示します。この 3 つはどれも、他のものなしでは機能しません。
エージェント定義を編集するには、キャンバスでエージェント ノードを選択し、右側に定義パネルを開きます。
入力からモンスターを除外する
エージェント定義の入力スキーマから monsters プロパティを削除します。更新される入力には questDescriptionのみが必要です。
monstersプロパティを削除するには、以下の手順を実行します。
- エージェント内で、左側のナビゲーションバーにある [データ マネージャーを開く] アイコン (クリップボードのように見えます) を選択して、データ マネージャーを開きます。
- [データ マネージャー] パネルには、[入力]、[出力]、[変数] の 3 つのグループがあります。
monstersは [入力] リストにあるはずです。 monstersをポイントすると、ラベルの右側に編集アイコンと削除アイコン (鉛筆アイコン (編集) とゴミ箱アイコン (削除) が表示されます。- 削除アイコンを選択する
monstersを削除します。 - Open the agent's Properties panel and remove the now-dangling
monstersreference from the User prompt: select the x on themonsterschip. The User prompt should be left with only thequestDescriptionchip.
Deleting the input does not clear the prompt that references it. After step 4 the User prompt still carries a monsters chip, which Studio Web renders in red and flags with an error badge on Inputs. The agent will not run until you remove that chip, so do not skip step 5.
これで、入力は 1 つだけになります questDescription:
| フィールド | 入力 | Required | 説明 |
|---|---|---|---|
questDescription | string | はい | クエストの説明 |
出力スキーマを追加します
「 構築しているもの」のデザイン テーブルの 5 つのフィールドを含む出力スキーマを追加します。
同じ [データ マネージャー ] パネル内で、以下の操作を行います。
- [ 出力] ヘッダーをポイントして、[ プロパティを追加 ] アイコン (+) を表示します。
- [ プロパティを追加 ] を選択して、以下の各フィールドを追加します。
| フィールド | 入力 |
|---|---|
monsterIndex | string |
monsterName | string |
monsterType | string |
monsterCr | string |
monsterReasoning | string |
monsterReasoning API からではなく、エージェントによって生成されます。エージェントはこのフィールド自体を書きます:これは、選択したモンスターがクエストに適合する理由についてのエージェントの説明です。ツールの結果から取得される他の 4 つのフィールドとは異なり、 monsterReasoning はエージェント自身の判断を反映します。
システム プロンプトを更新します
[プロパティ] パネルを開くには、キャンバスでエージェントを選択するか、右上隅にあるレンチ アイコンを選択します。システム メッセージを次のように置き換えます。
You are a quest classifier for an adventurer's guild. Given a quest description, your job is to find the most thematically appropriate monster from the 5e SRD and to return information about that monster.
When given a quest description:
1. Analyze the quest to determine what kind of creature fits the context - consider creature type, challenge rating, environment, and theme.
2. Call the Monster Query tool with a search term that targets that creature type.
3. Review the returned candidates and select the best fit for the quest.
4. Return the selected monster's key fields and a monsterReasoning that explains why this monster fits the quest.
Always call the Monster Query tool before selecting a monster. Do not guess monster details from memory.
You are a quest classifier for an adventurer's guild. Given a quest description, your job is to find the most thematically appropriate monster from the 5e SRD and to return information about that monster.
When given a quest description:
1. Analyze the quest to determine what kind of creature fits the context - consider creature type, challenge rating, environment, and theme.
2. Call the Monster Query tool with a search term that targets that creature type.
3. Review the returned candidates and select the best fit for the quest.
4. Return the selected monster's key fields and a monsterReasoning that explains why this monster fits the quest.
Always call the Monster Query tool before selecting a monster. Do not guess monster details from memory.
コーディング エージェントは非決定論的です。プロンプトで生成される結果は、上の例とは異なります。それは予想通りです。重要なのは、エージェントがツールを呼び出し、候補を推論し、5 つの必須出力フィールドすべてを返すことです。
ツールを接続し、エージェント コントラクトを更新したら、次のセクションでフル パイプラインをテストする準備が整います。