12 min
How to build an agent evaluation framework for multi-step AI agents
Learn how to build an agent evaluation framework with clean isolated runs, layered graders, and CI gates for tool-using AI agents.

An agent can pass a task once and fail it on the next try. A single-response LLM eval grades one answer and misses that variance. An agent evaluation framework is a repeatable harness for testing multi-step, tool-using AI agents.
It runs a fixed task set in clean, isolated environments. Graders score the end state and the path the agent took. Repeated runs give your team a release decision it can defend with numbers.
Key takeaways
- Grade the trajectory and the end state as well as the final reply.
- Run code-based checks first, then calibrated LLM judges, then human review on a sample.
- Give every run a fresh, isolated environment so no state leaks between trials.
- Repeat runs per task and report pass^k to capture run-to-run variance.
- Gate releases in CI and keep scoring sampled production traces.
Why AI agent evaluation differs from single-response LLM evals
A single-response eval for a large language model (LLM) grades one answer to one prompt. Agent runs need a wider harness. Agents "use tools across many turns, modifying state in the environment and adapting as they go,".
Each agent property adds a requirement to the harness:
- Multi-step trajectories: An early wrong step corrupts later ones, and an output-only score can't locate that step.
- Tool calls: The agent must pick the right tool, build valid arguments, and recover from tool errors.
- Side effects: Tools change real state. A test against live services can send real emails or issue real refunds.
- Nondeterminism: One run per task can't measure run-to-run variance.
HumanEval grades one code completion against unit tests. By contrast, a computer-use agent clicks, types, and edits files across many steps. Grading it means following the whole trajectory. Check which of these properties your agent has before writing graders.
How to build an agent evaluation framework
Building a robust evaluation framework for multi-step AI agents requires a structured approach.
Understand the agentic evaluation components
Every agent evaluation framework rests on the same building blocks:
| Component | Role | Example |
|---|---|---|
| Task set | Defines the work and what counts as success | A few dozen tasks drawn from real failures |
| Environment | Gives each run tools, data, and a starting state | A fresh, isolated environment per trial |
| Graders | Score outcomes, trajectories, and side effects | Unit tests, state diffs, a rubric-based LLM judge, a human-reviewed sample |
| Metrics | Turn grades into comparable numbers | Task success, pass^k, tool errors, cost per run |
| Reporting | Shows deltas, variance, and failing traces | A CI comment with score change and confidence interval |
Define success for each task
Each task needs a goal, a checkable success criterion, the allowed tools, and the side effects to verify. "Fix the customer's billing problem" is a goal no grader can score. "Refund the disputed charge, send one confirmation email, and change nothing else" is checkable.
Anchor success to the end state where you can. In τ-bench, the grader compares the final database state with an annotated goal state. End-state checks also worked for Anthropic's multi-agent research team, which favored them over turn-by-turn analysis.
For long workflows, the team breaks evaluation into checkpoints where specific state changes should have occurred.
End state alone misses policy violations. A passing reward "might be a necessary but not sufficient condition" for a good episode, the τ-bench authors write. Their example is an agent issuing a return without explicit user confirmation.
Add policy checks next to the state check: required confirmations, forbidden tools, and step or spend limits. Use one test for ambiguity. If two engineers would grade the same run differently, rewrite the task before it enters the suite.
Build a task set from real traces and edge cases
Seed the golden set (the fixed tasks every version runs) from failures you've already seen. A set of 20 to 50 simple tasks drawn from real failures is "a great start," according to Anthropic's guide. Teams don't need hundreds of tasks at the start.
Pull candidates from production traces, bug reports, and support tickets.
Grow the set deliberately. Langfuse's golden dataset guide suggests growing toward 100 to 1000 items for a full regression set. For CI gates on each pull request (PR), it recommends tens to low hundreds of items. Its coverage rule is that "100 diverse items beat 1000 near-duplicates."
Add adversarial cases from day one, starting with prompt injection. AgentDojo has 97 tasks and 629 security test cases. It plants malicious instructions in tool outputs such as emails and web pages. A security function then checks whether the attacker's goal was executed.
Copy that test design. Plant an instruction in a file the agent reads, then check state for the forbidden action. Keep a held-out slice of tasks that the team never tunes prompts against.
Give every run a clean, isolated environment
Shared state between runs corrupts scores without raising any error. On some tasks, Claude gained an unfair advantage by "examining the git history from previous trials," per Anthropic's guide.
Public benchmarks had the same leak. SWE-bench issue #465 documents agents running git log --all and reading the future fix. Cursor ran a reward-hacking audit on SWE-bench Pro. Sealing git history and restricting internet access dropped Opus 4.8 Max from 87.1% to 73.0%.
Resource settings move scores too. In Anthropic's Terminal-Bench experiment, infrastructure errors fell from 5.8% under strict limits to 0.5% uncapped. Without caps, success rose 6 percentage points with the same model and harness.
Leaderboard gaps under 3 points deserve skepticism until the configurations match.
A clean run has these properties:
- Fresh state: Each trial gets a new filesystem, memory, and process tree.
- Pinned inputs: Image digests, dependencies, and model versions stay fixed, and the harness strips future git history.
- Reset tools: Each trial restores databases and replaces external services with deterministic mocks, as OpenAI's eval guide advises.
- Fixed resources: Every compared version gets the same CPU, memory, and timeouts.
- Contained side effects: Outbound calls pass through an egress allowlist of approved destinations.
Enforcing these isolation properties ensures that benchmark results accurately reflect true model performance without state leakage or external interference.
Choose graders in the right order
Anthropic's guide advises using human graders "judiciously," deterministic graders where possible, and LLM graders where necessary. Order them by cost: code checks first, LLM judges second, and human review of a sample last.
- Code-based checks come first. Run the repository's tests, diff the database against the goal state, or match tool calls against an expected list. Keep trajectory matching loose. Agents often reach the goal by different valid paths. That makes exact tool-call sequence checks "overly brittle," per Anthropic.
- LLM judges cover what code can't, such as plan quality or explanation accuracy. Give the judge a rubric. LangChain's agent evaluation readiness checklist starts judge calibration with 20 or more labeled examples. The checklist also favors binary pass/fail verdicts over numeric scales.
Validate every judge against human labels. In the MT-Bench judge study, GPT-4 agreed with humans over 80% of the time, matching human-human agreement.
Judges still carry biases. Wang et al. found that swapping answer order can reverse GPT-4's verdict. Panickssery et al. report that GPT-4, GPT-3.5 Turbo, and Llama 2 favor their own summaries. Swap answer order, judge twice and pick a judge from a different model family than the agent.
Human review is the last tier. Each release cycle, reviewers relabel a sample of judged runs and track their agreement with the judge.
Track outcome, trajectory, cost and safety evals
Task success alone hides expensive or unsafe wins.
Track these metrics on every run:
| Metric | What it measures | Grader |
|---|---|---|
| Task success | End state matches the goal | Code: state check or tests |
| Tool selection and parameters | Right tool, valid arguments | Code against expected calls |
| Tool errors | Failed calls, retries, loops | Code over the trace |
| Trajectory quality | Wasted steps, plan adherence | LLM judge with rubric |
| Cost per run | Tokens and compute per trajectory | Code over trace and billing |
| Latency | Wall-clock time per task and step | Code |
| Safety violations | Injection success, forbidden actions | Code state check plus judge |
One task triggers many model and tool calls. Measure cost and latency across the whole trajectory. For tool selection, DeepEval's Tool Correctness metric scores 1 when every tool the agent called matches the expected tools.
Run evals in CI and on production samples
Run the regression suite on every change to prompts, tools, models, or harness code. Each eval gets an explicit threshold, and a drop below it fails the build. Post the score change, confidence interval, and failing traces as a comment on each pull request.
DeepEval scores run from 0 to 1 against a configurable threshold. Its CI documentation states that a failing assert_test fails the CI run.
A minimal GitHub Actions workflow looks like this:
YAML
name: agent-evals
on:
pull_request:
branches: [main]
jobs:
evals:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- run: pip install -U deepeval
- name: Run agent evals
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: deepeval test run test_agent.py
Inspect, the UK AI Security Institute's eval framework, can also fail an eval when too many samples error. Its error-handling docs show --fail-on-error=0.1, which marks the log as an error when more than 10% of samples errored.
After release, score sampled production traces. Live traffic has no ground truth. For that reason, Braintrust's online scoring relies on LLM-as-a-judge scorers running asynchronously. Engineers then promote confirmed failures into the golden set.
Compare versions with repeated runs
A single run per task is weak evidence of quality. Some of the variation comes from the serving infrastructure itself. Thinking Machines Lab traced temperature-0 nondeterminism to kernels that lack batch invariance (their results shift with batch size). Output then depends on server load.
Report reliability alongside capability:
- pass@k measures capability by counting a task solved if any of k trials succeeds.
- pass^k, from τ-bench, measures reliability by requiring all k trials to succeed.
The τ-bench authors found gpt-4o at about 61% pass^1 on retail tasks, falling below 25% at pass^8. Anthropic's guide gives the arithmetic: a 75% per-trial rate yields 42.2% for three straight passes.
Compare versions on the same tasks with paired statistics. Miller computes per-question score differences between two models in his error bars paper. The paper finds clustered standard errors can run over 3x larger than naive ones when tasks come in related groups.
Anthropic's statistics write-up reports question-score correlations of 0.3 to 0.7 between frontier models. At that level of correlation, paired comparison is a "free" way to reduce variance.
For suites under a few hundred tasks, Bowyer et al. show that Central Limit Theorem intervals are too narrow. Miller's paper also advises adding trials until within-task variance is small relative to variance across tasks.
Leverage tools for running agent evals
Each of these frameworks covers part of the harness:
- OpenAI Evals: The open-source openai/evals repo offers a framework and a registry of evals. OpenAI retired its hosted Evals platform in November 2026. The Evals guide now points new users to Datasets.
- UK AISI Inspect: It provides solvers, scorers, and a built-in
react()agent. It also offers Docker sandbox support. Extensions add Kubernetes, Modal, Daytona, and Proxmox sandboxes. - DeepEval: It runs pytest-style agent evals, including Task Completion, Step Efficiency, and Plan Adherence.
- Braintrust: It records experiments and scores sampled production traces. It also runs experiments in CI.
- LangSmith: Its trajectory evals use a trajectory match or an LLM judge. Match modes are strict, unordered, subset, and superset.
Selecting the right combination of these evaluation frameworks allows teams to automate trajectory testing and maintain high agent quality across releases.
Explore public agent benchmarks as design patterns
Public benchmarks show how to build tasks, environments, and graders. They don't measure your agent on your work. Several changed in 2026. Check versions before borrowing a pattern. Each entry reflects the benchmark as of November 2026.
For leaderboard scores, see the LLM coding benchmarks guide:
- SWE-bench Verified: It has 500 human-validated tasks. FAIL_TO_PASS and PASS_TO_PASS tests grade them in Docker. On February 23, 2026, OpenAI said it had stopped reporting its scores, calling the benchmark "increasingly contaminated."
- Terminal-Bench: Each task ships
instruction.md,environment/Dockerfile, andtests/test.sh, and runs in the Harbor eval framework. Terminal-Bench 4.1 runs agent code as an untrusted user during verification. - OSWorld: The original suite has 369 tasks in virtual machines with execution-based evaluation scripts. OSWorld-Verified followed in July 2025 with fixes to reported task issues.
- τ-bench: An LLM simulates the user. Scores from τ-bench 2.0 aren't comparable with the 1.x leaderboard.
Studying the design patterns of these established public benchmarks provides valuable architectural blueprints when designing custom domain-specific evaluations.
Where Baseten Sandboxes fit in an eval harness
Of the seven steps, run isolation depends most on infrastructure. A reused machine can leak git history and files between trials. Baseten Sandboxes give each eval run its own sandbox, created in under a second. Each sandbox is a separate Firecracker microVM (a lightweight virtual machine), so runs don't share state.
Long trajectories often pause, for example, while a coding agent waits on CI. Standby starts after about 15 seconds of network inactivity, and resume takes under 25ms. Resume within a run, and create a fresh sandbox for every new trial.
Isolation alone won't stop an agent from calling a live API. Limit outbound calls to an egress allowlist and stub the remaining services. Start with one golden-set task and run five trials, each in a new Baseten Sandbox. Then confirm that no trial can read another's files.
FAQs about agent evaluation
How many tasks do you need to start evaluating an agent?
Start with 20 to 50 simple tasks based on failures your agent has already had, as Anthropic's evals guide suggests. For a full regression set, Langfuse's guide suggests working up to 100 to 1000 items. Per-PR gates can run a subset of tens to low hundreds. Favor diverse tasks over near-duplicates.
Should you grade the outcome or the full trajectory?
Grade the outcome first, using the end state, such as database rows or passing tests. Exact tool-call sequence checks break whenever the agent finds another valid path. Grade the trajectory when the path itself carries risk. Examples include required user confirmations, forbidden tools, wasted steps, or runaway cost.
How do you validate an LLM judge?
Label 20 or more runs by hand, the starting size in LangChain's checklist. Then measure how often the judge agrees with those labels. Check for position bias, where the verdict depends on answer order, by swapping the order and judging twice. Avoid judging the agent with a model from its own family. Repeat the agreement test after any change to the judge's prompt or model.
How do you measure agent reliability across repeated runs?
Run each task several times and report pass^k, the chance that all k trials succeed. Compare versions on the same tasks with paired differences, and report confidence intervals. Small suites need intervals that don't rely on the Central Limit Theorem.
How do you keep evaluating an agent after deployment?
Score a sample of production traces with online evaluators. Because production traffic has no reference answers, these evaluators use LLM judges with rubrics. Route failing traces to human review. Add confirmed failures to the golden set, which grows the CI regression suite from real incidents.
Related articles

Guides
How AI browser automation agents work, and when to use them
Learn how a browser automation agent reads pages and picks actions. Compare agents with scripts and RPA.
14 min read

Guides
A guide to OpenAI Codex Cloud: Features, limits, and alternatives
Learn how OpenAI Codex Cloud runs repository tasks and which ChatGPT plans include it.
12 min read

Guides
How Kata Containers uses lightweight VMs to isolate containers
Learn how Kata Containers isolates each Kubernetes pod in a lightweight VM.
12 min read