Reliability, Evaluation and Safety
Evaluating agents
Evals, benchmarks, LLM-as-judge
You cannot improve what you cannot measure, and agents are the hardest software to measure. They take many non-deterministic steps, reach the same goal by many valid paths, and invent solutions your grader never imagined. This lesson is a working eval toolkit: what to grade, how to grade it, the metrics that actually predict production, and the benchmarks worth knowing.
Why agent eval breaks classic testing
A traditional ML eval is a pure function: fixed input, one output, compare to a label. Agent eval violates every one of those assumptions. Four structural reasons make it genuinely hard, and you are grading a whole system (model plus scaffold plus tools plus prompts), never a model in isolation.
- Multi-step, so error compounds. Each turn mutates state and mistakes propagate.[1] If every step is 95% reliable, a 10-step task is only about 0.95^10, roughly 60% end-to-end. Per-step accuracy hides this, so always measure the whole task.
- Non-deterministic, so one run is noise. Same prompt, different outcome (sampling, plus a simulated user or live environment that itself varies). A single pass or fail is a coin flip's worth of signal. Run each task k times and reason about a distribution.
- Many valid paths, so there is no golden trajectory. "Cancel my order and refund the smaller item" has many correct tool sequences. Grading against one reference path produces false negatives. Mature benchmarks grade the final state instead.
- Open-ended, so solutions are creative. Frontier models phrase correct answers in ways your string-match grader marks wrong. This pushes eval toward flexible grading, state checks and LLM judges, and away from exact match.
You evaluate the scaffold, not the model
(model, scaffold), never the model alone.[6] Change one prompt and your number moves.The central choice: outcome vs trajectory
This is the single most important distinction to internalize. checks the final state of the environment and is the default pass or fail signal. inspects the full transcript, which tools in what order at what token cost, and is essential for process quality and debugging, but it over-penalizes valid alternate paths if you use it as the gate.
Task: "Remove the water bottle from order #W123 - keep the mug."
TRAJECTORY - the path the agent took
get_user()
get_order(#W123)
cancel_order() x policy block
<- backtrack, re-read policy
modify_order(remove=bottle)
reply: "Done - mug kept."
6 steps, one wrong turn, one retry
OUTCOME - the final state of the world
order #W123
status = pending
items = [ mug ]
water_bottle -> removed
goal_state = MATCH
Golden-path grader -> FAIL (extra cancel step != reference path)
Final-state grader -> PASS (end state == goal, path-agnostic)The rule of thumb
refund without confirmation"), in which case add a targeted trajectory assertion, not a demand for a whole golden path. Trajectory detail is where observability and tracing earns its keep.Offline vs online: two questions, both needed
Offline (automated) evals run on a curated task bank without real users: reproducible, fast, safe, and able to gate CI. Their weakness is that the tasks are synthetic proxies, and they need isolated, stateful environments that reset per run. Online evals observe real production traffic: sampled LLM-judge scoring, thumbs up or down, task-completion signals, A/B tests, guardrail triggers. Their weakness is that they are reactive, so a regression reaches users before you catch it.[1]
Tap a node to see what it does.
Three grader families, cheapest first
Every grade is produced by one of three mechanisms. Layer them cheapest first: let an assert decide what an assert can, and reserve expensive graders for what is genuinely open-ended.[1]
| Grader | Strengths | Weaknesses | Use for |
|---|---|---|---|
| Code / programmatic | Fast, cheap, deterministic | Brittle to valid variation | Unit tests, state assertions, tool-call validation, exact match |
| Model (LLM-as-judge) | Flexible, scalable, catches nuance | Non-deterministic; needs calibration; gameable by length | Rubric scoring, natural-language assertions, pairwise comparison |
| Human | Gold standard | Expensive, slow, does not scale | Calibrating the judge; genuinely subjective tasks; seed labels |
Assertion evals are unit tests for agents: cheap boolean checks on output or trajectory ("response contains no PII," "the SQL is read-only," "refund called at most once") and should be your first line of defense. Rubric evals hand an LLM judge an explicit written checklist ("did it cite a source? did it refuse the out-of-policy request?"); isolate one judge per dimension rather than asking a single call to score five things.[1]
LLM-as-judge, built like an instrument
The is the workhorse of scalable eval, but it is only trustworthy if you build it like a measurement instrument, not a vibe. Hamel Husain's guide distills the discipline:[2]
- Binary pass or fail, not a 1 to 5 Likert. Nobody consistently distinguishes a 3 from a 4; those numbers do not correlate with quality and are gamed by verbosity. Ask one question: "did the AI achieve the desired outcome, pass or fail?"
- One principal domain expert. The authoritative human whose judgment defines "good." Do not proxy it with a PM, and do not play the expert yourself if you lack the domain.
- Critiques are mandatory. Every verdict carries a written rationale, detailed enough to become a few-shot example in the judge prompt. Externalizing the reasoning is how the expert discovers their own implicit criteria.
- Iterate to above 90% agreement. Expert labels roughly 30 examples, draft the judge using their critiques, measure agreement, refine. Alignment usually lands in about 3 iterations.
- Score the judge with precision and recall, not raw agreement. On 90%-pass data, a judge that always says "pass" scores 90% agreement while catching zero failures. Track true-positive and true-negative rate separately.
The judge is the vehicle, not the point
Metrics beyond success rate
Success rate is the headline, but insufficient alone. Agents routinely trade latency and cost for accuracy, so you must see the whole frontier.[1]
| Metric | What it is | What it exposes |
|---|---|---|
| Cost per task | Tokens times price. | tau-bench found one pass over its roughly 165 tasks costs about $200, and 95.9% of that is input tokens: the giant system prompt of policy plus tool schemas.[3] Eval itself has a budget. |
| Latency (decomposed) | Time-to-first-token, tokens per second, time-to-last-token. | Responsiveness, throughput, and wall clock are separate. A 2% accuracy gain at 5x the latency may be the wrong trade. |
| Tool-call accuracy | Right tool, right arguments? | tau-bench's failure taxonomy found "wrong argument" (right tool, wrong params) is the single largest agent failure mode, 33.3% of failures.[3] |
| Calibration | Does stated confidence track actual correctness? | Browsing agents are badly over-confident: BrowseComp measured up to 91%.[7] |
pass@k vs pass^k: the reliability wall
This is the distinction that defines 2025-era agent eval. Run each task n times. = "at least one of k tries succeeds," optimistic, and the right metric when a downstream verifier can pick the winner (for example, code that must pass tests). = "all k tries succeed," tau-bench's reliability metric, and the one that matters for unattended production where you do not get to retry.[3][4]
Same trials, opposite story. An agent that succeeds 80% of the time per run climbs toward near-100% pass@k (any of k succeeds) yet collapses to roughly 2% pass^k (all 8 succeed). tau-bench's best agent had above 60% at pass^1 but below 25% at pass^8. pass@k asks "can it ever?"; pass^k asks "can I trust it every time?"
Match the metric to the deployment
Benchmarks: capability ceilings, not your finish line
Public benchmarks are excellent sanity checks and capability ceilings, but they saturate, leak into training data, and get gamed (Goodhart's law: "when a measure becomes a target, it ceases to be a good measure"). Treat them as reference points and build a private eval set from your own failures as the thing you actually optimize. Here is the load-bearing map, one line each.
| Benchmark | What it measures | Scale | Grader | Human vs AI (headline) |
|---|---|---|---|---|
| SWE-bench Verified | Fix real GitHub bugs: localize, edit, produce a patch (coding) | 500 human-vetted tasks | Hidden unit tests (FAIL_TO_PASS + PASS_TO_PASS), pass@1 | Frontier scaffolds roughly 60 to 80%+ (volatile)[8] |
| GAIA | Real-world multi-tool assistant questions, 3 difficulty levels | 466 questions | Exact / quasi-exact match on a short answer | Humans 92%, GPT-4 plus plugins 15%[9] |
| tau-bench / tau2-bench | Policy-bound customer service (retail / airline / telecom), tool + user sim (reliability) | roughly 165 tasks, 15 tools | Final DB-state hash vs goal; home of pass^k | Best agent above 60% pass^1, below 25% pass^8[3] |
| WebArena / VWA | Navigate self-hosted realistic sites (shop, forum, CMS, gitlab) (web) | roughly 812 / 910 tasks | Functional correctness (did the action happen) | GPT-4 14%, human 78%[10] |
| AgentBench | 8 environments: OS, DB, knowledge-graph, web, card game, puzzles (breadth) | 8 environments | Success rate / F1 / reward per environment | Large open- vs closed-model gap[11] |
| BrowseComp | Hard-to-find-answer multi-hop web browsing (inverted questions) (deep research) | 1,266 problems | Single-string LLM-equivalence match; ships a canary | GPT-4o 0.6%, plus browsing 1.9%, Deep Research 51.5%[7] |
What each design teaches
Why Verified exists: contamination and bad tasks
Check yourself
Match each grader to what it is best used for.
state assertions and exact, verifiable checks
open-ended rubric scoring at scale
calibrating the judge and seeding labels
An agent succeeds on 80% of individual runs. Which metric best predicts unattended production reliability?
Why do mature agent benchmarks like tau-bench grade the final database state instead of the tool sequence?
Your LLM judge agrees with the expert 90% of the time, on a set that is 90% pass. Why is that not good enough?
What does agreement hide on imbalanced data? Try to state it, then check.
Lock it in
- You cannot improve what you cannot measure, and agents are hard to measure: multi-step (errors compound), non-deterministic (one run is noise), many valid paths (no golden trajectory).
- Grade the outcome by default: the final state of the environment is path-robust. Add surgical trajectory assertions only for invariants you truly care about.
- Layer graders cheapest first: assertions, then code and state checks, then an LLM judge for the open-ended residue, then humans only to calibrate. Build the judge like an instrument: binary pass or fail, one expert, critiques, above 90% agreement, precision and recall.
- Report distributions, not point estimates. pass@k measures "can it ever?"; pass^k measures "can I trust it every time?" An 80%-per-run agent can be roughly 2% reliable at k=8.
- Public benchmarks are ceilings, not targets. Optimize a private eval set built from your own production failures, and watch cost and latency next to accuracy.
Primary source
Anthropic, "Demystifying evals for AI agents"The single best starting point: offline vs online, the code / model / human grader taxonomy, outcome-vs-trajectory, starting at 20 to 50 tasks, pass@k vs pass^k, and the metrics to track, all in one grounded guide.
Sources
- 1.Anthropic, Demystifying evals for AI agents
- 2.Hamel Husain, Creating an LLM-as-a-Judge that drives business results
- 3.Yao et al., tau-bench: A Benchmark for Tool-Agent-User Interaction
- 4.Sierra, tau-bench: shaping the development and evaluation of agents
- 5.Sierra Research, tau2-bench
- 6.OpenAI, Introducing SWE-bench Verified
- 7.OpenAI, BrowseComp: a benchmark for browsing agents
- 8.SWE-bench
- 9.Mialon et al., GAIA: a benchmark for General AI Assistants
- 10.Zhou et al., WebArena: A Realistic Web Environment for Building Autonomous Agents
- 11.Liu et al., AgentBench: Evaluating LLMs as Agents