Slides · Context, memory and multi-agent systems
Agent evaluation: state, trajectory, pass^k and release gates
1 / 20
Agent evaluation: state, trajectory, pass^k and release gates
How to tell whether an agent really did the job, whether it does it every time, and when it is allowed to ship.
Concept
“DONE” in a log is not a refund in a bank
- Vihaan wrote DONE and moved on. The customer wrote back: still no refund. The log was honest and complete about what he did, and silent about whether the money arrived.
- An agent you cannot evaluate is one you cannot safely change: you will not know whether the last prompt edit helped or hurt.
- Anthropic’s evals guidance separates the transcript (the full record of a run) from the outcome (the final state of the environment).
Three things you will be able to do:
- Grade a run on its final state and its trajectory, not on the agent’s claim of success.
- Compare pass@k with passk and compute both for a task with success probability p.
- Plan a release gate: task set, graders, run budgets, tracing, a kill switch and approval for irreversible actions.
Diagram
Evaluation is a driving test, not an interview
You do not ask the driver whether they drove well. You watch the route (trajectory), check where the car ended up (state), and repeat the test on different days (reliability).
Concept
Grade the state of the world, not the agent’s message
- An agent can say “done” and be wrong. Check what changed: the database row, the file, the passing test.
- tau-bench works this way: it compares the database at the end of a simulated conversation with the annotated goal state (Yao et al., 2024).
- Anthropic’s evals post gives the same example: a booking agent may claim a flight is booked, but the outcome is whether the reservation exists.
- For agents that change persistent state, Anthropic’s research team judged the end state rather than every turn, and split long workflows into checkpoints.
Why: a state check is hard to talk your way past. A self-report is the output you are trying to test.
Sources[2] τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains[1] Demystifying evals for AI agents[3] How we built our multi-agent research system
Compare
Trajectory: how it got there
Two runs can end in the same state and still differ a lot in cost and risk. Use the transcript to grade the route.
Illustrative runs of one “close a billing ticket” task:
| Aspect | Run A | Run B |
|---|---|---|
| Final state | Ticket closed, credit applied correctly | Ticket closed, credit applied correctly |
| Outcome grade | Pass | Pass |
| Tool calls | 5 | 6 |
| Disallowed actions on the way | 0 | 1: opened another customer’s account to compare a similar case |
| Trajectory grade | Good | Fail: out of scope, despite the correct end state |
- State-only grading scores both runs as passes and cannot tell which one is safe to scale. The cost and loop signals matter too, but here the problem is a safety one.
- Also grade safety: attempts at disallowed actions, resisting injected instructions, staying in scope.
Worked example
Worked example: a tally beats a pass rate
Label each failed run with one category. Illustrative tally over 25 failed runs:
| Failure category | Runs | Share of 25 | Look at first |
|---|---|---|---|
| Bad arguments | 9 | 36% | Tool descriptions and schemas |
| Wrong tool | 6 | 24% | Tool names that overlap |
| Stopped too early | 4 | 16% | Definition of done |
| Looped | 3 | 12% | Loop detection, step limit |
| Claimed success falsely | 3 | 12% | State-based grading |
- 9+6+4+3+3=25, and 9/25=0.36.
- Suppose 25 of 48 runs failed: the pass rate says 23 of 48 pass (48%) and stops there. The tally says where to spend the next day.
- Tool-argument errors are the largest bucket here, so fix tool descriptions before touching the main prompt.
Check yourself
Check: grading a coding agent
A coding agent finishes with “All tests now pass.” How would you grade the outcome, and what would you add from the trajectory?
Answer
Outcome: run the test suite yourself in a clean sandbox against the agent’s final code, rather than trusting the message. Also check that the tests were not deleted or weakened. Trajectory: count tool calls and cost, look for repeated failing commands, and check that edits stayed inside the allowed files. A pass with 60 edits and the same failing command run eight times is a poor trajectory.
Math
pass@k and pass^k
Run each task several times, because one run hides variance.
- pass@k: solved if at least one of k attempts succeeds. The Codex paper uses it for code generation (after Kulal et al., 2019): k samples are drawn and the problem counts as solved if any passes the tests. Chen et al. contributed the unbiased estimator.
- passk: reliable only if all k attempts succeed. The tau-bench authors proposed it to measure reliability over repeated trials.
For a task that succeeds with probability p on independent runs:
pass@k=1−(1−p)kpassk=pk| Symbol | Meaning |
|---|---|
| p | Probability that one run of this task succeeds |
| k | Number of attempts |
| 1−p | Probability that one run fails |
| (1−p)k | Probability that all k runs fail |
Sources[4] Evaluating Large Language Models Trained on Code[2] τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains[1] Demystifying evals for AI agents
Worked example
Worked example: opposite directions
Illustrative task with p=0.6 per independent run.
| k | pass@k=1−0.4k | passk=0.6k |
|---|---|---|
| 1 | 0.600 | 0.600 |
| 2 | 0.840 | 0.360 |
| 3 | 0.936 | 0.216 |
| 4 | 0.974 | 0.130 |
- At k=4: 0.44=0.0256, so pass@4=0.9744. And 0.64=0.1296.
- As k grows, pass@k rises toward 1 (one success is enough) and passk falls toward 0 (one failure ruins it).
- The same agent looks 97% reliable or 13% reliable depending on which number you quote.
Compare
Which one is honest for your product?
| Product | A human or CI picks the best attempt? | Report |
|---|---|---|
| Code assistant shows the user 3 drafts to choose from | Yes | pass@k |
| Agent cancels a subscription on request | No: it acts once | passk |
| Customer-facing assistant used many times by one person | No | passk |
- Anthropic’s evals post: pass@k rises as k grows and suits tools where one success is enough. passk falls as k grows and suits customer-facing agents that must be consistent.
- Its example: a 75% per-trial success rate over three trials gives roughly 42% for pass3 (0.753=0.4219).
- In the tau-bench paper, even strong function-calling agents such as gpt-4o (a 2024 model) succeeded on fewer than half the tasks, and pass8 was below 25% in the retail domain. Those are 2024 results, so check how current models do before quoting them.
Sources[1] Demystifying evals for AI agents[2] τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains
Worked example
From samples to an estimate
You rarely know p. You measure it from a limited number of runs, and that adds noise.
The Codex paper generates n samples per task, counts c correct, and estimates pass@k with an unbiased formula:
pass@k=1−(kn)(kn−c)Illustrative: n=10 runs, c=3 correct, k=2.
- (27)=21 and (210)=45, so pass@2=1−21/45=0.533.
- The shortcut 1−(1−0.3)2=0.51 plugs in the measured rate 0.3. The paper says estimating pass@k that way is biased.
- Practical lesson: with few runs the numbers wobble. Report n and k, not just the rate.
Check yourself
Check: a month of use
An agent succeeds on a task 95% of the time per independent run. A customer relies on it 10 times in a month. What is the chance all 10 go well, and what does pass@10 say?
Answer
pass10=0.9510≈0.60. So roughly four customers in ten see at least one failure. pass@10=1−0.0510 is effectively 1, but it answers a different question (“did any run work?”), which does not describe this customer’s experience. For an agent used repeatedly, the honest number is pass^k.
Compare
Graders: code first, then a judge, then humans
| Grader | Good at | Weak at |
|---|---|---|
| Code-based (state checks, tests, schema, tool-call checks) | Fast, cheap, reproducible | Brittle, limited for nuanced tasks |
| Model-based (rubric scoring, pairwise) | Open-ended output | Non-deterministic, needs calibration against humans |
| Human (expert review) | Gold-standard quality | Expensive and slow, so used mainly on a sample |
- Anthropic’s research team found one LLM-judge prompt that output a 0.0 to 1.0 score and a pass-fail grade the most consistent against human judgment in their setting. Test that on your own task.
- Human testers still found edge cases automation missed, such as agents preferring low-quality sources.
- Use humans on a sample to check the judge, then fix the rubric.
Sources[1] Demystifying evals for AI agents[3] How we built our multi-agent research system
Diagram
Layered grading
Concept
Environments, budgets and controls
- Sandboxes. Anthropic recommends extensive testing in sandboxed environments, because agents cost more and can compound errors. Make them resettable and as deterministic as possible. Use mock tools for fast tests and a full sandbox for end-to-end runs.
- Run budgets. Cap steps, tokens, time and money per run, so a bad run stops early.
- Traces. Record prompt version, tool and arguments, result, tokens, latency and cost per step, so a failure can be replayed.
- Kill switch. One control that stops the agent in production.
- Approval for irreversible actions. A human confirms before money moves or data is deleted.
Each control caps a different way of failing: budgets cap cost, approval caps harm, traces make fixes possible.
Process
Planning a release gate
- List the task set: typical, impossible and adversarial tasks, each with a state-based grader.
- Choose k and run every task k times in the sandbox.
- Write thresholds before you look at results: minimum passk on core tasks, a safety limit, a cost ceiling.
- Run, grade with code, then the judge, then a human sample.
- Compare against the thresholds. Ship, fix or stop. Do not edit the numbers to fit the result.
The thresholds are your product’s choice, not a standard.
Worked example
Worked example: reading a gate
Illustrative booking agent: 20 tasks, k = 5 runs each, so 100 runs. Thresholds were written in advance.
| Measure | Threshold | Result | Pass? |
|---|---|---|---|
| Core tasks (12) with all 5 runs correct | At least 10 of 12 | 11 of 12 (91.7%) | Yes |
| Safety violations across 100 runs | 0 | 1 | No |
| Mean cost per task | At most 0.05 | 0.04 | Yes |
- Decision: do not ship. A single safety violation fails the gate even though the success numbers pass.
- Raising the limit to “at most 1” after seeing the result would make the gate meaningless. Fix the violation instead.
- The next step is to read the trace of the violating run, label it in the failure taxonomy, fix it, and re-run the whole set.
Check yourself
Check: spot the weak gate
A team runs each task once, sees 78% success, and then decides “ship if at least 75%”. The agent sends real refunds with no approval step. List what is missing from this release plan.
Answer
The threshold was set after the result. Each task ran once, so there is no reliability measure such as passk. There is no safety or cost threshold, no trajectory metrics, and no state-based grader mentioned. For irreversible refunds it also needs an approval step, run budgets, tracing and a kill switch.
Summary
Recap
- Grade the final state and the trajectory, not the agent’s claim.
- pass@k means any of k succeed; passk means all k succeed. Quote passk for agents that act once for a user.
- Layer graders: code, then a rubric judge, then humans on a sample.
- A release gate needs a task set, thresholds fixed in advance, budgets, traces, a kill switch and approval for irreversible actions.
References
References & Sources
Demystifying evals for AI agents (opens in a new tab)
Mikaela Grace, Jeremy Hadfield, Rodrigo Olivares, Jiri De Jonghe2026Article
https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents
Used for Transcript versus outcome, the three grader types, and pass@k versus pass^k with the 75% per-trial example.
τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains (opens in a new tab)
Shunyu Yao, Noah Shinn, Pedram Razavi, Karthik Narasimhan2024Preprint
arXiv 2406.12045 (opens in a new tab)https://arxiv.org/abs/2406.12045
Used for Grading by comparing the final database state with an annotated goal state; the pass^k reliability metric; gpt-4o succeeding on fewer than half the tasks and pass^8 below 25% in retail.
How we built our multi-agent research system (opens in a new tab)
Jeremy Hadfield, Barry Zhang, Kenneth Lien, Florian Scholz, et al.2025Article
https://www.anthropic.com/engineering/multi-agent-research-system
Used for End-state evaluation for stateful agents, a single LLM-judge prompt with a 0.0 to 1.0 score and pass-fail grade, and human testers finding edge cases.
Evaluating Large Language Models Trained on Code (opens in a new tab)
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, et al.2021Preprint
arXiv 2107.03374 (opens in a new tab)https://arxiv.org/abs/2107.03374
Used for How pass@k is defined for code generation, and the unbiased estimator 1 - C(n-c, k)/C(n, k), with the note that plugging in the measured rate is biased.
Building effective agents (opens in a new tab)
Erik S., Barry Zhang2024Article
https://www.anthropic.com/engineering/building-effective-agents
Used for The recommendation to test agents extensively in sandboxed environments because they cost more and can compound errors.
Keys: ← → move, Home End first and last, F full screen.