Evals
LLM Agent Evals: A Failure-Type Framework
Evaluate agent trajectories with separate checks for planning, tool selection, and state tracking, then build a tiered regression suite for CI.
Key takeaways
- Agent evals must score trajectories, not just final answers, because two agents can reach the same output while one wastes 40,000 tokens and calls the wrong tools.
- Test three failure types separately: planning failures, tool-selection failures, and state-tracking failures, each with its own eval method.
- Use deterministic checks for anything machine-verifiable and reserve LLM-as-judge for open-ended output, calibrating it against 30-50 human-labeled examples.
- Build a regression suite from 30-50 real production failure traces, tiered into smoke (every PR), full (pre-merge), and nightly tiers.
- A minimum viable stack is a golden trajectory set, deterministic tool and output checks, and one judge pass on planning quality, all wired into CI.
LLM agent evals catch the failures that single-prompt testing misses: bad planning, wrong tool calls, and lost state across multi-step runs. This framework maps each failure type to a specific eval method, then shows how to assemble them into a regression suite that runs in CI before your agent touches real users or your token bill.
What are LLM agent evals and how do they differ from single-turn LLM evals?
LLM agent evals measure whether a multi-step system — one that plans, calls tools, and tracks state across turns — reaches correct outcomes through correct behavior. A single-turn eval scores one prompt and one response. An agent eval scores a trajectory: which tools the agent picked, whether it passed the right state forward, and whether it stopped when the job was done.
Single-turn evals score text; agent evals score behavior
Per-response scoring breaks down on agents for a simple reason: two agents can produce identical final answers while one wasted 40,000 tokens and called the wrong tool twice to get there. Scoring only the output hides that, and the token bill shows up later on real traffic. Trajectory quality — plan coherence, tool selection, state handling — is what predicts production reliability.
There is also a measurement problem. Many teams lean on an LLM judge to grade outputs, but judge models carry known biases like favoring longer or more confident answers, which the original LLM-as-judge study documented (MT-Bench / "Judging LLM-as-a-Judge with MT-Bench"). With agents, that noise compounds: a judge scoring one flawed step can mislabel the whole trajectory. That is why agent evals mix deterministic checks on each step with judgment applied sparingly, a split later sections build on.
Which failure modes do agent evals need to catch that standard evals miss?
Single-turn evals score one response. Agents fail across a trajectory, so you need to test three failure types separately.
Planning failures
The agent picks a valid sequence of steps that cannot reach the goal: it re-retrieves documents it already has, loops between two subtasks, or decomposes a request into steps that never address the user's actual constraint. The final answer looks plausible, so answer-only scoring passes it.
Tool-selection failures
The agent calls the wrong tool, calls the right tool with wrong arguments, or skips a call entirely and hallucinates the output. Example: it queries the analytics API with a customer's name instead of their ID, gets an empty result, and invents a number from context.
State-tracking failures
Multi-step agents lose track of what they have already done. They charge a card twice, overwrite a value the user corrected two turns ago, or cite stale retrieval results after new data arrived.
Each failure mode needs its own eval method, which is why a single accuracy score tells you almost nothing about where production traffic will break.
How do you evaluate an agent's trajectory, not just its final answer?
Two agents can reach the same correct answer while one wastes 40,000 tokens and calls the wrong tools first. Outcome-only scoring hides that difference, and the difference is your token bill. Trajectory evaluation logs every step — prompt, tool call, arguments, retrieved context, intermediate state — and scores the path the agent took, not just where it landed.
Golden trajectories and allowed deviations
Start by recording one or two known-good step sequences for each core task. These golden trajectories become your reference. But agents legitimately vary: they might skip a step, reorder independent calls, or use a different tool that reaches the same result. So compare against the golden path with tolerance — flag deviations only when the agent calls a destructive tool out of order, skips a required step, or loops. The τ-bench work on agent evaluation treats trajectory adherence as a first-class metric alongside task completion, which is the right framing (AgentBench-style trajectory evaluation, τ-bench).
Step-level scoring vs outcome-only scoring
Score each step on three axes: correct tool selected, correct arguments passed, state advanced as expected. Then aggregate with partial credit — an agent that gets 7 of 8 steps right is a different problem from one that flails entirely, and your fix differs accordingly. Log every run with tracing so step-level scores attach to real production traces, not just your test set.
What metrics matter for tool-use and tool-selection accuracy?
Track four numbers per eval run: tool-call precision (of the calls the agent made, how many were correct), tool-call recall (of the calls it should have made, how many it made), argument validity rate (calls with schema-valid, plausible arguments), and redundant-call rate (repeated calls that add tokens without adding information). Precision and recall catch the planner picking the wrong tool or skipping one it needed. Argument validity catches the quieter failure: right tool, wrong parameters, wrong result.
Argument-level checks
Score arguments against the tool's schema first, deterministically: types, required fields, enum values. Then score against the task's ground truth where you have it, e.g. did the agent query the right date range or the right customer ID? A call can be schema-valid and still wrong, so keep both checks.
| Metric | What it catches | How to compute |
|---|---|---|
| Tool-call precision | Wrong or unnecessary tool picks | Correct calls / total calls |
| Tool-call recall | Missed steps | Required calls made / required calls |
| Argument validity | Right tool, wrong params | Valid-arg calls / total calls |
| Redundant-call rate | Wasted loops | Duplicate calls / total calls |
Cost and latency per task
Cost per successful task is your production metric: total tokens and tool-execution time divided by tasks that finished correctly. An agent that succeeds but spends 60k tokens per task is failing economically, and redundant-call rate is usually the cause. Log both per run so a regression suite can flag cost regressions, not just accuracy ones.
When should you use LLM-as-judge versus deterministic checks for agent evals?
Use a deterministic check for anything a machine can verify: did the agent call the right tool, return valid JSON, stay under a token budget, produce the required field. Use an LLM-as-judge only for open-ended output where correctness is a matter of quality, like whether a support reply actually resolves the ticket. Every judge call also costs tokens and adds latency to your CI run, so the smaller the judge's jurisdiction, the better.
Where judges hide bugs
A judge scores the final answer, so it can pass an agent that reached the right output through a wasteful or wrong trajectory, like retrieving the same document three times. If the judge sees only the answer, trajectory regressions slip through. Show the judge the trace, or pair it with the deterministic trajectory checks from the previous section.
Calibrating a judge against human labels
Judges drift: a prompt tweak or model upgrade silently changes scoring behavior. Before trusting one, label 30-50 outputs yourself, measure agreement, and re-run that calibration when the judge prompt or model changes. Anthropic's docs on building evals recommend exactly this kind of human-labeled reference set for grading evals.
How do you build a regression eval suite for a multi-step agent?
Seed cases from real traces
Start from production tracing data, not imagination. Export the last few weeks of traces and pull out every run that failed or cost more than expected: wrong tool picked, retrieval missed the answer, agent looped, plan abandoned halfway. Each failure becomes a test case with its input, expected trajectory, and the failure type it represents. Aim for 30-50 cases before you worry about scale; a small suite of real failures beats a large suite of synthetic questions.
Tiering: smoke, full, nightly
Split the suite into three tiers so speed and coverage stop competing. A smoke tier of 10-15 cases runs on every pull request in under two minutes and catches obvious breakages. The full tier runs before merge and covers every failure type you have seen. A nightly tier runs the expensive, slow checks — long-horizon trajectories, LLM-as-judge scoring across many steps — and flags drift without blocking anyone's day.
Thresholds and blocking rules
A regression suite only works if it can say no. Set per-metric thresholds rather than one average score: tool-selection accuracy, retrieval hit rate, and cost per run each get their own floor, because a suite that averages them hides exactly the failures you care about. A pull request that drops any metric below its floor fails the build, full stop. For flaky metrics like judge scores, require two consecutive nightly failures before paging anyone, but never apply that leniency to deterministic checks in CI. Write the thresholds down in a file next to the tests so the team argues about the numbers, not about whether to run them.
How do you run agent evals in CI before deploying to production?
Capture a trace for every step the agent takes (planning, tool calls, state updates) and store it as the unit your eval job inspects. Instrument your code against a standard schema so traces are consistent across runs; the OpenTelemetry GenAI semantic conventions define attributes for model calls, tokens, and tool invocations.
On each PR, run the regression suite against the changed prompts or retrieval code and fail the build when tool-selection accuracy or trajectory checks regress. Gate merge on the eval result, not on a human eyeballing one sample run.
Keeping the eval bill sane
Run the full suite only on PRs that touch prompts, tools, or orchestration; use a smoke subset otherwise. Cache judge verdicts by input hash, and cap per-run token spend with a hard budget that fails the job when exceeded.
Handling nondeterminism
Run each case three to five times and report pass rate, not a single verdict. When a case flips between runs, quarantine it with an owner and a review date instead of deleting it.
What does a minimum viable eval stack look like for a small team?
Build three things first: a golden set of 30-50 real trajectories from production, deterministic checks on tool selection and final output, and one LLM-as-judge pass on planning quality. Run all three in CI on every prompt or orchestration change. That is enough to catch most regressions before they hit real users.
Defer everything else. Trajectory visualization, per-node cost dashboards, and multi-model judge ensembles matter later, not at week one.
Where a fractional AI-architecture hire fits: designing the failure-type-to-eval mapping for your specific agent, then auditing the suite once real traffic reveals what it missed. For a 2-20 person team, that is usually days of senior work, not a full-time hire.
FAQ
How many test cases do I need before agent evals are worth anything?
Thirty to fifty, as long as they come from real production traces rather than synthetic questions. Export recent runs that failed or cost more than expected, then turn each one into a test case with its input, expected trajectory, and failure type. A small suite of actual failures beats a large suite of imagined ones.
Can I run agent evals without human labeling?
Yes, mostly. Deterministic checks on tool selection, arguments, and output schemas need no labels, and that covers most failure types. Human labeling only becomes necessary when you add an LLM-as-judge: label 30-50 outputs yourself, measure the judge's agreement, and re-calibrate whenever you change the judge prompt or model.
Do agent evals work for agents that call external APIs with side effects?
Yes, but record side-effecting calls rather than executing them in CI. Point tool calls at a sandbox or mock that logs what would have been invoked, then run your deterministic checks against that log: right tool, right arguments, correct order. State-tracking failures like double charges show up as duplicate calls in the trace.
How often should I re-run the full eval suite versus the smoke tier?
The smoke tier of 10-15 cases runs on every pull request and finishes in under two minutes. The full tier runs before merge on PRs that touch prompts, tools, or orchestration. The nightly tier handles expensive checks like long-horizon trajectories and judge scoring, flagging drift without blocking anyone.
What is the cheapest way to catch a broken agent before users do?
A golden set of 30-50 real trajectories plus deterministic checks on tool selection and final output, wired into CI to fail the build on regression. Add one judge pass on planning quality, cache verdicts by input hash, and cap per-run token spend. That stack catches most regressions for pennies per PR.