Agent Evaluation: A Practical Guide to Evaluating AI Agents
What to grade, which graders to trust, the metrics that survive non-determinism, and how to turn production traces into an eval suite that decides what ships.
Agent evaluation is the practice of testing an AI agent the way it actually runs: across many turns, calling tools, changing state, and recovering (or not) from what those tools return. It differs from evaluating a single LLM response because an agent can produce a fluent, plausible final answer after taking a wrong turn three steps earlier, and a grader that only reads the last message will score that run as a pass.
This guide is for engineers who own an agent in production and need evals that tell them whether a change is safe to ship. It covers the vocabulary, what to grade, the three kinds of graders, the metrics that hold up when the agent is non-deterministic, and how to build the suite from the traces your agent already produces.
The vocabulary of agent evals
Teams argue past each other about evals because the words are loose. These are the terms most agent eval tooling and writing now use:
- Task (or test case): one scenario with defined inputs and success criteria.
- Trial: one attempt at a task. Because agents vary run to run, a task is usually run several times.
- Grader: logic that scores some aspect of a trial. A task can have several graders, each with several checks.
- Trace (also transcript or trajectory): the full record of a trial: messages, reasoning, tool calls, tool responses and intermediate results.
- Outcome: the final state of the environment. An agent can say "your refund is processed"; the outcome is whether the refund exists in the system of record.
- Eval harness: the infrastructure that runs tasks, records traces, applies graders and aggregates results.
- Agent harness: everything around the model that makes it an agent: prompts, tool definitions, workflow logic, memory. When you evaluate "the agent", you are evaluating the harness and the model together.
That last distinction matters most in practice. Most production regressions come from harness changes (a reworded prompt, a tool whose schema changed, a new retry rule), not from the model, so an eval suite has to be able to say which layer a failure belongs to. Our piece on prompt vs tool vs workflow failures walks through how those layers fail differently.
What to grade in an agent run
An agent run gives you more to grade than a chat completion. Decide up front which of these each task checks, because each catches a different class of failure:
| What you grade | The question it answers | Example check |
|---|---|---|
| Outcome | Did the world end up in the right state? | The ticket is closed and exactly one refund row exists. |
| Final response | Is what the user read correct, grounded and appropriate? | Every figure in the answer appears in a tool response. |
| Tool calls | Were the right tools called with valid arguments? | Identity was verified before process_refund; the amount is within policy. |
| Trajectory | Was the path reasonable, with no loops or dead ends? | No tool retried more than twice with identical arguments. |
| Tool results handling | Did the agent notice when a tool returned an error or empty payload? | An empty search result is reported, not papered over. |
| Cost and latency | Did it get there within budget? | Turns, tokens and wall-clock time stay under the task's limits. |
Grade outcomes first and paths second. Checking that the agent called tools in one exact order produces brittle tests that fail whenever the agent finds a different valid route. Path checks earn their place for things that must or must never happen (a verification step, a destructive call, a workflow loop), and for tool errors the agent rationalizes away instead of raising.
Three kinds of graders
Code-based graders
String and regex matches, schema validation, state checks against a database or sandbox, assertions on tool-call arguments, and counts of turns or tokens. They are fast, cheap, reproducible and easy to debug, so use them wherever the success criterion can be written down exactly. Their weakness is brittleness: they reject valid answers phrased differently from what you expected. Snapshot tests on tool-call sequences and assertions on tool return payloads are both code-based graders.
Model-based graders (LLM-as-a-judge)
A second model scores the trace against a rubric, a reference answer, or another run (pairwise). They handle open-ended output and judge things code cannot, like whether an answer is grounded in what was retrieved. They are also non-deterministic, cost more than code, and can be biased, including toward outputs from their own model family. Two habits make them usable: grade each rubric dimension with its own isolated judge call rather than one call for everything, and give the judge an explicit "cannot tell" option so it is not forced to guess. Then calibrate it against human labels before letting it gate anything; judge model selection for replay evaluation covers how.
Human graders
Domain experts reviewing traces, spot-check sampling, and structured rating. Slow and expensive, but they are the reference the other two are calibrated against. Use humans to label the calibration set for your judges, to review the failures your automated graders flag, and to read a sample of passing traces each week, because a grader that never fails anything is usually broken.
Most tasks combine graders: a state check for the outcome, a tool-call assertion for the step that must happen, and a judge for response quality. Decide whether a task passes only when every grader passes, or when a weighted score clears a threshold, and record the choice with the task.
Metrics that hold up under non-determinism
Run the same task twice and an agent can pass once and fail once. A single pass/fail per task hides that, so report rates over several trials:
- Task success rate: the share of trials whose graders all pass, per task and across the suite.
- pass@k: the probability that at least one of k trials succeeds. Useful when a person picks from several attempts, as with code suggestions.
- pass^k: the probability that all k trials succeed, introduced with the τ-bench benchmark. This is the one that matters for an agent users rely on every time. As an illustration of why: a task the agent gets right 90% of the time is passed on all five of five trials only about 59% of the time (0.95).
- Partial credit: for multi-step tasks, score the steps. An agent that verified the customer but failed to issue the refund is closer than one that failed immediately, and the difference tells you where to look.
- Cost and latency per task: turns, tool calls, tokens and time. A change that keeps the success rate flat while doubling tool calls is a regression.
Before you compare two versions, run the same suite on the same version twice and look at how much the numbers move. That spread is your noise floor; a difference smaller than it is not a result. If the spread is large, the cause is often the eval rather than the agent: flaky agent regression tests and determinism controls in replay environments cover how to shrink it.
Capability evals and regression evals
Keep two suites with different jobs. Capability evals ask what the agent can do yet; they should start with a low pass rate and give the team something to climb. Regression evals ask whether the agent still does everything it used to; they should sit near 100%, and any drop is a signal that something broke. As capability tasks become reliably passed, move them into the regression suite. Mixing the two produces a number that rises and falls for reasons nobody can untangle.
Where eval tasks should come from
The fastest way to a useful suite is not to invent scenarios but to collect the ones your agent already failed. Synthetic test cases reflect what the team imagined users would do; production traces show what they actually do. A practical loop:
- Capture traces with enough detail to replay. Record every model call, tool call, tool argument and tool response as structured spans, plus the prompt and tool-definition versions in effect. The OpenTelemetry GenAI semantic conventions give you a standard shape for this.
- Find the failures. Bug reports, support tickets, thumbs-down, escalations, retries and abandoned sessions all point at traces worth reading. Grouping failures into cohorts shows which ones recur.
- Turn each failure into a task. Keep the original input and the recorded tool responses, and write the success criteria the agent missed. Check that two engineers reading the task would reach the same pass/fail verdict; if not, the task is ambiguous and will add noise.
- Balance the set. Include cases where a behavior should happen and cases where it should not, so the agent is not tuned into doing the behavior everywhere (searching for every question, escalating every ticket).
- Curate as it grows. Retire duplicates, keep coverage across intents and tools, and weight toward the failures that cost the most. See trace corpus curation and prioritizing by failure frequency.
Starting small is fine. A few dozen tasks drawn from real failures will catch more than hundreds of hypothetical ones, and the suite gets harder to build the longer an agent runs without one.
Offline, replay and online evaluation
Agent evaluation happens at three points, and each catches what the others miss:
- Offline evals run a fixed task set against a candidate version in a sandbox, on every change. Fast and repeatable, but only as representative as the tasks.
- Replay evals re-run real production traces against the candidate, feeding the agent the recorded tool responses so it sees exactly what it saw in production without touching live systems. This is how you answer "would this prompt change have fixed last week's failures without breaking the runs that worked?" Historical trace validation and side-by-side diffing against a frozen baseline go deeper.
- Online evaluation scores live traffic after release: judges and checks running on a sample of production traces, plus drift, cost and latency monitoring. It finds what no stored task anticipated, which is where the next round of tasks comes from.
Replay has one trap: once the candidate takes a different action than the recording, there is no recorded response for it. Decide in advance whether such a run stops and is graded on its divergence, falls back to a simulated tool, or is flagged for review.
Building an agent evaluation framework, step by step
- Write down what success means for the agent's main jobs, in terms an outcome check or a rubric can test.
- Instrument tracing so every production run is replayable and tied to the harness versions that produced it.
- Seed the regression suite with failures from production and the manual checks the team already runs before each release.
- Pick graders per task: code where the criterion is exact, a calibrated judge where it is not, human review for the calibration set.
- Run several trials per task and report success rate, pass^k and cost, with the noise floor alongside.
- Wire it into CI so every prompt, tool and workflow change runs the suite and posts the diff on the pull request. See wiring replay evals into CI/CD.
- Read traces, passing and failing, every week. It is the only way to know your graders measure what you think.
- Feed production back in: each new failure cohort becomes tasks, and each fix is validated against the traces that exposed it.
Using evals to decide what ships
An eval suite earns its keep when it changes a release decision. Agree on the rules before the results come in: which suites must not drop, by how much a capability score has to rise to count, what cost or latency increase is acceptable, and what happens when a judge and a human disagree. Then hold every change to them. Gating deploys on replay pass rates, evidence thresholds for prompt changes and ship vs hold decisions lay out how teams set those rules, and rollback triggers cover what happens when online evaluation disagrees with the offline result.
Common mistakes
- Grading only the final answer. It misses the swallowed tool error and the loop that happened to end well.
- Trusting an uncalibrated judge. A judge's blind spots become your release gate's blind spots.
- One trial per task. Without repeated trials you cannot tell a regression from noise.
- Taking scores at face value. A task nobody can pass is usually a broken task or a grader bug, not an incapable agent. Read the failing traces before acting on a number.
- Shared state between trials. Leftover files, caches or database rows from one trial leak into the next and make results correlated.
- A suite that never changes. If no production failure has been added in a month, the suite is drifting away from what users do.
Agent evaluation tools
You can run agent evals with plain test scripts, and many teams start there. When the suite outgrows scripts, tools fall into a few groups; features and pricing change often, so check each one's own documentation before you choose:
- Tracing and evaluation platforms that combine trace capture, datasets, offline and online evals: for example Braintrust, LangSmith, Langfuse (open source, self-hostable) and Arize (including the open-source Phoenix).
- Eval runners for sandboxed environments, such as Harbor, for running many containerized agent trials and published benchmarks.
- Trace-to-fix systems that read production traces, attribute failures to a harness layer and validate proposed changes against historical traces, such as Moda.
Whichever you pick, the tool is only as good as the tasks and graders you put through it. Spend the effort there; our scorecard for selecting replay eval tools lists what to test before you commit.


