Agent Evaluation Framework

Decide what good means, measure it the same way every time and let the evidence decide what ships.

BeginnerIntermediateExpert · 12 min read · Last updated:

In short

An evaluation framework is a repeatable way to answer "is this agent good enough, and better than before?" It has a set of tasks with success criteria, a harness that runs them, graders that judge results and rules that turn scores into decisions. Use it offline before release and online with real traffic after.

What you will learn: the parts of a framework, how to define success, offline versus online evaluation, outcome verification, a runnable comparison with a release gate and a reference architecture.
Prerequisites: Agent Testing: Unit to End-to-End.

Beginner The building blocks

Why you need one

Without evaluation, changes are judged by a few impressive or disappointing examples. A prompt edit that fixes one complaint can quietly break five other behaviors. A framework gives every change the same examination, so you can improve on purpose.

PartMeaningExample
TaskOne situation with a goal"Cancel my order A1"
EnvironmentThe world the agent acts inSandbox with two open orders
TrialOne attempt at a taskRun 3 of 10
TraceWhat happened during a trialMessages, tool calls, timings
GraderJudges a trialIs only A1 canceled?
SuiteA group of tasks with a purposeOrder handling, policy refusals
GateThe decision ruleNo suite may fall by more than two points

Define success before measuring

Write criteria that two reasonable people would apply the same way. Cover what must happen, what must not happen and the limits.

DimensionExample criterion
OutcomeThe booking exists with the requested date and room
ConstraintsNo other booking changed; no spend without approval
GroundingStated facts match the tool results
CommunicationThe reply says what was done and what remains
EfficiencyWithin the step, time and cost budget

Offline and online evaluation

AspectOfflineOnline
DataCurated tasksReal use
TimingBefore releaseDuring operation
Ground truthKnown expected outcomesOften unknown; inferred or sampled
Risk to usersNoneReal, so limit exposure
Good atComparing versions, catching regressionsFinding new situations and real-world value
Weak atCases nobody thought to includeControlled comparison and rare harms
Offline suiteCompare candidate with current
GateShip, fix or reject
OnlineLimited rollout and monitoring
ReviewFailures become tasks
↺ Real failures make the offline suite more representative

Online methods

  • Shadow runs: the new version processes real requests, but its actions and replies are not used.
  • Canary release: a small share of traffic, with automatic rollback on bad signals.
  • Controlled experiment: compare versions on similar groups using outcomes that matter.
  • Sampled review: people grade a random sample, plus all high-risk and flagged cases.
  • User signals: corrections, repeat contacts, abandonment and explicit ratings, read with care.

Shadow runs need protection: replace anything that changes data with a stand-in, or the "unused" version will still act.

Who decides what good means

Engineers can build a harness, but they should not invent success criteria alone.

RoleContributes
Domain expertCorrect outcomes, important exceptions, hard cases
Product ownerWhich user tasks matter most and what trade-offs are acceptable
Risk or securityHard stops and required scenarios
EngineerHarness, graders, reproducibility and speed
Support and operationsReal failures and early warning signs

A good test of a criterion is disagreement: give three borderline examples to two reviewers separately. If their verdicts differ, rewrite the criterion before automating it.

Intermediate Tasks, graders and a gate

Task-based evaluation and outcome verification

Evaluate tasks, not isolated replies. An agent may say "Your order is canceled" while the system disagrees. Verify the outcome in the environment.

Task typeVerification
Change a recordQuery the record; check others are untouched
Write codeRun tests the agent could not alter
Answer from documentsCheck key facts and that citations support them
ResearchRubric for coverage and source quality; spot-check claims
Refuse or escalateConfirm nothing changed and the right route was offered

Choosing tasks

Start with a few dozen real or realistic cases drawn from requests, support records and past failures. Include easy, typical and hard ones, tasks where the right result is to do nothing, and each user group you serve. Anthropic's article on evaluating agents recommends building from real failures and distinguishes two kinds of suite:

Suite kindPurposeExpected pass rate
CapabilityShows what the agent cannot yet doStarts low; improvement is the goal
RegressionProtects what already worksClose to perfect; any drop matters

Anatomy of one task

Store tasks as data, so people can review them without reading harness code.

id: refuse-cancel-shipped
tags: [orders, policy]
start_state: order A3 has status "shipped"
user: "Please cancel order A3, I changed my mind."
pass_if:
  - order A3 is still "shipped"
  - no refund was created
  - reply explains the return process
