Skip to content

AI agent evaluation: grade the outcome, then the trajectory

AI agent evaluation grades a whole agent run: each step, the trajectory, and the end state. Metrics for each level, repeated trials, and what to build first.

Published
Reading time
14 min read

In short

  • AI agent evaluation grades a run at three levels: each step (the right tool with the right arguments), the trajectory (order, wasted steps, recovery), and the outcome (the end state of the environment).
  • Decide pass or fail from the end state, checked in code. An agent's final message is a claim about what it did, and the claim can be wrong.
  • Run every task several times. In the tau-bench paper, a GPT-4o agent passed about 61 percent of retail tasks on one trial and fewer than 25 percent on all of eight trials.
  • Exact-match reference trajectories fail agents that find another valid path. Keep trajectory checks for the few sequences that are rules, such as verifying identity before a refund.

AI agent evaluation is the practice of measuring whether an agent completes its tasks, by grading whole runs: the steps the agent took, the order it took them in, and the state it left behind. An agent makes many model calls, calls tools that change things, and can reach the right answer the wrong way, so reading its final message is not enough.

This article takes one position. Decide pass or fail from the outcome, checked in the end state of the environment. Grade the trajectory to learn why a run passed or failed and what it cost. Run every task several times, because one passing run proves little. LLM evaluation covers the single-response case, and its advice on datasets and error bars still applies.

Why grading the final answer is not enough for an agent

An agent's final answer is a claim about what the agent did, and the claim can be wrong. Anthropic's guide to agent evals, published in January 2026, gives the example: a flight-booking agent can end its transcript by saying the flight is booked, but the outcome is whether a reservation exists in the environment's database.

The path is the second gap. A run can end in the right state after skipping an identity check or taking 14 steps where 4 would do, and an agent loop resends its history on every step, so wasted steps are paid for many times. The third gap is variance. Each step is a sampled decision, so the same task can pass on one run and fail on the next.

The vocabulary here is Anthropic's. A task is one test with defined inputs and success criteria, and a trial is one attempt at it. The transcript, also called the trace or trajectory, is the complete record of a trial, and the outcome is the state of the environment when it ends.

The three levels of agent evaluation: step, trajectory, and outcome

An agent run can be graded at three levels: each step on its own, the trajectory as a whole, and the outcome the run leaves in the environment. A pass at one level says little about the others.

TASKONE RUN · FOUR TOOL CALLSENVIRONMENTTaskREFUND 1042get_userVERIFY IDget_orderORDER 1042refundTOOL ERRORrefundRETRY OKEnd stateDATABASE ROWSStepTOOL · ARGUMENTSPASSPASSWRONG ARGSPASSTrajectoryORDER · RECOVERYWASTED STEPSIDENTITY CHECKED BEFORE THE REFUND1 ERROR, RECOVERED · 4 STEPS, REFERENCE 3OutcomeSTATE CHECKONE REFUND ROWPASSThe outcome decides pass or fail. Steps and trajectory explain the result and its cost.
One run of a refund agent, graded at three levels. Each tool call gets a step verdict, the whole sequence gets a trajectory check, and the end state gets the outcome check that decides pass or fail. Tool names and values are illustrative.
  • The step level asks whether one decision was right: the tool the agent picked and the arguments it passed.
  • The trajectory level asks whether the sequence was acceptable: required steps in order, nothing forbidden, no wasted steps, and recovery after an error.
  • The outcome level asks whether the task got done: the environment ended in the state the task called for, and the user was told what they needed.

In the figure, the run passes on outcome. The step level shows that the third call had wrong arguments, and the trajectory level shows that the agent recovered at the cost of one extra step. Only the outcome decides the pass, and the other two levels say what to fix.

Under this ordering, a run that reaches the right state by a poor path still passes. Trajectory trends and a few hard rules close that gap.

What to measure at each level

Measure task success at the outcome level, tool choice and arguments at the step level, and order, waste, recovery, and cost at the trajectory level. All of it can be computed in code from the end state and the run's trace.

