- はじめに
- UiPath Agents の利用を開始する
- LangGraph を使用した UiPath Agents の利用を開始する
- Studio Web でローコード エージェントを構築する
- UiPath エージェントにツールを追加する
- UiPath Maestro のフロー キャンバスの使用を開始する
エージェントに接続する
API ワークフローをツールとして Quest 分類器エージェントに登録し、いつ呼び出すかを記述し、システム プロンプトを置き換えてエージェントが使用できるようにします。
手順 2 - クエスト分類器エージェントを開く
これで、ソリューションには Quest 分類器エージェントと、構築した API Query - 5e Monsters ワークフローの 2 つのプロジェクトが含まれます。プロジェクト エクスプローラーでエージェント プロジェクトを選択して Agent Builder で開きます。スターターをデプロイした場合、エージェント プロジェクトは Quest-Classifier-Agent です。
変更を加える前に、エージェントの現在の設定を確認してください。
- プロジェクト入力:
questDescription(文字列)。 - プロジェクトの出力:
tier(文字列、4 つの値のいずれか) およびreasoning(文字列)。 - システム プロンプト: 4 つの層について説明します。このスクリプトを Autopilot が記述した場合、またはスターターをデプロイした場合は、ツールを使用しないように、説明だけから分類し、ツールを使用しないようにエージェントに指示する可能性が高いです。
- 評価セット: ローコード ラボの 5 つのケース。手順 6 で再実行します。
このラボでは、入力や出力を変更しません。ツールを追加して、システム プロンプトを置き換えて、エージェントがその使い方を認識できるようにします。
手順 3 - API ワークフローをツールとして接続する
API Query - 5e Monsters ワークフローをツールとしてエージェントに登録し、実行時にエージェントが読み取る名前と説明を付けます。
ツールを追加する
キャンバス ビューが表示されていることを確認します。Agent Builder の上部にある [キャンバス]/[フォーム] トグルを使用します。[ツール] の下の [+ ] ボタンは、キャンバス ビューにのみ表示されます。
- エージェント キャンバスの [ツール] で [+] を選択します。
- [ツールを選択] パネルのツールボックスで、[API ワークフロー] を選択します。
- [ 利用可能なリソース] で [
API Query - 5e Monsters] を選択します。手順 1 でこのソリューションに追加したワークフローです。[ API ワークフローを検索 ] ボックスでリストをフィルター処理することもできます。
ワークフローがリストにない場合は、プロジェクト エクスプローラーを確認します。 API Query - 5e Monsters はエージェントと同じソリューションにリストされている必要があります。別のソリューションとして作成した場合は、最初にパブリッシュすると ([自分>パブリッシュ])、ここにプロジェクト名の下に表示されます。
このツールをエージェントのソリューション内に保持してもパブリッシュ手順は必要ありません。また、エージェントの評価では他のツールと同様にこの手順が使用されます。独自のプロジェクトで、ツールに独自のソリューションを提供し、複数のエージェントがそのツールを呼び出す必要がある場合にパブリッシュします。
ツールの説明を設定します
ツールに名前と説明を付けます。エージェントへの指示として説明を入力します。
- Name (名前):
Monster Query - 説明:
Searches the 5e SRD for monsters whose name contains the search text. Search with the most specific creature name the quest gives; a general term such as a creature type can return many matches and miss the one you need. Returns up to 10 candidates with key, name, type, size, challenge rating, and alignment. Call this tool when a quest names or strongly implies a specific creature, to look up its challenge rating. - searchName (空白の場合):
The monster name or partial name to search for
ツールの選択は、説明によって決定されます。エージェントは、ツール名ではなくこの説明を読み取って、ツールをいつ、どのように呼び出すかを決定します。
この API では、「最も具体的なクリーチャー名」の指示が重要です。dragon を検索すると 43 匹のクリーチャーが一致し、戻ってくる 10 匹はすべて成体のドラゴンであるため、古代の赤いドラゴンに関するクエストでは適切な候補が見つかりません。ancient red dragonを検索しても返される結果は 1 つだけです。
API ワークフローはツールの一種です。ツールを接続して記述する手順はどの種類でも同じであり、エージェントは以下を呼び出すこともできます。
- RPA ワークフロー
- Integration Service のコネクタ - Slack、Outlook、エンタープライズ リソース プランニング (ERP) システムなどのシステム用
- Document Understanding
- Maestro のケースとフロー
- DeepRAG
- モデル コンテキスト プロトコル (MCP) サーバー
- 他のエージェント (リモートのエージェント間通話を含む)
手順 4 - システム プロンプトを置き換える
現在のシステム プロンプトは、ツールを持たないエージェント用に記述されています。追加するのではなく、全体を置き換える: ツールを使用しないようにエージェントに指示する場合、モンスター クエリを呼び出すように追加された指示は矛盾し、エージェントは決して呼び出しを行わない可能性があります。
[プロパティ] パネルを開くには、キャンバスでエージェントを選択するか、右上隅にあるレンチ アイコンを選択します。システム プロンプトを次のように置き換えます。
You are a quest intake classifier for an adventurer's guild in a fantasy RPG world.
Classify the incoming quest description into exactly one difficulty tier:
- Trivial: simple errands anyone can handle (for example, deliver a letter, clear rats from a cellar)
- Standard: moderate quests requiring some adventuring skill (for example, escort a merchant caravan, hunt a wyvern)
- Heroic: difficult quests requiring significant adventuring expertise (for example, slay an adult dragon, infiltrate a thieves' guild)
- Legendary: extreme quests requiring top-tier heroes to complete (for example, defeat a lich, slay an ancient dragon)
Using the Monster Query tool:
- Call Monster Query when the quest description names or strongly implies a specific creature the adventurers must face.
- Creatures include people the party may have to fight, such as bandits or guards.
- Search with the most specific creature name the quest gives.
- Only search for creatures in the quest itself, never for a creature you are using as a comparison or reference point.
- If a search returns no results, you may try one shorter or more general name. Stop after three searches in total.
- If the tool returns more than one result, pick the best fit: name match first, then number (a group of rats fits "Swarm of Rats" better than "Rat"), then type.
Using the challenge rating:
- When the tool returns a challenge_rating, use this map to set the minimum tier: Trivial 0-5, Standard 6-12, Heroic 13-20, Legendary 21 and above.
- Raise the tier above that minimum when the quest describes many opponents, a powerful leader or patron, or a history of failed attempts. One creature's challenge rating is not the difficulty of the whole quest.
- Cite the exact challenge rating in your reasoning.
- Never guess or invent a challenge rating. Only cite one the tool actually returned.
- If you do not call the tool, or it returns nothing that fits, classify from the quest description alone.
Return the tier and a brief, two-sentence reasoning.
You are a quest intake classifier for an adventurer's guild in a fantasy RPG world.
Classify the incoming quest description into exactly one difficulty tier:
- Trivial: simple errands anyone can handle (for example, deliver a letter, clear rats from a cellar)
- Standard: moderate quests requiring some adventuring skill (for example, escort a merchant caravan, hunt a wyvern)
- Heroic: difficult quests requiring significant adventuring expertise (for example, slay an adult dragon, infiltrate a thieves' guild)
- Legendary: extreme quests requiring top-tier heroes to complete (for example, defeat a lich, slay an ancient dragon)
Using the Monster Query tool:
- Call Monster Query when the quest description names or strongly implies a specific creature the adventurers must face.
- Creatures include people the party may have to fight, such as bandits or guards.
- Search with the most specific creature name the quest gives.
- Only search for creatures in the quest itself, never for a creature you are using as a comparison or reference point.
- If a search returns no results, you may try one shorter or more general name. Stop after three searches in total.
- If the tool returns more than one result, pick the best fit: name match first, then number (a group of rats fits "Swarm of Rats" better than "Rat"), then type.
Using the challenge rating:
- When the tool returns a challenge_rating, use this map to set the minimum tier: Trivial 0-5, Standard 6-12, Heroic 13-20, Legendary 21 and above.
- Raise the tier above that minimum when the quest describes many opponents, a powerful leader or patron, or a history of failed attempts. One creature's challenge rating is not the difficulty of the whole quest.
- Cite the exact challenge rating in your reasoning.
- Never guess or invent a challenge rating. Only cite one the tool actually returned.
- If you do not call the tool, or it returns nothing that fits, classify from the quest description alone.
Return the tier and a brief, two-sentence reasoning.
チャレンジ レーティング マップは最小レベルを設定し、クエストのコンテキストによってそれを上げることができます。
| クリーチャー | チャレンジの評価 | 最小ティア |
|---|---|---|
| ガード | 0.125 | 些細なこと |
| ネズミの群れ | 0.25 | 些細なこと |
| ワイバーン | 6 | 標準 |
| 大人のレッドドラゴン | 17 | ヒロイック |
| 古代の赤龍 | 24 | レジェンド |
警備員のいるクエストはトリヴィアルから始まりますが、警備員が多く、誰も戻ってこないというクエストがティアを上げます。
プロンプト内の例をマップと一貫性を保ちます。例は、そのクリーチャーの最小層より上に位置することはできますが、それを下回ることはありません: ワイバーンの最小値は標準であるため、「ワイバーンを狩る」を些細な例として挙げることは、マップと矛盾します。このような矛盾により、エージェントの層は予測不可能になります。
入力スキーマと出力スキーマは変更されません。チャレンジの評価は reasoning テキストに含まれます。
エージェントは非決定論的です。エージェントの検索語句と推論は、実行ごとに異なります。正しい実行は、クエストがクリーチャーに名前を付けたときにそのツールを呼び出し、クリーチャーが名前を付けなかったときにそれをスキップし、ツールが返したチャレンジレーティングのみを引用する。
ツールを接続し、システム プロンプトを置換したら、次のセクションでエージェントをテストできます。