must_not:
  - claim that the order was canceled
owner: support-lead
why: A past release told customers shipped orders were canceled

The why line saves a future colleague from deleting the task as redundant. The must_not list captures harms that an outcome check alone would miss.

Graders

GraderStrengthLimit
Code checkFast, repeatable, clearOnly for checkable properties
Reference comparisonUseful where a right answer existsCan reject valid alternatives
Model graderJudges meaning at scaleBias and variation; needs calibration
Human expertBest judgment of nuanceSlow, costly, can disagree

Grade separate dimensions separately. One blended score hides the case where answers became friendlier and less accurate.

A comparison with a release gate

This program compares two versions of a stand-in agent. Each task runs fifty times. The grader looks only at what changed, ignoring the agent's claim. Results are grouped by tag, with a confidence interval, and a gate blocks the release if any group falls by more than two points.

"""Run tasks several times, grade the end state, compare two versions."""
import math
import random

TASKS = [  # (id, tag, expected end state)
    ("cancel-1", "orders", {"A1": "canceled"}),
    ("cancel-2", "orders", {"A2": "canceled"}),
    ("refuse-1", "policy", {}),               # correct outcome: change nothing
    ("refuse-2", "policy", {}),
]


def agent(version, task_id, rng):
    """Stand-in for a real agent run. Returns (claim, changes made)."""
    order = "A" + task_id[-1]
    if task_id.startswith("cancel"):
        ok = rng.random() < {"v1": 0.80, "v2": 0.97}[version]
        return "Done.", {order: "canceled"} if ok else {}
    obeys = rng.random() < {"v1": 0.95, "v2": 0.75}[version]
    return "Handled.", {} if obeys else {order: "canceled"}


def wilson(passes, n, z=1.96):
    p = passes / n
    mid = p + z * z / (2 * n)
    half = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n))
    return (mid - half) / (1 + z * z / n), (mid + half) / (1 + z * z / n)


def evaluate(version, trials=50, seed=7):
    scores = {}
    for task_id, tag, expected in TASKS:
        for t in range(trials):
            rng = random.Random(f"{seed}-{task_id}-{t}")
            _claim, changes = agent(version, task_id, rng)
            passes, n = scores.get(tag, (0, 0))
            scores[tag] = (passes + (changes == expected), n + 1)
    return scores


base, new = evaluate("v1"), evaluate("v2")
total = lambda s: sum(p for p, _ in s.values()) / sum(n for _, n in s.values())
print(f"overall  v1 {total(base):.0%}   v2 {total(new):.0%}")
blocked = []
for tag in base:
    (bp, n), (np_, _) = base[tag], new[tag]
    low, high = wilson(np_, n)
    print(f"{tag:7}  v1 {bp / n:.0%}   v2 {np_ / n:.0%}  (v2 95% interval {low:.0%}-{high:.0%})")
    if np_ / n < bp / n - 0.02:
        blocked.append(tag)
print("release:", f"BLOCKED by {blocked}" if blocked else "allowed")

Output:

overall  v1 88%   v2 86%
orders   v1 81%   v2 99%  (v2 95% interval 95%-100%)
policy   v1 94%   v2 73%  (v2 95% interval 64%-81%)
release: BLOCKED by ['policy']

This is why averages mislead. The new version is far better at canceling orders, and the overall figure barely moves. Underneath, it has started making changes when it should refuse. A single average might have let that through; the per-tag gate stops it.

Reading the interval

The range printed next to a rate shows how uncertain it is with this many trials, treating trials as independent. Real trials that share tasks are not fully independent, so treat the range as optimistic. More distinct tasks usually help more than more repeats.

Read the failures

Scores tell you that something changed; traces tell you why. After each run, sort failures into causes before touching the agent.

CauseTypical action
Agent misunderstood the requestClarify instructions, or teach it to ask
Wrong or missing toolImprove the tool set or descriptions
Missing informationFix retrieval or context assembly
Broke a ruleEnforce it in code
Task is ambiguous or wrongFix the task
Grader errorFix the grader and rescore old results
Environment faultRepair the sandbox; do not count it either way

The largest group is the next piece of work. Rows for task and grader errors are normal early on, and ignoring them teaches the team to distrust the whole system.

Expert Architecture and judgment

Reference architecture

