Skip to content

Command Palette

Search for a command to run...

BLOG / EVALUATIONAdvanced

How to Evaluate AI Agents: Beyond Final-Answer Accuracy

How to evaluate AI agents that take many steps: outcome, trajectory, tool use, policy adherence and cost, with a task-based golden set and regression checks.

Bhavin Mistry October 11, 2026 10 min readLast reviewed

Topics:Evaluation

Illustrative scenario: a research agent is asked a simple question and returns the right answer. Behind that answer sit forty tool calls, three repeated searches, a page it read twice and a bill of fifteen dollars. A test that only checks the final sentence marks it as a pass. A user waiting forty minutes for it would not.

TL;DR

An agent is a process, not an answer, so evaluating it means judging the whole run. Measure five things for every task: whether the outcome is right, whether the trajectory was sensible, whether it chose and used the right tools, whether it followed policy, and what it cost. Build a golden set of tasks (not questions) with machine-checkable success conditions, run each task several times because agents vary, and rerun the whole set whenever the model, prompt or tools change.

Why single-answer evaluation breaks for agents

A question-answering system takes an input and produces an output, so you can compare the output with a reference. An agent takes a goal and then acts: it calls tools, reads results, changes its plan and finally stops. The same final answer can come from a clean three-step run or from a chaotic forty-step one, and only one of those is safe to ship.

Single-answer evaluation

  • Input in, output out
  • Compare the output with a reference
  • Failure means a wrong or unsupported answer
  • Cost and time are fixed by the model call

Agent evaluation

  • A goal, then a sequence of actions in an environment
  • Check the end state and the path taken
  • Failure includes loops, wrong tools, policy breaches and runaway cost
  • Cost and time vary with every run
Evaluating an answer versus evaluating an agent

If you have not yet built the basics for answer quality, start with LLM evaluation fundamentals for production. Everything there still applies to the answers an agent produces. This post covers what is added when the system also acts.

Five things to measure

Give every task a score on each dimension, and keep them separate. A single blended score hides which part broke.

  • Outcome

    Good: The end state matches what the task required, checked by code where possible

    Red flag: Only the final message is read, never the resulting state

  • Trajectory

    Good: A reasonable number of steps with no loops, repeats or dead ends

    Red flag: Correct result after many repeated or irrelevant calls

  • Tool use

    Good: The right tool, with valid arguments, and sensible handling of errors

    Red flag: Wrong tool chosen, malformed arguments or an error ignored

  • Policy adherence

    Good: Approval was requested exactly when policy says, and forbidden actions were never attempted

    Red flag: An irreversible action taken without the required approval

  • Cost and latency

    Good: Within the budget set for that kind of task

    Red flag: Token spend or wall-clock time varies wildly across runs

The five dimensions of agent quality

Outcome comes first because nothing else matters if the task failed. But a run that passes the outcome check and fails the others is a regression waiting to happen, which is why they are scored together.

Build a golden set of tasks, not questions

A golden set for an agent is a list of tasks. Each task describes a starting state, a goal in plain language, and a way to check success automatically.

  1. Step 1: Collect real tasks

    From logs, tickets and the people who do the work today, not from imagination

  2. Step 2: Define the start state

    The files, records or accounts the agent begins with, so runs are comparable

  3. Step 3: Write the success check

    Code that inspects the end state: a record updated, a file produced, an answer containing a required fact

  4. Step 4: Set limits per task

    A maximum number of steps and a cost budget, taken from what successful runs actually need

  5. Step 5: Add the hard cases

    Tasks where the right behaviour is to refuse, ask for approval or recover from a tool error

Building the task set

Prefer success checks that inspect the end state (the ticket was created with the right fields) over checks that read the agent's description of what it did. Agents describe their work optimistically.

Cover the cases that hurt in production: a tool that returns an error, a tool that times out, an ambiguous request, an instruction hidden in a document the agent reads, and a request the agent should decline. These are the tasks that reveal policy and recovery problems that easy tasks never will. The injection via retrieved documents challenge presents a RAG system derailed by an uploaded document, which is the kind of case worth keeping in the set.

Score the trajectory with assertions first

Many trajectory problems can be caught with plain code. Record every step of a run (the tool, its arguments, the result and the cost), then assert on the record.

def check_run(run, task) -> list[str]:
    """Return a list of failures for one agent run; empty means it passed."""
    failures = []
    calls = [step.tool for step in run.steps if step.tool]
    signatures = [(step.tool, repr(step.args)) for step in run.steps if step.tool]

    if not task.success(run.final_state):
        failures.append("outcome: end state does not match the task")
    for tool in task.must_call:
        if tool not in calls:
            failures.append(f"tool use: never called {tool}")
    for tool in task.must_not_call:
        if tool in calls:
            failures.append(f"policy: called forbidden tool {tool}")
    if len(run.steps) > task.max_steps:
        failures.append(f"trajectory: {len(run.steps)} steps, limit {task.max_steps}")
    if len(signatures) != len(set(signatures)):
        failures.append("trajectory: repeated an identical tool call")
    if run.cost_usd > task.max_cost_usd:
        failures.append(f"cost: ${run.cost_usd:.2f}, budget ${task.max_cost_usd:.2f}")
    return failures

