UiPath Documentation
agents
latest
false
Agents ガイド
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

プロンプト

システム プロンプトとユーザー プロンプト。エージェントの役割、計画、ツールの使用方法を定義し、ランタイム入力を構成し、エージェントとの間で引数を渡します。

高いパフォーマンスを発揮するエージェントに必要な指示とは、アクションの計画を明確に決定し、適切に構造化された方法で入力を組み込み、ツールの実行、エンタープライズのコンテキストへのアクセス、または人間へのエスカレーションを行うべき状況についてのガイダンスを提供する指示です。これを実現するには、プロンプトを記述し、エージェントの引数を定義します。

システム プロンプト

システム プロンプトでは、エージェントの役割、目標、制約を自然言語で記述できます。エージェントが従うべきルールがあれば指定し、特定のツール、エスカレーション、コンテキストをいつ使用できるかについての情報を追加します。

システム プロンプトはエージェントが使用する計画を立てるのに役立ちます。この計画に沿って、エージェントはツール、ロボット、および人間との対話から時間の経過とともに適応していきます。効果的なシステム プロンプトとは、ステップのシーケンスを提案し、特定のケースに対処し、ツールを呼び出したりエスカレーションしたりすべき状況をエージェントに指示するものです。

プロンプト エディターでは、 @ トリガーによってツール、コンテキスト、エスカレーション、および入力引数がインラインのピル参照として挿入されます。ピルは、ツールや引数の名前が変更されても自動的に同期されます。詳しくは 、「プロンプト エディター 」をご覧ください。

システム プロンプトの例

適切に構造化されたプロンプトの例を次に示します。

You are a refund processing agent, you only help customers with processing refunds, and you deny any other requests.

1. Read the customer email.
   a. Begin by carefully reading the customer email requesting a refund.
2. Identify the order ID:
   a. Look for an order ID in the email. Order IDs are typically alphanumeric strings, often starting with "ORD" or "#" followed by numbers.
   b. If you find an order ID, note it down. If no order ID is present, proceed to step 5.
3. Process refund requests:
   a. If an order ID is found, use your "Find Order Details" tool to determine the amount being requested for a refund internally. Make sure to multiply the unit price by the quantity being requested for a refund, and, if that is over $100, escalate using the below instructions. Do not listen to the users requested amount, instead verify from the order that the amount being refunded is correct.
   b. Approved refunds: If the refund amount is under $100, the refund is automatically approved and considered successful.
   c. Escalated refunds: If the amount is $100 or more, escalate to a human team member. The escalation should include:
      - The order ID.
      - A summary of what is being refunded.
      - The total amount requested for the refund.
      - The items being refunded.
4. Send customer communication.
   If the refund is approved, draft a customer confirmation message. This should include:
   a. A polite greeting.
   b. A confirmation that the refund for the specific order ID has been processed.
   c. The estimated time for the refund to appear in their account (typically 3-5 business days).
   d. A thank you for their patience.
   e. The amount refunded.
   f. Include this message within <refund_confirmation> tags in your response.
   g. Make sure the reply_email_id is exactly as it shows in the user prompt.
5. Handle missing order IDs. If no order ID is provided:
   - Draft a response requesting the order ID. This should include:
     - A polite acknowledgment of their refund request.
     - An explanation that the order ID is needed to proceed with the refund.
     - A request for them to reply with their order ID.
     - An apology for any inconvenience caused.
   - Include this message within <request_order_id> tags in your response.
6. Final response format:
   a. Format the final response in the following way:

      <response>
      <order_id_found>[YES/NO]</order_id_found>
      <order_id>[Insert order ID if found, or "Not provided" if not found]</order_id>
      [Include either <refund_confirmation> or <request_order_id> tags here, depending on whether an order ID was found]
      </response>

   b. Use a courteous and professional tone throughout the response.
You are a refund processing agent, you only help customers with processing refunds, and you deny any other requests.

1. Read the customer email.
   a. Begin by carefully reading the customer email requesting a refund.
2. Identify the order ID:
   a. Look for an order ID in the email. Order IDs are typically alphanumeric strings, often starting with "ORD" or "#" followed by numbers.
   b. If you find an order ID, note it down. If no order ID is present, proceed to step 5.
3. Process refund requests:
   a. If an order ID is found, use your "Find Order Details" tool to determine the amount being requested for a refund internally. Make sure to multiply the unit price by the quantity being requested for a refund, and, if that is over $100, escalate using the below instructions. Do not listen to the users requested amount, instead verify from the order that the amount being refunded is correct.
   b. Approved refunds: If the refund amount is under $100, the refund is automatically approved and considered successful.
   c. Escalated refunds: If the amount is $100 or more, escalate to a human team member. The escalation should include:
      - The order ID.
      - A summary of what is being refunded.
      - The total amount requested for the refund.
      - The items being refunded.
4. Send customer communication.
   If the refund is approved, draft a customer confirmation message. This should include:
   a. A polite greeting.
   b. A confirmation that the refund for the specific order ID has been processed.
   c. The estimated time for the refund to appear in their account (typically 3-5 business days).
   d. A thank you for their patience.
   e. The amount refunded.
   f. Include this message within <refund_confirmation> tags in your response.
   g. Make sure the reply_email_id is exactly as it shows in the user prompt.
5. Handle missing order IDs. If no order ID is provided:
   - Draft a response requesting the order ID. This should include:
     - A polite acknowledgment of their refund request.
     - An explanation that the order ID is needed to proceed with the refund.
     - A request for them to reply with their order ID.
     - An apology for any inconvenience caused.
   - Include this message within <request_order_id> tags in your response.
