Evaluating agents
Trajectories, graders, pass@k vs pass^k, compounding error, benchmarks and harnesses
You cannot improve what you cannot measure, and agents are the hardest systems in this path to measure: they take many stochastic steps, change the environment, and can succeed by different routes. Teams that win build evaluation harnesses before they build features. This lesson gives you the vocabulary, the two success metrics everyone confuses (pass@k and pass^k), the compounding-error math that explains why agents feel unreliable, the benchmark landscape, and a recipe for your own harness — which you will build in 10.12 Project: build a research agent with tools, an MCP server and an eval harness.
You'll be able to
- Define task, trial, grader, trajectory and outcome, and choose among code-based, model-based and human graders
- Compute pass@k and pass^k from trial data and explain what each measures
- Derive end-to-end success from per-step success (pⁿ) and compute the per-step accuracy a reliability target requires
- Read agent benchmarks critically (saturation, contamination, infrastructure noise, eval awareness) and build a task-based harness
Key ideas
- Agent evals grade trajectories and end states under nondeterminism; vocabulary: task, trial, trajectory, outcome, grader (code-based, model-based, human).
- pass@k = 1 − (1 − p)^k measures achievable success with a verifier; pass^k = p^k measures consistency without one; report both.
- End-to-end success ≈ pⁿ; a 20-step task needs ~99.5% per-step accuracy for 90% success — fix it structurally (fewer steps, verification + retry, checkpoints).
Show 3 more key ideas
- Verification with r retries lifts per-step success to 1 − (1 − p)^(r+1); this is the mechanism behind coding agents' reliability.
- Benchmarks (SWE-bench Verified, τ-bench, GAIA, WebArena, OSWorld, BrowseComp, AgentBench) each measure something narrow; watch saturation, contamination, infrastructure noise and eval awareness.
- Build your own harness: 20–50 real tasks, end-state graders, k trials, cost per success, stored trajectories, capability vs regression suites, grader audits.
Suggested path through this lesson
Why agent evaluation is hard
A chatbot answer can be graded in isolation. An agent run is a trajectory: dozens of model calls and tool results, each depending on the last, in an environment that the agent itself changes. Two runs of the same task differ; a run can reach the right end state by a wrong path or the wrong end state by a reasonable one; grading requires inspecting the world (files, databases, web pages) rather than a string; and each trial costs many calls, so you cannot afford thousands of them. On top of that, frontier models sometimes recognize that they are being evaluated — Anthropic documented this "eval awareness" in 2026 — and environments are flaky enough that a measurable share of failures is infrastructure noise, not model error.
Vocabulary
Anthropic's Demystifying evals for AI agents (January 2026) fixes the terms most teams now use:
- Task — a prompt plus an environment plus success criteria. Trial — one attempt at a task. Transcript/trajectory — everything that happened in the trial. Outcome — the final state of the environment, which is usually what you grade.
- Graders: code-based (deterministic checks: tests pass, a row exists, a file matches, a regex holds — cheap, reliable, limited to what you can specify), model-based (an LLM scores against a rubric — flexible, needs calibration against humans, 9.8 Evaluating and observing LLM apps), and human (gold standard, expensive, used to calibrate the other two).
- Capability evals ask "can it do this at all?" and should be hard; regression evals ask "did we break anything?" and should be stable and near-saturated.
Grade end states, not paths, unless the path is the point: a grader that insists on one particular sequence of tool calls punishes valid alternatives and over-specifies behavior. Give partial credit through separate checks rather than one brittle pass/fail where possible.
pass@k versus pass^k
Both start from the probability that one trial succeeds.
pass@k is the probability that at least one of trials succeeds: . It measures what you can achieve if you can recognize success — with a verifier you can run attempts and keep the winner (10.3 Reasoning and planning for agents). From samples of which are correct, the unbiased estimator (Chen et al., 2021) is
pass^k (introduced with τ-bench) is the probability that all trials succeed: . It measures consistency — what a user experiences when they rely on the agent times without a verifier.
Math check. With and : pass@3 , while pass^3 . Same agent, 97% or 34%, depending on whether someone can tell success from failure. Report both, and say which you mean.
Compounding error
If a task needs steps and each succeeds independently with probability , the end-to-end success is
| per step | ||||
|---|---|---|---|---|
| 0.90 | 0.59 | 0.35 | 0.12 | 0.005 |
| 0.95 | 0.77 | 0.60 | 0.36 | 0.08 |
| 0.99 | 0.95 | 0.90 | 0.82 | 0.61 |
To finish a 20-step task 90% of the time you need per step — an accuracy no prompt tweak delivers. The levers are structural:
- Fewer steps — better tools that do more per call (10.2 Tool use and function calling), code execution, good decomposition.
- Verification with retry. If a verifier catches a failed step and you allow retries, the effective per-step success becomes (assuming a reliable verifier). With and : , and . This is why coding agents work (10.8 Coding agents and computer use).
- Checkpoints and human gates that bound how far an error propagates (10.11 Building production agents).
- Shorter horizons — split long tasks into independently verifiable chunks.
Steps are not truly independent (a confused agent stays confused), so is a model, not a law — but it is the right mental model, and the interactive demo lets you feel it.
The benchmark landscape
| benchmark | domain | what is measured | notes |
|---|---|---|---|
| SWE-bench Verified | software engineering | issue resolved, judged by repository tests (500 tasks) | the headline coding number; nearing saturation by 2026 |
| τ-bench / τ²-bench | customer service with tools and policies | end-state correctness across trials, pass^k | user simulator; exposes inconsistency |
| GAIA | general assistant (web, files, reasoning) | exact-match answers, 466 questions in 3 levels | humans ~92% vs ~15% for GPT-4 with plugins at release |
| WebArena | web tasks on self-hosted sites | functional correctness (812 tasks) | realistic, reproducible environments |
| OSWorld | real desktop computer use | execution-based checks (369 tasks) | screenshots, many apps; still far from human |
| BrowseComp | hard web research | hard-to-find facts, easy to verify | 2025; measures persistence and search skill |
| AgentBench | 8 environments (OS, DB, games, web…) | success per environment | breadth; early 2023 baseline |
Read every score with four questions. Saturation: once the frontier is near the ceiling, gains are noise. Contamination: have the tasks leaked into training data? Infrastructure noise: Anthropic's 2026 analysis of agentic coding evals showed that flaky environments and timeouts can account for a meaningful fraction of "failures", so compare systems under identical infrastructure and repeated trials. Eval awareness: a model that behaves differently when it suspects a test tells you little about deployment. And remember the statistics of 1.8 Statistics essentials: with 100 tasks, a 3-point difference is usually within the confidence interval.
Building your own harness
- Collect 20–50 tasks from real failures and real requests. Start small and early — Anthropic's research-system team evaluated from about 20 queries onward (10.6 Multi-agent systems). Grow to hundreds as the system matures.
- Write success criteria as checks on the end state (and on hard constraints: "did not send email", "cost under budget"). Prefer code-based graders; add model-based rubrics for quality, calibrated against a human-labeled subset (9.8 Evaluating and observing LLM apps).
- Run trials per task (3–5) and report pass@k, pass^k and mean success; track cost per successful task, steps, latency and tool-error rates.
- Store full trajectories and build a viewer; most insights come from reading failures and classifying them (the MAST categories from 10.6 Multi-agent systems work for single agents too).
- Separate capability and regression suites; run regressions in CI on every prompt, tool or model change.
- Audit the graders periodically: a grader that passes everything or fails valid solutions silently corrupts every decision downstream.
Where this shows up later
- The harness becomes a production regression suite with tracing in 10.11 Building production agents; red-team tasks for injection join it in 10.10 Agent safety and security.
- Your capstone in 10.12 Project: build a research agent with tools, an MCP server and an eval harness ships with a 20-task eval and cost tracking.
- Benchmark literacy returns in system-design interviews (11.4 ML and LLM system design and interviews).
Common pitfalls (4)
- Reporting pass@k from a search-with-verifier setup as if it were the reliability a user will experience.
- Grading the path (exact tool sequence) instead of the end state, penalizing valid alternative solutions.
- Comparing systems across different infrastructure or single runs; agent variance and environment flakiness swamp small differences.
- Trusting an LLM grader you never calibrated against human labels.
Recap: all 6 key points
- Agent evals grade trajectories and end states under nondeterminism; vocabulary: task, trial, trajectory, outcome, grader (code-based, model-based, human).
- pass@k = 1 − (1 − p)^k measures achievable success with a verifier; pass^k = p^k measures consistency without one; report both.
- End-to-end success ≈ pⁿ; a 20-step task needs ~99.5% per-step accuracy for 90% success — fix it structurally (fewer steps, verification + retry, checkpoints).
- Verification with r retries lifts per-step success to 1 − (1 − p)^(r+1); this is the mechanism behind coding agents' reliability.
- Benchmarks (SWE-bench Verified, τ-bench, GAIA, WebArena, OSWorld, BrowseComp, AgentBench) each measure something narrow; watch saturation, contamination, infrastructure noise and eval awareness.
- Build your own harness: 20–50 real tasks, end-state graders, k trials, cost per success, stored trajectories, capability vs regression suites, grader audits.
Watch
Talks accompanying the January 2026 guide: graders, trials, pass@k vs pass^k.
Read
Try it live
Interactive demo
runs in your browserExercises
- Compute pass@k and pass^k from real trials
Run your 10.2 agent on 10 tasks × 5 trials. For each task estimate , then compute pass@3 with the unbiased estimator and pass^3. Expected: tasks with show pass@3 above 0.9 but pass^3 near 0.2 — write one sentence on which number a user cares about.
- Compounding-error calculator
Implement and the retry formula . For a 25-step task, find the retry budget needed to reach 95% end-to-end success when and the verifier is perfect; then redo it assuming the verifier misses 10% of failures. Expected: suffices with a perfect verifier; an imperfect verifier caps achievable reliability.
- Build a 20-task harness
For a small agent (e.g. a file-organizing or research agent), write 20 tasks with end-state checks in code, run 3 trials each, store trajectories as JSON, and produce a report with success, pass^3, mean steps, tool-error rate and cost per success. Expected: at least three failure categories emerge from reading the trajectories; fix the top one and re-run.
Quiz
Flashcards
These cards are now in your spaced-repetition queue. Review all due cards →