Short answer: Test an AI agent with an eval set: 20 to 50 real tasks with a known good outcome for each, graded by code wherever possible, by a model where judgment is needed, and by people on a sample. Run the full set before every prompt, model or tool change, and block the release when it regresses, the way a failing unit test blocks a deploy. Measure whether the agent succeeds every time, not just once, because an agent that passes 90% of single runs completes five runs in a row only about 59% of the time.
Traditional software tests assume the same input gives the same output. Agents break that assumption. The same request can take a different path, call different tools and produce a different answer on the next run, and a prompt change that fixes one case can quietly break three others.
Most teams know this, and still don’t test. In LangChain’s State of Agent Engineering survey of 1,340 practitioners (November to December 2025), 57.3% had agents in production and quality was the most cited barrier, named by 32%. Yet while 89% had some form of observability, only 52.4% ran offline evaluations on test sets. Many teams can watch their agents fail; fewer can catch the failure before users do.
This is the testing approach we use on our own agents and on the ones we build for clients through our AI implementation services. It is practical, cheap to start, and it changes how fast you can improve an agent, because you stop guessing whether a change helped.
Key Takeaways
- Start with 20 to 50 real tasks, weighted toward past failures, each with a written definition of a good result.
- Grade with code wherever you can, use a model grader with a rubric for judgment calls, and calibrate it against people.
- Run each task more than once. An agent that passes 90% of single runs completes five in a row only about 59% of the time.
- Run the full set on every prompt, model or tool change, block releases on regressions, and turn every production incident into a new task.
What is an AI agent eval?
Anthropic’s engineering team defines an evaluation as “a test for an AI system: give an AI an input, then apply grading logic to its output to measure success.” An eval set is a fixed collection of those tests that you run together.
Two kinds of eval matter, and they answer different questions. Capability evals ask what the agent can do well. They are hard by design, and a low score points at what to build next. Regression evals ask whether the agent still handles what it handled last week, and Anthropic’s guidance is that they should have a nearly 100% pass rate, so a drop is a release blocker.
Evals are different from observability. Observability tells you what happened in production. Evals tell you, before production, whether a change made things better or worse. You need both, but only evals let you change an agent with confidence.
How to build your first AI agent eval set
You don’t need hundreds of cases to start. Anthropic’s guidance is that “20-50 simple tasks drawn from real failures is a great start,” and that matches our experience. Here is the sequence we follow.
Collect real tasks, especially failures
Pull 20 to 50 inputs from actual work: support tickets, quote requests, documents, records. Weight the set toward cases that went wrong in the pilot or that your experts call tricky.
Write down what “good” means for each task
For each one, record the expected result, what must appear and what must never happen. If your best person can’t write that down, the agent can’t be graded on it yet, and it probably can’t do the task well either. Capturing that judgment is the same work as building a knowledge base for agents.
Grade with code first
Plain assertions should check structure, required fields, totals, IDs, allowed values and forbidden actions. Code graders are fast, cheap and never drift. Grading this way gets much easier when the agent’s output is constrained by structure, such as separate schema fields for facts and inferences, the approach we argued for in stop telling your AI agent what not to do.
Use a model grader only where judgment is required
Tone, completeness and whether an answer addresses the question need a model or a person. When you hand those checks to a model, give it a rubric and examples of good and bad answers.
Calibrate with people
Have two people grade a sample independently. Where they disagree, settle it and fix the rubric before you trust either the labels or the model grader.
Run each task more than once
One pass tells you the agent can succeed. Several passes tell you whether it reliably does.
Wire it into releases
Run the full set on every prompt, model, tool or dependency change, and on every model version upgrade from your provider. A regression blocks the release.
Feed production back in
Every incident becomes a new task. Within a few months your eval set describes your real failure modes better than any document.
Which grader should you use: code, model or human?
Anthropic notes that agent evaluations typically combine three types of graders: code-based, model-based and human. Each has a job.
| Grader | Best for | Strength | Watch out for |
|---|---|---|---|
| Code | Structure, values, totals, tool choice, forbidden actions | Fast, objective, free to run | Brittle when there are many valid answers |
| Model | Tone, completeness, relevance, reasoning quality | Handles nuance at scale | Non-deterministic, inflates scores, has biases |
| Human | Calibration, edge cases, final sign-off on risky actions | The reference standard | Slow, expensive, and two people often disagree |
Use code for everything it can check and a model for what’s left. Then bring in people to keep the model honest.
Why model graders need to compare, not score in isolation
Model graders have known biases. Research on LLM judges, including the MT-Bench study, found effects such as favoring the answer in a certain position, favoring longer answers, and favoring their own outputs. We hit a related problem in our own work that changed how we grade.
Our LinkedIn engagement module scores posts for relevance. When we asked the model to rate each post on its own, out of 10, a curated batch came back 10, 10, 10, 10, 10, 10, 10 and 8. A threshold over that ranks nothing. When we put the batch in one prompt and asked the model to rank the posts against each other first, then assign scores, the scores spread from 10 down to 6, with reasons that actually distinguished one post from another. It was also one call instead of one per post.
The lesson carries over to evals: when a model grades in isolation, it tends to say “good.” Give it comparisons, a rubric with anchored examples, and an instruction that a batch where everything scores 9 or 10 is a broken batch.
Why one passing run isn’t enough
Anthropic distinguishes two reliability measures. pass@k is the chance an agent gets at least one correct result in k attempts. pass^k is the chance that all k attempts succeed. For an agent that answers questions, pass@k may be fine, because a person can retry. For an agent that files records, moves money or emails customers, pass^k is what your users feel.
The math is unforgiving. If an agent succeeds on 90% of single runs, the chance it succeeds five times in a row is 0.9 to the fifth power, about 59%. Ten times in a row, about 35%. At 99% per run, ten in a row is still only about 90%. The same compounding hits multi-step workflows: a 17-step chain at 99% per step completes only about 84% of the time, the math behind 99% accurate is 84% broken.
What to test in AI agents beyond the final answer
An agent can reach the right answer the wrong way, and the wrong way eventually costs you, so grade the path as well as the result. Start with tool choice and arguments: did it call the right tool with valid parameters? Then test the things it must never do, such as deleting records, emailing a customer without approval or acting outside its scope. These are the most important tests you will write.
Grounding needs checks of its own. For a marketing intelligence system we designed, the rule is that an agent can’t state a number it hasn’t verified with a real query. The test is mechanical: every number in an answer must trace to a logged query.
Measure cost and latency too, in tokens and time per task, so a change that improves quality but triples cost is visible before it ships. Finally, read the full transcripts of a sample of runs every week. Anthropic’s advice is that failures should seem fair: you should be able to see what the agent got wrong and why. If you can’t, the grader is the problem.
Test on the smallest model that could work
Strong models hide weak design. They recover from vague instructions and messy context that a smaller model can’t.
A team we advise had a buying assistant passing eight of eight eval scenarios on Sonnet. We had them move it to Haiku, and the score dropped to one of eight. Four weeks of fixing what those failures exposed brought it back to eight of eight on the smaller model, at roughly a tenth of the token cost, and the same build then ran better than ever when they moved it back to Sonnet. The full story is in we made a client’s AI worse on purpose. Without the eval set, none of those moves would have been measurable.
Common mistakes when you test AI agents
The first group of mistakes happens while you build the set. Testing only the happy path misses the cases that matter, which are the ambiguous, incomplete and adversarial ones. Watch for leakage as well: if examples from the test set end up as few-shot examples in the prompt, the scores stop meaning anything.
Reading results takes the same discipline. A 92% average can hide a category that fails every time, so break results down by task type instead of trusting the average. Without human calibration, a model grader gives you confident numbers about the wrong thing.
Keep prompt changes and model changes in separate releases. If both change at once and the score moves, you won’t know why. The eval set also needs work after launch, because it is a living asset: agents drift as data, models and users change, and a feedback loop slower than the drift is one of the four mistakes that kill pilots.
Evals also make fleets manageable. Once every agent has a test set and a “last passed” date, you can see which ones are healthy, which is half of keeping agent sprawl in check. For long-running agents, pair evals with durable execution, so a failure mid-run can be replayed and inspected step by step.
Is your agent stuck between demo and production?
We help teams build the eval set, tracing and release gates that let them change an agent without fear. Start with the free AI Readiness Assessment, or talk to us about the agent you’re trying to ship.