UiPath Documentation
agents
latest
false

Agents user guide

Prompts

A high-performing agent requires instructions that clearly determine a plan for action, incorporate inputs in a well-structured way, and gives guidance on when to run tools, access enterprise context, or escalate to a human. You achieve this by writing prompts and defining agent arguments.

System prompts

System prompts allow you to describe in natural language the role, goal, and constraints of an agent. You specify any rules for it to follow, and add information about when it can use certain tools, escalations, or context.

The system prompt helps the agent form a plan that it uses and adapts over time from interactions with tools, robots, and humans. A good system prompt suggests a sequence of steps, addresses certain cases, and tells an agent when it should call tools or raise escalations.

In the Prompt editor, the @ trigger inserts tools, contexts, escalations, and input arguments as inline pill references. Pills stay in sync automatically when a tool or argument is renamed. See Prompt editor for details.

System prompt example

Here is an example of a well-structured prompt:

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

User prompts

User prompts allow you to structure how the inputs and arguments are passed to the agent. You can also show in the user prompt how you refer to certain inputs in the system prompt.

To incorporate dynamic input, insert input arguments as references directly in the prompt. In the prompt editor, type @ and select an argument from the picker — refer to Prompt editor for the full editing experience.

Input arguments are stored in the prompt as {{exampleInput}}. The prompt editor displays them as color-coded pills and converts existing {{ }} placeholders automatically when a prompt is opened.

User prompt example

The following example shows how three input arguments appear in a user prompt. Arguments are inserted via the @ picker and stored as {{argumentName}} in the underlying prompt format:

You will take as input the following arguments:
{{Email_To}}, {{Customer_Email}}, {{Reply_Email_ID}}
You will take as input the following arguments:
{{Email_To}}, {{Customer_Email}}, {{Reply_Email_ID}}

Where:

  • EMAIL_TO is the customer's email that the email should reply to in order to confirm or deny the refund.
  • CUSTOMER_EMAIL is the actual email content from the customer.
  • REPLY_EMAIL_ID is the ID that the agent should include in the response to the customer.

Writing effective prompts

Agentic prompts aren't like traditional LLM interactions. They incorporate instruction sets that guide the agent through multi-step reasoning and task decomposition. Unlike basic prompts that request direct output, agentic prompts provide a comprehensive framework for problem-solving. This includes context setting, role definition, step-by-step instructions, and explicit reasoning requirements.

Here are some things to keep in mind when writing prompts.

Clear goal and objective

Before developing an agent, you must define its purpose and desired outcomes. This means:

  • Articulating specific, measurable objectives.
  • Understanding the environment in which the agent will operate.
  • Identifying key performance metrics.
  • Establishing clear success criteria.

Structure

Prompts should include:

  • Clear role and persona definition
  • Explicit task breakdown
  • Reasoning methodology instructions
  • Error handling and self-correction mechanisms
  • Output formatting requirements
  • Contextual background information

For example, use the following do's and don'ts list to learn how to structure effective prompts:

  • Do:
    • Role definition – Who is the AI acting as? ("You are a customer support assistant...")
    • Goal specification – What should it do? ("Answer questions about product pricing and features...")
    • Instructions and constraints – Any do’s and don’ts? ("Keep responses under 200 words, avoid technical jargon...")
  • Don't:
    • Examples – Don’t provide sample inputs and expected outputs as this is already covered in the input and output arguments.

Iterations

Effective iteration involves systematic variation of prompt components:

  • Adjust role instructions.
  • Modify task decomposition strategies.
  • Experiment with reasoning frameworks.
  • Test different output formatting requirements.
  • Introduce additional contextual details.

The goal is to discover the minimal set of prompts that consistently produce high-quality, reliable agent behaviors. Document the results of each iteration, tracking both qualitative performance and quantitative metrics like response accuracy, completeness, and adherence to specified constraints.

Arguments

Arguments pass runtime information into and out of an agent, just as inputs and outputs do for activities or processes. A trigger in Orchestrator can supply argument values at runtime, and an agent's output arguments can drive downstream business processes.

The agent sees only arguments that are explicitly referenced in the user prompt. For instructions on creating arguments and referencing them in prompts, see Defining arguments.

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated