Find your way around Agent Lab
Open Agents → Agent Lab and choose the task you want to perform:- Datasets: group questions and expected outcomes into repeatable test suites. Search by name, description, or agent. Open a dataset to edit its test cases, or select View runs to open its Simulation Runs tab.
- Quick Test: choose an agent, enter a question, and inspect its answer, tool calls, and routing. Save a useful test to a dataset to run it again. Your question and result stay available when switching between the lab’s tabs; leaving the page or refreshing clears them.
- Personas: define reusable user identities and business context, then assign them to test cases. Search by profile name, description, or agent.
Tests run through the same path as a live conversation. Tools and API data sources the agent uses can perform real actions, except those you replace with overrides.
Test an agent’s draft
To try changes while you edit an agent, open an existing standard text agent and select Test agent next to Publish. The panel tests the unpublished draft: instructions, model, sources and tools. You can keep chatting as you change the configuration, and Retry replays the last question with the new version. See Drafts and Testing. Use Agent Lab when you need client context, personas or saved datasets.Quick Test
- In Agent Lab, open Quick Test.
- Select an agent and type a question.
- Click Run Test to see the response and the tools called.
- Click Save to Dataset to keep the question as a test case, in an existing dataset or a new one.
Testing with client context
Your application can send context with each message, such as the customer’s plan or the current page (see Page Context). To reproduce it, click Add client context in Quick Test or in the test case editor:- Choose Text to enter a sentence, such as “The customer has a premium plan and prefers replies in French.”
- Choose JSON object to paste structured data, such as
{"plan": "premium", "language": "fr"}. Use double quotes around property names and strings. - Choose Full JSON (advanced) to edit the whole context, with several entries and their names, descriptions and stability. Existing contexts with several entries open in this mode.
name, description, data and stable. Set stable to true for context that stays the same for the whole conversation; it defaults to false.
Saving a quick test to a dataset also saves its context. In multi-turn test cases, the context is sent with every message. Leave it empty to test without context.
Create a dataset
- In Agent Lab, open Datasets and click Create Dataset.
- Enter a Dataset Name and an optional Description.
- Optionally choose a Bound Agent. The run dialog uses that agent; leave it empty to choose an agent when starting each run.
- Save the dataset, then add test cases.
question, expected_type, expected_answer, expected_tool_name and expected_tool_args.
Add test cases
Click Add Test Case and choose the Expected Type:
The expected answer does not need to match word for word. An AI evaluator compares the meaning.
Multi-turn test cases
Switch from Single Turn to Multi-Turn to test a whole conversation, for example an agent that collects information over several messages. For each step, enter the User Message and its expected outcome, then click Add Step for the next one. All steps run in the same conversation, so the agent keeps the context of earlier messages.Generate test cases with AI
Instead of writing every test case, let AGO write them from the agent’s knowledge:- Open the dataset and click Generate with AI.
- Choose the agent and the Generation mode:
- From knowledge documents: questions cover the topics in the agent’s knowledge documents, phrased the way real users write.
- From a user profile: describe the user and how they behave, for example “a new payroll manager, in a hurry, who asks short and sometimes vague questions about leave management”. Questions are written the way that user would ask them; expected answers still come from the knowledge documents.
- Set the Number of test cases (1 to 50) and the Max user messages per conversation (1 to 10). Set it to 1 for single-question test cases.
- Click Generate with AI.
Generation reads the agent’s knowledge documents, or the whole knowledge base when the agent has no sources. If no document has readable content, no test cases are created.
Personas
Personas describe the users your tests simulate.- In Agent Lab, open Personas and click Create Persona.
- Enter a Persona Name. Optionally fill Role, Description and Behavior Notes; the behavior section includes an example to help you get started.
- Open Advanced · User identity when you need User Overrides, entered as a JSON object to simulate a widget user, for example
{"email": "test@example.com", "additional_info": {"jwt_claims": {"plan": "premium"}}}. JWT claims grant permissions through your JWT permission rules, as for a real user. - Save to return to the personas list.
Mock API data and tool results
In a test case, you can replace what an API data source or a tool returns, to test a specific situation without changing real data:- API Data Overrides: click Add API Override, select an API data source and enter the JSON it should return. The source’s response data path and excluded paths still apply, so you can paste the full API response.
- Tool Call Overrides: click Add Tool Override, enter the tool name and the JSON result it should return.
Run a simulation
- In Agent Lab > Datasets, open a dataset, select Simulation Runs, then click Start New Run.
- Select the agent, unless the dataset is bound to one.
- Optionally check Detect knowledge gaps.
- Click Start Run. Progress updates as tests complete.
Detecting knowledge gaps from a run
With Detect knowledge gaps checked, AGO analyzes the failed Text Answer tests when the run completes. For each gap it finds, it files a Knowledge Gap Report with the source “Simulation lab”, including the question, what was missing and suggested edits. Tool call and agent routing failures are not analyzed. Together with AI-generated test cases, this gives you an audit loop: generate questions from your knowledge base, run them, and review the gaps.Read the results
Filter results with All Results, Passed Only or Failed Only. Each result shows:- the question, the expected outcome and the agent’s actual answer or tool calls
- whether it passed, and its match percentage
- the evaluator’s reasoning
- Criteria Scores, when available: accuracy, completeness and relevance for text answers, or criteria for the expected tool call or agent routing
What to do with the success rate
Good practices
- Cover the questions your users ask most, and the workflows they follow from start to finish.
- Add edge cases: vague questions, out-of-scope requests, several questions in one message, typos.
- Test escalations with Tool Call test cases.
- Organize datasets by topic (“Billing”, “Technical”) or by importance (“Core”, “Edge cases”).
- Run your datasets after every prompt, model or knowledge change, and before publishing.
Troubleshooting
A test fails although the answer looks right
A test fails although the answer looks right
- Read the evaluator’s reasoning.
- Make the expected answer less specific: describe the key facts rather than exact wording.
- Check that the agent has access to the knowledge it needs.
A tool call test fails although the agent called the tool
A tool call test fails although the agent called the tool
- Check the spelling of the expected tool name.
- Remove expected arguments that are too strict, or check the argument names in the actual tool call.
Runs take too long
Runs take too long
Split large datasets into smaller, focused ones, and run the full set only before publishing.
The same test passes and fails from one run to the next
The same test passes and fails from one run to the next
- Lower the agent’s temperature.
- Make the expected answer more flexible.
- Look for content that changes over time, such as dates or prices.
Related
- AI Debugger: analyze why an answer went wrong
- Agents: agent configuration reference
- Monitor and Improve Performance: analytics workflow