DatasetsVersioned tasks, expected outcomes, tags, owners
RunnerSelects suite, runs trials in parallel within a budget
SandboxesFresh state per trial; fakes for outside effects
GradersCode, model and human review over traces and final state
Results storeScores linked to agent, model, prompt, tool and data versions
DecisionsRelease gate, comparisons, trends, failure queue

Record enough to reproduce

For every result keep the code revision, model name and settings, prompt and tool versions, dataset version, environment seed, grader version and the trace. Without these, a score from last month cannot be compared with today's.

Designing the gate

RuleExample
Hard stopsAny unauthorized action blocks release
Per-group floorsEach critical suite stays above its minimum
No significant regressionCompared task by task with the current version
BudgetCost and slow-end latency within agreed limits
WaiversNamed person, reason and expiry date

Compare versions on the same tasks and look at which tasks flipped from pass to fail. A paired view is more informative than two totals, and reading those flipped traces is usually the fastest route to a fix.

Combining trials honestly

Decide in advance how several trials of one task count. For a helpful suggestion, "succeeds in at least one of five attempts" may describe a workflow where a person picks the best. For an action taken automatically, what matters is that it succeeds every time, so report the share of tasks passing all trials. The two figures can differ widely for the same agent. State which one each gate uses.

Can you trust the evaluation?

  • Run a known-good and a known-bad agent; the scores should separate clearly.
  • Read a sample of passes as well as failures. Graders are often too generous.
  • Check that the agent cannot see expected answers or edit the checks.
  • Calibrate model graders against human labels and repeat after changing the grader.
  • Refresh tasks; repeated tuning against a fixed set inflates scores.
  • Keep a held-back set you rarely look at.

Public benchmarks help compare models and ideas, but they are not your tasks, data or rules: see Agent Benchmarks and Datasets.

Managing cost and time

Run small, fast suites on every change and the full set before release. Use code graders first and model graders only where needed. Cache environment setup, but never cache the behavior under test. Track the evaluation bill as a normal operating cost.

Expert tip

Give every task an owner and a sentence explaining why it exists. A suite nobody understands gets ignored the first time it blocks a release.

What to watch online

Real traffic rarely comes with correct answers attached, so combine several imperfect signals and check them against each other.

SignalWhat it may showHow it can mislead
Task completion in the system of recordWork actually got doneDone does not mean done correctly
Reopened or repeated requestsThe first answer failedSome users simply leave instead
Human corrections and overridesWhere judgment differsReviewers may approve without reading
Escalation rateLimits of the agentA low rate can mean it should escalate and does not
Explicit ratingsUser satisfactionFew and unrepresentative responses
Sampled expert gradingQuality on real casesSmall samples miss rare harms

Compare online grades with offline scores for the same version. A wide gap suggests the suite no longer resembles real use. Handle real conversations according to your privacy rules before adding them to any dataset, and remove personal details that the test does not need.

Rare and severe harms

Averages and samples are poor at finding events that happen once in many thousands of runs. Cover those with targeted adversarial tasks, hard limits in code and alerts on the action itself, for instance any transfer above a threshold. Evaluation reduces uncertainty; it does not replace controls.

A two-week starting plan

  1. Write success criteria for the three most important user tasks.
  2. Collect twenty to fifty cases, including refusals and past failures.
  3. Build a resettable sandbox and code graders for outcomes.
  4. Run the current version to set a baseline and read every failure.
  5. Agree a gate with the people who own the risk.
  6. Run it on the next change, then add sampled online review.

Framework checklist

  • Success and failure are defined per task
  • Outcomes are verified in the environment
  • Tasks include cases where doing nothing is correct
  • Results are reported by group with trial counts
  • Versions of everything are recorded
  • Gates have hard stops and accountable waivers
  • Production failures flow back into the suite

Frequently asked questions

How many tasks do I need?

Enough to cover your important situations and to detect the size of change you care about. A few dozen good ones are far better than none; grow from real failures.

Should I buy an evaluation platform?

A platform can help with running, storage and review. It cannot decide what success means for your tasks, which is the harder part.

Can the agent's own model grade it?

It can, with care, but it may favor its own style. Calibrate against people and consider a different grader.

What if the gate blocks a clearly useful change?

Fix the regression, or record a time-limited waiver with the risk owner. Do not quietly lower the threshold.

References and further reading

Next steps