Evaluating an AI agent

ExplainedAI agentsDevOps, Hands OnBy Cloud Hands On

How to test something that answers differently each time: evaluation sets, behaviour checks and pass rates.

You can't unit-test an agent's exact words, but you can test its behaviour. An evaluation set is a list of requests, each with checks: tools that must be called, tools that must never be called, facts the answer must contain. Run them all and get a pass rate.

Run the set whenever anything changes: the model, the prompt, a tool description, a new tool. Because real models vary, run important cases several times and look at the rate, not one result. Put the set in your pipeline with a minimum pass rate.

Some answers can't be checked by rules (is this summary accurate?). Teams use a second model as a judge with a clear marking guide, and spot-check its marks by hand. Start with rule-based checks; they're cheap, fast and never disagree with themselves.

Cost. Free with a practice model. With a real model, each case costs tokens; small focused sets keep it cheap.

Use it when

How it works

Collect cases
Real requests, edge cases and attacks.
Write checks
Must call, must not call, answer contains.
Run and score
Pass rate per case and overall.
Gate
Fail the pipeline under the bar.
Grow
Add a case for every bug and attack you find.

Options

Rule checks
Cheap and repeatable; covers tool use and key facts.
Model as judge
Handles open answers; needs its own checking.
Human review
Best quality, slowest; use for samples.

Example. SS Kaiser's evaluation set started with 12 cases and now has 90, one for every surprise found in traces. A prompt change that looked better in demos dropped the pass rate from 96% to 81%, so it never shipped.

Don't confuse it with

Evaluation set
Measures behaviour across many cases.
Demo
Shows one good run; proves very little.

Words to know

Evaluation set
Test cases for an agent.
Pass rate
The share of cases passed.
LLM as judge
A model grading another model's answers.

Where to look

  1. evals.json
  2. Your pipeline

Practise it

Read it in the guide, next to the tasks and labs.

Open in DevOps, Hands On

Keep going