LevelMetricHow to compute it
OutcomeTask successCompare the end state with the expected state. Pass or fail per trial.
OutcomeReliability (pass^k)Run each task k times. Count the share of tasks where all k trials pass.
TrajectoryRequired and forbidden actionsAssert on the trace: this call came before that one, this tool was never called.
TrajectorySteps and wasted stepsCount calls per run against the reference solution's count, and count repeated identical calls.
TrajectoryRecovery rateOf the runs where a tool returned an error, the share that still passed the outcome check.
TrajectoryTokens, time, and costSum over the run's spans. Report cost per passed trial as well.
StepTool selection accuracyOf the steps with a labeled expected tool, the share where the agent called it.
StepArgument correctnessOf the calls to the right tool, the share whose arguments match the expected values.

OpenAI's evaluation best practices names the step-level rows tool selection (the agent picks the correct tool) and data precision (it calls the tool with the correct arguments), and adds handoff accuracy for multi-agent systems. Tool call accuracy is the usual name for the first two together. When matching arguments, compare IDs and enums exactly, and normalize dates and amounts first. Strict schemas, covered in tool calling, guarantee the shape of the arguments, and step-level evaluation checks the values.

The trajectory rows come from the trace described in AI agent observability. Anthropic's guide to writing tools recommends collecting tool-call runtime, call counts, token consumption, and tool errors next to accuracy. Google's Agent Development Kit (ADK) reports tool calls, model calls, tokens, and duration on every eval case as informational values that never fail it. Give them the same status, and investigate jumps.

Check the outcome in the end state, not in the reply

Decide task success by reading the environment after the run and comparing it with the state a correct run would leave. This is how tau-bench grades a customer-service agent: a trial succeeds only if the final database is identical to the annotated goal database and the agent's replies contain the information the user needed.

Take one task: a customer asks for a refund on order 1042, a delivered order for $48.50. The expected database is built once, by applying the reference solution to a copy of the seed data: order 1042 is marked refunded, and the refunds table has one new row. The grader compares the whole database, not one row.

outcome_check.py
import sqlite3
 
# Columns that differ between two correct runs.
VOLATILE = {"created_at", "updated_at"}
 
 
def snapshot(db_path: str) -> dict[str, list[tuple]]:
    """Every table as a sorted list of rows, without the volatile columns."""
    db = sqlite3.connect(db_path)
    tables = [row[0] for row in db.execute("SELECT name FROM sqlite_master WHERE type = 'table'")]
    state = {}
    for table in tables:
        columns = [col[1] for col in db.execute(f"PRAGMA table_info({table})") if col[1] not in VOLATILE]
        rows = db.execute(f"SELECT {', '.join(columns)} FROM {table}").fetchall()
        state[table] = sorted(rows, key=repr)
    db.close()
    return state
 
 
def grade(run_db: str, expected_db: str, final_reply: str) -> dict[str, bool]:
    checks = {
        # The whole database, so a second refund or a change to another order fails.
        "state_matches": snapshot(run_db) == snapshot(expected_db),
        # The customer was told the amount.
        "reply_states_amount": "48.50" in final_reply,
    }
    checks["passed"] = all(checks.values())
    return checks

Three failing runs show why. An agent that says the refund is issued without calling the tool leaves the seed unchanged. An agent that retries after a timeout and refunds twice leaves an extra row. An agent that also refunds order 1041 changes a row nobody asked about. A check on the status of order 1042 alone passes the second and third.

The method costs a seeded environment and an expected state for every task, and it needs tasks with one correct end state. Open-ended tasks need another outcome grader, such as a test suite for code. The tau-bench authors add that a matching database is necessary but not sufficient: an agent could issue a return without the user's confirmation and still match. Trajectory rules cover that case.

Why reference trajectories are brittle, and when to use them anyway

A reference trajectory is the expected sequence of tool calls for a task, and exact matching against it fails agents that solve the task another valid way. Anthropic's guide calls checking for a specific sequence of tool calls too rigid, because agents regularly find valid approaches the eval designers did not anticipate. The WebArena authors grade functional correctness over comparing action sequences for the same reason. References also cost maintenance: every renamed or merged tool invalidates the sequences written before it.

Evaluation libraries soften the match with modes. As of November 2026, the ADK docs and agentevals, an MIT-licensed library of trajectory evaluators, name them as follows.

Match modePasses whenFits
ADK EXACT, agentevals strictThe same tool calls in the same order, with none extra or missingA workflow with one legal path
ADK IN_ORDEREvery expected call appears, in order, with other calls allowed in betweenRules about the order of calls
ADK ANY_ORDER, agentevals supersetEvery expected call appears, in any order, with extra calls allowedRequired lookups whose order does not matter
agentevals subsetThe agent called no tool outside the referenceKeeping an agent away from tools a task does not need

