Breadcrumbs

Step 2: Prompting and Testing the AI Agent

👩‍🎓

Follow Our Example User Story

To bring the AI agent to life, David now needs to add the user and system prompts.

Go to the service panel and open the CaseAgent configuration page:

grafik-20251202-134740.png

This is where you enter the prompts, choose the tools that the AI agent should be able to use and test your AI agent. At the bottom of the page, select the service provider alias that you created in step 1:

grafik-20251202-141353.png

Now your AI agent “knows” which AI service provider and AI model it can use.

Writing Prompts

The AI needs to know what you expect from it. A prompt tells the AI what to do. It is the instruction or input you give to an AI so it knows what you want. It can be a question, a command, or any text that guides the AI’s response. Since prompts contain the essential information that brings your AI agent to life, you should carefully craft and structure your prompts.

Your AI agent will need a system and a user prompt to work.

Good to Know: What is the difference between a system prompt and a user prompt?

The system prompt is essential to ensure the AI functions appropriately, reliably, and safely in a given context. It directly influences the tone, style, content, and boundaries of the AI’s responses. An AI agent needs a system prompt to define its behavioral framework and role. It’s essentially the AI’s "internal instruction manual", telling it how to respond to input. The system prompt is usually written by the developer and hidden from the end user.

The user prompt tells the AI what the user wants, e.g. an answer to a question, a request to a database, help with a task, or something else. Unlike a system prompt, a user prompt is a short instruction for the agent with a very precise message. Technically speaking, the user prompt is the input that an end user sends to the AI agent instance via the created REST alias. The user prompt triggers the AI to generate a response.

The prompt editors contain helpful tips to support you in writing good prompts. For more information about prompts, refer to Creating an AI Agent in the Designer Guide.

The User Prompt

👩‍🎓

Follow Our Example User Story

David starts with the user prompt because he knows exactly what input he can expect from customers: a subject line and an email text. He also knows what he expects from the AI agent: a structured output.

In the user prompt, you can enter references to the input data using curly braces { }. The input data is of class CaseRequest, thus consists of the requestText and the subject:

grafik-20251203-104255.png

Enter the following text in field User Prompt:

Analyze the contents of {input.subject} and {input.requestText} and provide a structured output.

grafik-20251203-110741.png

The System Prompt

👩‍🎓

Follow Our Example User Story

David knows that the system prompt must be clear and concise and should contain as much context as possible.

You need to give some thought to the system prompt, and it should also be as detailed as possible. It is therefore advisable to develop the system prompt in several iterations and to test it repeatedly until you are satisfied with the agent's output.

Try to create a first draft yourself. Remember the defined output:

grafik-20251203-114447.png

You can use the notes in field System Prompt as a guide:

System Prompt Note

Example

Clearly define the agent’s role

You process insurance claims that are received by email.

State the desired result

Extract relevant data from the text to determine the insurance category, the costs claimed, and the date of the incident.

Include relevant context

Available insurance categories are “car_insurance”, “animal_insurance”, "private_liability", "household_insurance".

Define contraints and requirements

If you could not extract any information from the input fields, set text to "No data.".

Specify the expected format of the response

Remove offensive language from the email text.

Name the target audience or the use case

Your target audience is ACME Corp. employees who handle insurance claims.

Define your expectations for the tone and style of the agent’s response

Your response is structured and in a neutral tone of voice.

Specify capabilities and boundaries

Identify monetary amounts in US dollars. Ignore other currencies.

Expand for a copy template for the system prompt.

You process insurance claims that are received by email.
Extract relevant data from the text to determine the insurance category, the costs claimed, and the date of the incident. Available insurance categories are “car_insurance”, “animal_insurance”, "private_liability", "household_insurance".
If you could not extract any information from the input fields, set text to "No data.".
Remove offensive language from the email text.
Your target audience is ACME Corp. employees who handle insurance claims.
Your response is structured and in a neutral tone of voice.
Identify monetary amounts in US dollars. Ignore other currencies.

Post your first draft in field System Prompt. Then open tab Testing:

grafik-20251203-115818.png

When the Testing tab is opened, the deployment of the agent starts automatically. You can start testing when the status bar shows that the agent is Online:

grafik-20251203-120105.png

Enter a test email into field Test Input and click Execute. Then inspect the result in field Test Output:

Now analyse the test result. Are you satisfied with it?

grafik-20251203-124314.png

Come up with some more test emails. Don't make it too easy for the agent! Try to find edge cases and use ambiguous wording and content. Analyze the results and try to optimize the system prompt accordingly.

Take a look at our suggested solution and compare it with your prompt. How do your prompt and the proposed solution differ, and where are there similarities?

Solution proposition for an optimized system prompt.

Agent Role: Insurance Case Processor
You are an insurance case agent. Upon receiving an email containing an insurance claim, perform the following steps to extract and process relevant information:

  1. Determine Insurance Category (category)
    Scan the email content for keywords to classify the insurance type:

  • If keywords include "car", "vehicle" similar → set category = "car_insurance"

  • If keywords include "pet", "dog", "cat" → set category = "animal_insurance"

  • If keywords include "neighbor", "property", "liability", "water damage", "mobile phone" → set category = "private_liability"

  • If keywords include "garden", "house", "appartment", "property" → set category = "household_insurance"

  • If none of the above keywords are found → set category = "unknown_insurance"

  1. Extract Claimed Costs (costs)
    Identify monetary amounts in US dollars:

  • Look for formats like "450$", "450 dollars", "450 USD", "450 bucks"

  • Ignore numbers unrelated to currency

  • Extract only the numeric part (e.g., "450") and assign to costs

  • If no valid amount is found → set costs = "0"

  1. Clean and Store Text Fields
    Sanitize and store the email content:

  • {input.subject} and {input.requestText}:

    • Remove offensive language.

    • Summarize the relevant case information in a businesslike way.
      → store in text

    • If you could not extract any information from the input fields, set text to "No data.".

  1. Extract and Interpret Dates (dateIncident)
    Search text for date references:

  • Look for explicit dates (e.g., "01.05.2023", "1 May 2023", "01/05/2023")

  • Look for implicit dates (e.g., "yesterday", "last week", "two days ago", "last Monday")

  • Convert implicit dates to actual dates based on the current date.

  • If no date is found → set dateIncident to the current date

  • Do not invent dates if no clues are present

To ensure that step 3 of the tutorial works as expected, post the suggested solution in field System Prompt before proceeding to the next step.

👩‍💻

Curious about more details?

In this step you got to know the AI agent UI and learned about writing prompts and testing an AI agent.

  • For more information about the AI agent UI and prompting, refer to Creating an AI Agent in the Designer Guide.

  • If you want to know more about the AI agent testing UI, refer to Testing an AI Agent.