Slides · Context, memory and multi-agent systems

Agent evaluation: state, trajectory, pass^k and release gates

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:

  1. Grade a run on its final state and its trajectory, not on the agent’s claim of success.
  2. Compare pass@k\mathrm{pass}@k with passk\mathrm{pass}^k and compute both for a task with success probability p.
  3. Plan a release gate: task set, graders, run budgets, tracing, a kill switch and approval for irreversible actions.

Source1 Demystifying evals for AI agents

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).

Diagram: Each task runs k times in a sandbox.

Task set

Run each task k times
in a sandbox

Outcome check
by final state

Trajectory metrics:
tools, steps, cost

pass@k and pass^k

Release gate

Diagram summary: Each task runs k times in a sandbox. Every run is checked by its final state, and those results become pass@k\mathrm{pass}@k and passk\mathrm{pass}^k. Trajectory metrics (tools, steps, cost) go to the release gate along with them, and the gate decides whether the agent ships.

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.

Sources2 τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains1 Demystifying evals for AI agents3 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:

AspectRun ARun B
Final stateTicket closed, credit applied correctlyTicket closed, credit applied correctly
Outcome gradePassPass
Tool calls56
Disallowed actions on the way01: opened another customer’s account to compare a similar case
Trajectory gradeGoodFail: 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.

Source1 Demystifying evals for AI agents

Worked example

Worked example: a tally beats a pass rate

Label each failed run with one category. Illustrative tally over 25 failed runs:

Failure categoryRunsShare of 25Look at first
Bad arguments936%Tool descriptions and schemas
Wrong tool624%Tool names that overlap
Stopped too early416%Definition of done
Looped312%Loop detection, step limit
Claimed success falsely312%State-based grading
  • 9+6+4+3+3=259 + 6 + 4 + 3 + 3 = 25, and 9/25=0.369 / 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\mathrm{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\mathrm{pass}^k: 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)k\mathrm{pass}@k = 1 - (1 - p)^kpassk=pk\mathrm{pass}^k = p^k
SymbolMeaning
ppProbability that one run of this task succeeds
kkNumber of attempts
1−p1 - pProbability that one run fails
(1−p)k(1 - p)^kProbability that all kk runs fail

Sources4 Evaluating Large Language Models Trained on Code2 τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains1 Demystifying evals for AI agents

Worked example

Worked example: opposite directions

Illustrative task with p=0.6p = 0.6 per independent run.

kkpass@k=1−0.4k\mathrm{pass}@k = 1 - 0.4^kpassk=0.6k\mathrm{pass}^k = 0.6^k
10.6000.600
20.8400.360
30.9360.216
40.9740.130
  • At k=4k = 4: 0.44=0.02560.4^4 = 0.0256, so pass@4=0.9744\mathrm{pass}@4 = 0.9744. And 0.64=0.12960.6^4 = 0.1296.
  • As k grows, pass@k\mathrm{pass}@k rises toward 1 (one success is enough) and passk\mathrm{pass}^k 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?

ProductA human or CI picks the best attempt?Report
Code assistant shows the user 3 drafts to choose fromYespass@k\mathrm{pass}@k
Agent cancels a subscription on requestNo: it acts oncepassk\mathrm{pass}^k
Customer-facing assistant used many times by one personNopassk\mathrm{pass}^k
  • Anthropic’s evals post: pass@k\mathrm{pass}@k rises as k grows and suits tools where one success is enough. passk\mathrm{pass}^k 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\mathrm{pass}^3 (0.753=0.42190.75^3 = 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\mathrm{pass}^8 was below 25% in the retail domain. Those are 2024 results, so check how current models do before quoting them.

Sources1 Demystifying evals for AI agents2 τ-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\mathrm{pass}@k with an unbiased formula:

pass@k=1−(n−ck)(nk)\mathrm{pass}@k = 1 - \frac{\binom{n - c}{k}}{\binom{n}{k}}

Illustrative: n=10n = 10 runs, c=3c = 3 correct, k=2k = 2.

  • (72)=21\binom{7}{2} = 21 and (102)=45\binom{10}{2} = 45, so pass@2=1−21/45=0.533\mathrm{pass}@2 = 1 - 21/45 = 0.533.
  • The shortcut 1−(1−0.3)2=0.511 - (1 - 0.3)^2 = 0.51 plugs in the measured rate 0.3. The paper says estimating pass@k\mathrm{pass}@k that way is biased.
  • Practical lesson: with few runs the numbers wobble. Report n and k, not just the rate.

Source4 Evaluating Large Language Models Trained on Code

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\mathrm{pass}@10 say?

Answer

pass10=0.9510≈0.60\mathrm{pass}^{10} = 0.95^{10} \approx 0.60. So roughly four customers in ten see at least one failure. pass@10=1−0.0510\mathrm{pass}@10 = 1 - 0.05^{10} 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

GraderGood atWeak at
Code-based (state checks, tests, schema, tool-call checks)Fast, cheap, reproducibleBrittle, limited for nuanced tasks
Model-based (rubric scoring, pairwise)Open-ended outputNon-deterministic, needs calibration against humans
Human (expert review)Gold-standard qualityExpensive 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.

Sources1 Demystifying evals for AI agents3 How we built our multi-agent research system

Diagram

Layered grading

Diagram: Cheap exact code checks run on every run.

Agent run

1. Programmatic checks:
state, tests, schema

2. LLM judge with
a written rubric

3. Humans review
a sample

Calibrate judge,
fix rubric

Diagram summary: Cheap exact code checks run on every run. An LLM judge with a written rubric covers what code cannot. Humans review a sample to check the judge, and disagreements feed back into the rubric.

Source1 Demystifying evals for AI agents

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.

Source5 Building effective agents

Process

Planning a release gate

  1. List the task set: typical, impossible and adversarial tasks, each with a state-based grader.
  2. Choose k and run every task k times in the sandbox.
  3. Write thresholds before you look at results: minimum passk\mathrm{pass}^k on core tasks, a safety limit, a cost ceiling.
  4. Run, grade with code, then the judge, then a human sample.
  5. 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.

MeasureThresholdResultPass?
Core tasks (12) with all 5 runs correctAt least 10 of 1211 of 12 (91.7%)Yes
Safety violations across 100 runs01No
Mean cost per taskAt most 0.050.04Yes
  • 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\mathrm{pass}^k. 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\mathrm{pass}@k means any of k succeed; passk\mathrm{pass}^k means all k succeed. Quote passk\mathrm{pass}^k 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

  1. Demystifying evals for AI agents (opens in a new tab)

    Mikaela Grace, Jeremy Hadfield, Rodrigo Olivares, Jiri De Jonghe2026Article

    Used for Transcript versus outcome, the three grader types, and pass@k versus pass^k with the 75% per-trial example.

  2. τ-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

    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.

  3. How we built our multi-agent research system (opens in a new tab)

    Jeremy Hadfield, Barry Zhang, Kenneth Lien, Florian Scholz, et al.2025Article

    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.

  4. Evaluating Large Language Models Trained on Code (opens in a new tab)

    Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, et al.2021Preprint

    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.

  5. Building effective agents (opens in a new tab)

    Erik S., Barry Zhang2024Article

    Used for The recommendation to test agents extensively in sandboxed environments because they cost more and can compound errors.