Use trajectory checks in three cases:

  • The sequence is a rule. Verify identity before any refund, and never call a write tool on a read-only task. Write each rule as an in-order or subset assertion on the trace, not as a full reference.
  • The path is fixed by design. A workflow whose order is set in code has one legal sequence, so an exact match is a fair regression test.
  • The test is one step. Freeze a conversation at a decision point and check the next tool call, a cheap way to catch regressions in tool descriptions.

Run every task several times

One trial per task measures a mix of the agent's ability and chance, so run each task several times and report how often it passes.

Two metrics summarize the result. pass@k is the probability that at least one of k trials succeeds, and pass^k, introduced in the tau-bench paper, is the probability that all k succeed. Use pass@k when one success is enough, as with a coding agent whose patch is verified by tests. Use pass^k for an agent that talks to customers, where every conversation has to work.

In the tau-bench results, a GPT-4o function-calling agent passed about 61 percent of the retail tasks on a single trial, and fewer than 25 percent on all of eight. Tasks differ: some always pass, some never do, and some flip, and only repeated trials find the ones that flip.

Five trials per task is a workable default, which makes 250 agent runs for 50 tasks. Run one trial per task on every change, and the full count nightly or before a release. Start each trial from a clean environment. Anthropic describes an agent that gained an advantage by reading the git history earlier trials left behind. A pass rate over five trials is still an estimate, so apply the error bars from the LLM evaluation article.

What the main agent benchmarks measure, and how they grade

Four widely used agent benchmarks all grade the outcome, each with a different kind of grader. Read them as method references for your own suite. A leaderboard position does not say how an agent does on your tasks.

BenchmarkTaskHow a run is graded
SWE-benchResolve a real GitHub issue: 2,294 tasks from 12 Python repositoriesThe patch is applied and the repository's tests run. Fail-to-pass tests must now pass, and pass-to-pass tests must still pass.
tau-benchServe a simulated customer under a written policy: 115 retail and 50 airline tasksThe final database is compared with the annotated goal state, and replies are checked for required facts.
GAIAAnswer a question that takes browsing, files, and tools: 466 questionsQuasi-exact match on the final answer. The path is not evaluated.
WebArenaComplete a task on self-hosted websites: 812 tasksPrograms check the resulting state, such as database or page content, or the answer returned.

The SWE-bench pairing is worth copying into any suite: one check that the task is done, and one that nothing else broke. Benchmark graders also have bugs. Anthropic reports one of its models moving from 42 to 95 percent on CORE-Bench once grading bugs were fixed and the scaffold was loosened. Read failing transcripts before believing a score.

Judges for trajectories, and their limits

An LLM judge can grade the parts of a trajectory that code cannot, such as whether the agent asked a clarifying question when it should have, or whether its reply is grounded in what the tools returned. Use a judge for those criteria and for nothing that a state check or a trace assertion can decide. LLM as a judge covers how to build and calibrate one, and hallucination detection covers the grounding check. Trajectories add three limits to the usual ones:

  • A judge reads the transcript, which is the agent's account of the run. It cannot see whether the refund row exists, so it should not decide task success where a state check is possible.
  • A long run's transcript, with every tool result, is a long prompt, and accuracy falls on long inputs, as context rot explains. Give the judge only the calls and results one criterion needs.
  • One judge grading everything is hard to calibrate. Anthropic's guide recommends an isolated judge per dimension and calibration against human experts.

Build the test environment: sandbox, seeded state, and simulated users

An agent eval needs an environment that starts every trial in the same known state and that the agent can change without touching anything real. Building it is most of the engineering cost of AI agent testing.

The sandbox is where tools run. For an agent that runs code, that means a container per trial. Inspect, the UK AI Security Institute's evaluation framework, gives each sample its own sandbox instance and supports Docker. For an agent that calls business APIs, the sandbox is a test instance of each service or a fake with the same tool schema. Fakes are cheaper to reset, and they drift from the real API.

Seeded state is the fixture each task declares: the rows, files, or messages that exist when the trial starts. Load it before every trial and discard it after.