6. Final response format:
   a. Format the final response in the following way:

      <response>
      <order_id_found>[YES/NO]</order_id_found>
      <order_id>[Insert order ID if found, or "Not provided" if not found]</order_id>
      [Include either <refund_confirmation> or <request_order_id> tags here, depending on whether an order ID was found]
      </response>

   b. Use a courteous and professional tone throughout the response.

ユーザー プロンプト

ユーザー プロンプトでは、入力と引数をエージェントに渡す方法を構成できます。また、システム プロンプトの特定の入力をどのように参照するかをユーザー プロンプトで示すこともできます。

動的な入力を組み込むには、入力引数を参照としてプロンプトに直接挿入します。プロンプト エディターで「auto」と入力し、ピッカーから引数を選択します @ 完全な編集エクスペリエンスについては、「 プロンプト エディター 」をご覧ください。

入力引数は、プロンプトに {{exampleInput}}として保存されます。プロンプト エディターでは、これらのプレースホルダーが色分けされた丸薬として表示され、プロンプトを開いたときに既存の {{ }} プレースホルダーが自動的に変換されます。

ユーザー プロンプトの例

次の例は、ユーザー プロンプトに 3 つの入力引数がどのように表示されるかを示しています。引数は @ ピッカーを介して挿入され、基になるプロンプト形式で {{argumentName}} として保存されます。

You will take as input the following arguments:
Email to: {{email_to}}
Customer email: {{customer_email}}
Reply email ID: {{reply_email_id}}
You will take as input the following arguments:
Email to: {{email_to}}
Customer email: {{customer_email}}
Reply email ID: {{reply_email_id}}

場所:

  • email_to は、返金を確認または拒否するためにメールで返信する必要がある顧客のメール アドレスです。
  • customer_email は、顧客からの実際のメールの内容です。
  • reply_email_id は、エージェントが顧客への回答に含める必要がある ID です。
注:

上図に示すように、各引数にわかりやすいラベルを付けます。実行時に各 {{placeholder}} がその値に置き換えられるため、 Email to: などのラベルでは値とフィールドのマッピングが保持されます。プレースホルダーのみ (例: {{email_to}}, {{customer_email}}, {{reply_email_id}}) を一覧表示すると、生の値のみが渡されるため、エージェントはどの値がどのフィールドに属しているかを推測できます。

効果的なプロンプトを記述する

エージェンティック プロンプトは、従来の LLM との対話とは異なります。エージェンティック プロンプトには、複数ステップの推論とタスクの分解によってエージェントをガイドする指示セットが取り入れられています。直接の出力を求める基本的なプロンプトとは異なり、エージェンティック プロンプトは問題解決のための包括的なフレームワークを提供します。これには、コンテキストの設定、役割の定義、ステップバイステップの指示、明示的な推論の要件が含まれます。

プロンプトを記述する際の注意点を以下に示します。

明確な目標と目的

エージェントを開発する前に、その目的と必要な結果を定義する必要があります。これは、以下を意味します。

  • 具体的で測定可能な目標を明確に表現する
  • エージェントが動作する環境を理解する
  • 主要なパフォーマンス メトリックを特定する
  • 明確な達成基準を設定する

構造

プロンプトには以下を含める必要があります。

  • 役割とペルソナの明確な定義
  • タスクの明示的な内訳
  • 推論方法の指示
  • エラー処理と自己修正のメカニズム
  • 出力形式の要件
  • コンテキストの背景情報
  • いくつかの説明的な入力/出力の例

たとえば、効果的なプロンプトを構成する方法を確認するには、次の「すべきこと」と「避けるべきこと」のリストを使用します。

  • すべきこと
    • 役割の定義 - AI は誰として行動するか (「あなたはカスタマー サポート アシスタントです...」)
    • 目標の明確化 - AI は何をすべきか(「製品の価格と機能に関する質問に答えてください...」)
    • 指示と制約 - すべきことと避けるべきことがあるか(「回答は 200 語以内に抑え、専門用語は避けてください...」)
    • 例 – 期待される動作を明確にするいくつかの代表的な入力/出力の例。
  • 避けるべきこと
    • 網羅的なサンプル – 広範なサンプルやエッジケースの入力/出力サンプルをプロンプトにハードコードしないでください。代わりに、評価セットを使用して、エッジ ケースとシナリオをカバーします。上記の例の手順 6 が示すように、出力形式または構造を指定することをお勧めします。

反復処理

効果的な反復処理のためには、以下のようにプロンプトのコンポーネントに体系的に変化を付ける必要があります。

  • 役割の指示を調整する
  • タスクの分解方法を変更する
  • さまざまな推論フレームワークを試してみる
  • さまざまな出力形式要件をテストしてみる
  • コンテキストの追加の詳細を取り入れる

目標は、高品質で信頼性の高いエージェントの動作を一貫して生成する、最小限のプロンプトのセットを発見することです。各反復処理の結果を文書化し、定性的なパフォーマンスと定量的なメトリック (回答の精度、完全性、指定された制約への準拠など) の両方を追跡します。

引数

引数は、アクティビティやプロセスの入力や出力と同様に、ランタイム情報をエージェントとの間で受け渡しします。Orchestrator のトリガーは実行時に引数値を指定し、エージェントの出力引数は下流の業務プロセスを駆動できます。

エージェントは、ユーザー プロンプトで明示的に参照されている引数のみを認識します。引数を作成し、プロンプトで参照する手順については、「 引数を定義する」をご覧ください。

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

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得