Assertions are cheap, deterministic and easy to explain, so use them for everything you can state as a rule. Keep a model judge for the soft questions, such as whether a plan was sensible or an explanation was honest. If you use a judge, give it a written rubric, a different model family from the agent, and calibrate it against human grades, as described in the evaluation fundamentals post.

  • If

    The end state is checkable by code

    Choose

    A state assertion

    Because

    It is deterministic and ignores how the agent words things

  • If

    A rule about tools, steps or cost

    Choose

    A trajectory assertion

    Because

    The run record contains everything needed

  • If

    Whether a plan or explanation is sensible

    Choose

    A calibrated LLM judge

    Because

    It is a judgement, so it needs a rubric and human calibration

  • If

    Whether approval was requested at the right moments

    Choose

    A policy assertion against the approval log

    Because

    Policy should be checked by rules, not by opinion

Which check for which property

Agents are nondeterministic, so run tasks more than once

Run the same task twice and an agent may take different paths. A single pass or fail on one run tells you little. Run each task several times and report the pass rate per task and overall, along with the spread of steps and cost.

Two practical points. First, pick the number of runs from your own variance: if results barely change between runs, fewer is fine; if they swing, you need more before you trust a comparison. Second, decide in advance what counts as a regression. A task that passed every time and now passes half the time is a regression even though the average may barely move.

The agent loops article covers the limits that keep a bad run bounded, and those same limits (step cap, cost budget, duplicate-call refusal) give you per-task thresholds to assert against.

Regression testing after a model or prompt change

Agents change underneath you: a vendor updates a model, someone edits a prompt, a tool's response format shifts. Treat each of these as a release that needs the golden set.

  1. Step 1: Pin the versions

    Record the model, prompt and tool versions for the baseline run

  2. Step 2: Rerun every task

    Several runs each, under the same limits and start states

  3. Step 3: Compare per task

    Look at which tasks changed from pass to fail, and the reverse, not only the average

  4. Step 4: Read the flipped runs

    Open the traces of every flipped task to see why

  5. Step 5: Decide and record

    Ship, fix or roll back, and keep the baseline for next time

Rerunning the set after a change

The model-upgrade regression challenge starts from an upgrade where production metrics looked fine but evaluation scores had dropped, which is the situation a rerun of the golden set is there to catch. Segment your results by task type, so a drop in one category cannot hide behind gains in another.

Online evaluation: let production feed the golden set

The golden set tests what you anticipated. Live traffic shows the rest. Sample a small share of real runs, apply the same assertions and judge, and review the failures by hand. Every failure worth fixing becomes a new task in the golden set, with its start state and success check. Over weeks the set grows to match what users actually ask. The online evaluation chapter covers sampling and drift.

If policy limits what you may store, decide that early: sampled online evaluation needs a retained, access-controlled copy of at least a sample of traces.

A starter plan

  1. Week 1

    Log every step of agent runs as structured records, and collect 20 to 30 real tasks

  2. Week 2

    Write the success checks and per-task limits, and add the refusal and tool-failure cases

  3. Week 3

    Run each task several times, record the baseline pass rate, cost and steps per task

  4. Week 4

    Wire the set into CI for any change to the model, prompt or tools, and turn on sampled online review

A first month, as a plan (adjust to your team)

Start small and real. Twenty tasks with strong success checks teach you more than two hundred vague ones.

Frequently asked questions

How do you evaluate an AI agent? Judge the whole run, not only the final answer. Score the outcome, the trajectory, tool use, policy adherence and cost for each task in a golden set, run each task several times because agents vary, and rerun the set whenever the model, prompt or tools change.

What is trajectory evaluation? It is checking the path an agent took, not just where it ended up: how many steps it used, whether it repeated calls or looped, whether it chose the right tools and whether it asked for approval at the right moments. Much of it can be done with simple assertions over a recorded run.

How is agent evaluation different from evaluating a chatbot or a RAG system? A chatbot or RAG system produces an answer you can compare with a reference. An agent takes actions in an environment, so you also check the resulting state, the steps taken, the tools used and the cost, none of which a final-answer comparison can see.

How big should an agent golden set be? Start with roughly twenty to thirty real tasks that each have a checkable success condition, and grow it from production failures. Coverage of task types and hard cases matters more than raw count, and the right size depends on your own variance.

Do I need an LLM judge for agents? Not for everything. Use code for anything you can state as a rule, such as the end state, forbidden tools, step limits and cost. Use a calibrated judge only for soft questions like whether a plan was sensible, with a written rubric and checks against human grades.

Why run each task more than once? Agents are nondeterministic, so one run can pass by luck or fail by bad luck. A pass rate across several runs shows whether a task is reliably solved, and a drop in that rate is a regression even when the average moves little.

What should I do when a new model version changes agent behaviour? Rerun the whole golden set with the same limits, compare per task rather than only on average, read the traces of tasks that flipped, and decide whether to ship, fix or roll back. Keep the baseline so the next change has something to compare against.

Evaluating AI systems

Your next step

Reading is the start. Turn it into skill: read the chapter, practise on something real, check the numbers, then follow a path.

  1. Read · ChapterEvaluation Fundamentals
  2. Practise · LabBuild an Evaluation Pipeline
  3. Use a free toolAI Value Dashboard
  4. Follow a roadmapAI Engineer roadmap
All articles on Evaluation
#agent evaluation#AI agents#trajectory evaluation#golden set#tool use#regression testing

Discuss this article

Got a question, a counter-example or a correction? Bring it to the community.

Join the discussion

Email updates

Enjoyed this? Get the next guide by email.

One email when something substantial is published. No digests, no daily drip. Unsubscribe in one click.

We will email you a confirmation link first, then send an occasional email when a substantial guide is published. Unsubscribe in one click. Stored on our own servers, never sold or shared. See the privacy policy.

Prefer a feed reader? Follow by RSS.