Topic 1 of 6 · 5 min read
Grading end-state task success
Goal: Grade an agent run by its end state and report pass@k and pass^k for a repeated task.
Grade an agent by what it left behind in the environment, not by what it said, and run each task several times because one pass proves little.
Check yourself · 1 of 3
An agent ends its run with "Ticket closed." What is the most reliable way to grade it?
Why it matters
An agent finishes with a confident message such as "Refund issued, ticket closed." That message is a claim. The real question is whether the refund row exists, the ticket status changed and nothing else was touched. A grader that reads the final message rewards fluent liars. A grader that reads the final state rewards work that happened.
How to do it
- Define success as a state check. Write a function that inspects the sandbox after the run: do the tests pass, does the file contain the change, is the database row present with the right values.
- Check outcomes, not one specific route. Agents find valid paths you did not plan. If the end state is correct and allowed, it passes.
- Run each task k times. Agents are non-deterministic, so one run is a sample. Record pass or fail per trial.
- Report two numbers. pass@k is the chance that at least one of k trials succeeds. It suits cases where a retry or a human pick is cheap. pass^k is the chance that all k trials succeed. It suits customer-facing agents that must work every time. The tau-bench paper introduced pass^k for this reason.
With a per-trial success rate of 0.9, pass@5 is about 1.0 but pass^5 is 0.9 to the power 5, about 0.59. The same agent looks excellent or shaky depending on the metric you pick.
Before and after
# Weak: grades the words
def grade(run):
return "refund issued" in run.final_message.lower()
# Better: grades the state
def grade(run):
order = run.db.get("orders", run.task.order_id)
refunds = run.db.query("refunds", order_id=order.id)
return (
order.status == "refunded"
and len(refunds) == 1
and refunds[0].amount == order.total
)
The second grader fails an agent that says "done" and did nothing, and fails one that refunded twice.
What goes wrong
- Grading the message. The agent can claim success without acting.
- Too strict on the path. Requiring one exact sequence fails correct runs.
- One trial per task. A lucky pass hides a 60 percent agent.
- Ignoring side effects. The state check should also confirm that unrelated records are unchanged.
Examples
Message says done, database says no
A support agent ends with "Refund issued for order 4471." The state grader finds no row in the refunds table. A message-matching grader would have scored this run as a pass.
Same agent, two metrics
Over 5 trials on one task an agent passes 4. pass@5 is 1 because at least one trial passed. pass^5 is 0 because not all passed. Report both and say which one the product needs.
Key points
- Grade the final environment state, not the agent's closing message.
- Assert on outcomes so valid but unexpected routes still pass.
- Run every task several times, because agent behaviour varies between runs.
- pass@k asks whether any of k trials succeeded; pass^k asks whether all of them did.
- Choose pass^k when users need the agent to work every time.
Common mistakes
- Matching phrases in the final message instead of checking state.
- Reporting one run per task as the agent's success rate.
- Treating pass@k as reliability when users need every run to work.
- Failing correct runs because they took a different route than the reference.
Check yourself · 2 of 3
Five trials of one task succeed in 4 of 5 runs. What is pass^5 for that task?
Check yourself · 3 of 3
A team ships an agent that talks to paying customers. Which reliability metric fits best?
Practice items, not counted towards your mastery.
Start here
- Demystifying evals for AI agents (Anthropic) (opens in a new tab)ArticleFree
Anthropic's practical guide to grading agents: graders, trials, pass@k versus pass^k and reading transcripts.
- tau-bench: Tool-Agent-User Interaction in Real-World Domains (Yao et al.) (opens in a new tab)PaperFree
Introduces pass^k and grades agents on the final database state with simulated users and policy rules.
- SWE-bench (opens in a new tab)ToolFree
The reference benchmark built from real GitHub issues, graded by tests the agent never sees.