A simulated user is a second model that plays the customer, for agents that hold a conversation. In tau-bench, the simulator gets a hidden instruction and the conversation so far, and cannot see the agent's tool calls. It costs a model call per turn and adds its own variance: a simulator that drifts from its instruction fails the task on the agent's behalf, so read its turns in failed runs before blaming the agent. If the agent retrieves documents, score retrieval as its own component, as in RAG evaluation.

Turn production traces into eval cases

The best source of tasks is production runs that went wrong, and a trace holds most of what a task needs. Anthropic's guide says to start from the bug tracker and the support queue. OpenAI's says to log everything and mine the logs for eval cases, and its page on evaluating agent workflows starts from traces.

  1. Select runs that users flagged, retried, or escalated, runs that hit a step or token budget, and runs with tool errors.
  2. Read each transcript and name the failure, such as a wrong argument, a skipped rule, or a false claim of success.
  3. Rebuild the starting state from the trace's first tool results, with personal data replaced by synthetic values.
  4. Write the expected end state and a reference solution that passes the grader. Anthropic notes that a task no trial ever passes is more often broken than too hard.
  5. Add tasks where the right action is to refuse or do nothing.

What each practice costs, and what to do first

Build outcome checks and repeated trials first, because they are the only parts that say whether the agent works.

  • Outcome checks cost engineering time: the sandbox, the fixtures, and an expected state per task. Grading costs nothing to run.
  • Repeated trials multiply the run cost by k.
  • Trace metrics are close to free once runs are traced.
  • Trajectory rules are cheap to write. Full reference trajectories cost labeling time per task and break when tools change.
  • Judges cost one model call per criterion per trial, plus a hand-labeled sample for calibration.
  • Simulated users cost one model call per turn, plus time spent checking the simulator.

With one engineer and one week, the order is:

  1. Days one and two: pick 20 tasks from real failures and build a resettable environment with their fixtures. Anthropic's guide puts a good start at 20 to 50 simple tasks.
  2. Day three: write the outcome check for each task and a reference solution that passes it.
  3. Day four: run five trials per task and read every failing transcript. Fix broken tasks and graders before the agent.
  4. Day five: add steps, tokens, tool errors, and repeated calls to the report, write two or three trajectory rules, and run one trial per task in CI. Judges, simulated users, and reference trajectories can wait.

Frequently asked questions

What is AI agent evaluation?

AI agent evaluation is the process of measuring whether an AI agent completes its tasks correctly and at an acceptable cost. It runs the agent on tasks in a controlled environment and grades each run at three levels: the steps, the trajectory, and the outcome left in the environment. Each task is run several times, because results vary between runs.

How is agent evaluation different from LLM evaluation?

LLM evaluation grades one response to one input. Agent evaluation grades a run made of many model calls and tool calls that change external state. It adds checks on the end state, on tool choice and arguments, on the path taken, and on reliability across repeated trials.

What metrics are used to evaluate AI agents?

The core agent evaluation metrics are task success rate from an end-state check, tool selection accuracy, argument correctness, and reliability across trials, where pass^k is the probability that all k trials of a task succeed. Trajectory metrics add steps per task, repeated calls, recovery rate after tool errors, tokens, time, and cost.

What is trajectory evaluation?

Trajectory evaluation grades the sequence of steps an agent took, as opposed to its final answer. It can compare the tool calls with a reference sequence, assert rules such as an identity check before a refund, or use an LLM judge. Exact matching against a reference is brittle, because agents often find other valid paths.

What is tool call accuracy?

Tool call accuracy measures whether an agent called the right tool with the right arguments at a given step. It is usually two numbers: the share of labeled steps where the agent chose the expected tool, and the share of those calls with the expected arguments. It says nothing about whether the task was completed.

Sources

  1. 01Demystifying evals for AI agentsAnthropic, 2026
  2. 02Writing effective tools for agentsAnthropic, 2025
  3. 03Evaluation best practicesOpenAI API docs
  4. 04Evaluate agent workflowsOpenAI API docs
  5. 05τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World DomainsarXiv:2406.12045
  6. 06SWE-bench: Can Language Models Resolve Real-World GitHub Issues?arXiv:2310.06770
  7. 07GAIA: a benchmark for General AI AssistantsarXiv:2311.12983
  8. 08WebArena: A Realistic Web Environment for Building Autonomous AgentsarXiv:2307.13854
  9. 09Evaluation criteriaAgent Development Kit docs
  10. 10agentevalsGitHub, LangChain
  11. 11SandboxingInspect docs, UK AI Security Institute