Recommending a Testing Process and Metrics for Agents
This lesson explains why agent testing differs and the levels, metrics and tools it uses.
Learning outcomes
After completing this lesson, you will be able to:
- Explain why agents need evaluative as well as deterministic tests.
- Describe the levels of an agent test process.
- Choose test tools and metrics for an agent.
Why agent testing is different
A traditional application returns the same output for the same input, so a test passes or fails. An agent can phrase the same correct answer in many ways, choose a different but valid sequence of tools, or give a subtly wrong answer that reads well. Agent testing therefore combines deterministic checks, where behaviour must be exact (such as an authored topic or an agent flow), with evaluative checks that score responses against criteria, often over many runs. It also tests things that conventional applications rarely face, such as attempts to manipulate the agent with crafted prompts.
The test process
A complete test process includes several levels, each with its own purpose.
- Component tests: each topic, tool and agent flow is tested with valid, invalid and boundary inputs.
- Conversation tests: test sets of single-turn and multi-turn conversations check answers, topic selection and tool use.
- Knowledge tests: questions with known answers in the sources check retrieval and groundedness.
- Safety and adversarial tests: prompts that attempt jailbreaks, prompt injection, out-of-scope requests and harmful content check the controls.
- Integration and end-to-end tests: complete business scenarios across the systems the agent touches.
- Performance and capacity tests: latency and consumption under expected volumes.
- User acceptance tests: business users confirm that the agent meets the requirements.
- Regression tests: the full test set runs before each release, because a change to one instruction can affect many conversations.
Metrics and tools
Each level uses metrics suited to it. The following table lists common test metrics.
| Metric | What it checks | Typical threshold |
|---|---|---|
| Answer correctness | The answer matches the expected answer or criteria | Set per agent, such as 90% |
| Groundedness | The answer is supported by sources | High for authoritative agents |
| Topic and tool selection accuracy | The right topic or tool was chosen | Close to 100% for critical paths |
| Task completion | Multi-step tasks end in the correct state | Close to 100% for critical tasks |
| Escalation correctness | Hand-off happens when, and only when, required | Close to 100% |
| Safety pass rate | Adversarial prompts are refused or handled | Close to 100% |
| Latency | Response time within target | Such as 95% under 5 seconds |
Tools support these tests. The Copilot Studio test pane and activity map show how each conversation was handled. Agent evaluation in Copilot Studio (preview) runs test sets written manually, generated with AI or uploaded as CSV, scoring general quality; it supports agents with no authentication or Authenticate with Microsoft, not manual authentication. The Copilot Studio Kit adds test types such as response match, attachment checks, topic match, generative answer tests validated by AI, multi-turn tests and plan validation, which checks that expected tools are in the agent's plan, running against the Direct Line API. Foundry evaluations score agents and models with built-in and custom evaluators.
A test plan for a claims agent
An insurer will release a Copilot Studio claims agent that answers policy questions, collects first notice of loss through a topic, and calls an agent flow to create the claim. It uses manual authentication with the insurer's customer identity provider. What test approach should you recommend?
The plan includes component tests of the loss topic and the claim flow, knowledge tests with policy questions and known answers for groundedness, adversarial tests of out-of-scope and injection attempts, and end-to-end tests that create claims in the claims system. Because the agent uses manual authentication, Copilot Studio agent evaluation cannot run authenticated tests, so the Copilot Studio Kit, which runs against Direct Line, is suitable for automated conversation, topic match and plan validation tests. The full set runs as a regression suite before every release, with thresholds agreed with the business.
Which test type in the Copilot Studio Kit checks that the expected tools appear in the agent's plan?
Show answer
Plan validation.
Exam Tips
Remember for the exam
- Combine deterministic checks for topics and flows with evaluative checks for generated answers.
- Test at component, conversation, knowledge, safety, end-to-end, performance, acceptance and regression levels.
- Agent evaluation (preview) supports no authentication or Authenticate with Microsoft only.
- The Copilot Studio Kit adds response, topic, generative, multi-turn and plan validation tests.