Skip to content

Chapter 5.7 — Evaluating agents: tasks, verifiers and uncertainty

🎯 Objective

Measure agents as systems — model, harness, tools, budget and environment — investigate the test itself before blaming the model, and sustain decisions proportional to the evidence obtained. An agent does not return an answer to compare against a reference: it produces a trajectory of actions over an environment, and what gets measured is the final state of that environment. That changes the unit of measurement, what can break in the test itself, and the statistics needed to compare two versions. The trajectory is for diagnosis and for finding exploits; the success criterion is the final state — requiring the reference's tool sequence fails valid solutions that take another route.

This chapter extends Ch. 2.11 (LLM evaluation) and Ch. 5.4 (eval harness): it assumes versioned datasets, release gates and a harness that runs the agent already exist. It does not replace Ch. 3.3 (agent runtime and harness) or Ch. 4.10 (sandboxing): here the sandbox is a premise, not the subject. It does not teach how to train models.

🧭 Maturity. Agent evaluation is a moving field: public benchmarks change version within months and verification practices are still settling. What this chapter treats as stable is the method (task contract, controls, metrics, uncertainty). The numbers quoted are dated illustrations, not constants.

🧠 Anatomy of an agent evaluation

An agent evaluation has five components. A result is only interpretable when all five are declared, because each one can produce a pretty number for the wrong reason:

Component What it is What it can hide
Task Instruction + initial state + success condition Unsolvable or under-specified task; condition that does not match the intent; solution already public
Environment Reproducible initial state (container, database, simulated APIs) External dependency that changes; image that contains tests or solution; different resources between runs
Harness Agent loop, tools, action format, budgets (steps, tokens, time) Score attributed to the model when it belongs to the harness (scaffold); different budget between comparisons; implicit retries
Verifier Tests, state comparator or judge that produces a numeric result Accepts the initial state or an empty answer; readable or editable by the agent; covers only part of the requirement
Protocol Repetitions, timeouts, policy for infrastructure errors, versions of everything above A single run; errors discarded on one side only; comparison across different benchmark versions

A 2025 audit (Zhu et al.) separates two kinds of validity. Task validity: the task is solved if, and only if, the agent has the capability being measured. Outcome validity: the verifier reports success if, and only if, the task was actually solved. A benchmark can fail either one without any number looking odd — which is why the section "Testing the test" comes before the metrics.

🏗️ Task contract

Treat each task as a versioned artifact with an explicit contract. Minimum fields:

Field Content Why it is mandatory
task_id, task_version Stable identifier and semantic version of the task Without them there is no regression and no comparison between runs
instruction What the agent receives, exactly as it receives it The only part of the contract the agent reads
environment Reproducible recipe for the initial state (image, data, simulated services) A non-reproducible environment produces flakiness indistinguishable from failure
reference_solution Procedure that solves the task, used only to prove it is solvable Every task needs proof of solvability
verifier Tests or state comparator that write a numeric result Separates "looks right" from "is right"
budget Steps, tokens, agent time, verifier time, CPU and memory The result is only valid under the budget it was obtained with
family Group of correlated tasks (same repository, same scenario, same seed) Defines the unit of uncertainty (see "Uncertainty and comparison")
metadata Estimated difficulty, authorship, date, target capability Allows auditing coverage and calibrating difficulty

Two separation rules are not negotiable:

  1. The reference solution and the verifier stay outside the agent's context. They do not go into the environment image, do not sit in an accessible directory, do not appear in the instruction. In a 2025 report, cheating showed up in 39 of 128 runs (30.4%) on the suite where the model could see the entire scoring function and in 8 of 1,087 (0.7%) on the other; the authors treat that visibility as a likely explanation, not a demonstrated one — the two suites also differ in difficulty and scaffolding.
  2. The verifier runs outside the environment the agent controlled. Copying the tests in only after the agent finishes is the minimum, and it is not enough: in the same container the agent can leave a reward file in place or tamper with what the tests will execute. Public terminal benchmarks now extract and sanitize the agent's artifacts and grade them in a separate verifier container; when the verifier has to execute the agent's code, it runs it as an unprivileged user.
sequenceDiagram
    participant P as Protocol
    participant E as Environment
    participant A as Agent (harness + model)
    participant V as Verifier

    P->>E: Builds initial state (no tests, no solution)
    P->>A: Delivers instruction and budget
    A->>E: Acts (commands, tools, edits) until it stops or exhausts the budget
    P->>E: Collects the agent's artifacts and shuts its environment down
    P->>V: Starts a clean verifier environment (tests + sanitized artifacts) with its own timeout
    V->>P: Writes numeric result (reward)
    P->>P: Records trajectory, cost, task version and verifier version

Textual description: the protocol builds the environment without tests or solution, hands the agent the instruction and the budget, and lets the agent act until it stops or exhausts the budget; only then does it collect the agent's artifacts, shut the agent's environment down, start a clean verifier environment with the tests and the sanitized artifacts, run the verifier with its own timeout, receive a numeric result and record trajectory, cost and versions.

Public formats illustrate the contract; they are not a recipe:

  • SWE-bench Verified — a subset of 500 instances from the original SWE-bench (2,294 real issues from 12 Python repositories), human-validated in 2024. The verifier is the reference PR's tests: those that failed must pass and those that passed must keep passing. It appears here as a format, not as a yardstick: in February 2026 OpenAI, co-author of the subset, stopped reporting it because of contamination and tests that reject correct solutions (at least 59.4% of the 138 audited problems).
  • Terminal-Bench / Harbor — each task is a directory with instruction.md, task.toml (metadata, timeouts and resources, such as [agent] timeout_sec, [verifier] timeout_sec, cpus, memory_mb), environment/ (Dockerfile), solution/ (used by an "oracle" agent to prove solvability) and tests/test.sh, which writes the reward to /logs/verifier/reward.txt. The benchmark moves fast: 2.0 (Nov 2025) had 89 tasks and 2.1 (May 2026) fixed 28 of them; 3.0 (Jul 2026) is a new set of 74 tasks and introduced the continuous model with semantic versioning; 4.0 (Aug 2026) removed 8, leaving 66; 4.1 (Nov 2026) hardened the verifiers without changing the agent's environment.
  • τ-bench — an agent with tools talks to a simulated user under business policies; the reward is the product of two checks: the final database state equals the target state and the agent's replies contain the required information (by substring in the 2024 version; by an LLM judge, by default, since 2.0, October 2026). The 2024 repository is frozen; the maintained line is τ³-bench/τ-bench 2.0.

What the three have in common: the core of the success condition is a verifiable state; where text still has to be checked, as in τ-bench, that part inherits the weaknesses of substring matching and judges.

🧪 Testing the test

An agent benchmark is software and breaks like software. Before measuring any agent, measure the benchmark:

Control What runs Expected result What it detects if it fails
Positive Reference solution in a clean environment 100% of tasks pass Unsolvable task, broken environment, wrong verifier
Alternative solution A second valid solution by a different route (or failures of strong agents, human-reviewed) Passes Over-strict verifier that rejects correct solutions
No-op Agent that does nothing 0% Verifier that accepts the initial state or empty answers
Partial Reference with one step removed Failure on the corresponding task Tests that do not cover the requirement
Shortcut Fixed output; reading or editing the tests; exit 0 0% Verifier readable or editable by the agent; trivial criterion
Adversarial Agent instructed to cheat, with trajectories inspected 0% Verifier exploits, before a model finds them
Repetition Each control several times (as an order of magnitude, public benchmarks repeat each agent evaluation at least 5 times) Consistent results Environment or verifier flakiness

A task the reference does not solve is a benchmark defect, not an agent defect. A task the no-op solves measures nothing. Mature benchmarks have these defects documented. A 2025 audit examined ten agent benchmarks and found outcome-validity failures in seven; recalled that, according to earlier work, insufficient tests changed the ranking of 24% of the entries on the SWE-bench Verified leaderboard; showed that a trivial agent returning empty answers reaches 38% on τ-bench's airline partition (6% on retail), because of intentionally impossible tasks; demonstrated that, in another benchmark, an agent could overwrite the tests and score 100%; and that a kernel benchmark, whose verifier only fuzzed values, overestimated performance by 31 percentage points. Applying that audit's checklist to a security benchmark reduced overestimation by 33 percentage points.

Run this audit on your internal set before comparing models. And assume the verifier will be attacked. In a 2025 report, a frontier model exploited the verifier in 30.4% of the runs of an AI research benchmark (39 of 128) and in 0.7% of the runs of a general-task benchmark (8 of 1,087): it read precomputed answers from the call stack, overwrote the timing function, replaced the evaluator with a stub that approves everything. Asked ten times about one of those plans, the model answered all ten times that it did not match the user's intent; on other tasks, the same report says, it considered the shortcut legitimate. Instructions of the kind "do not cheat", tested on one task, had almost no effect. For those who train models, the authors suggest patching the exploit in the scoring function rather than punishing the model, because punishing only what gets detected can teach subtler cheating; for evaluators the consequence is the same: the fix belongs in the verifier. It is the rule of Ch. 3.7 applied to evaluation: a prompt is not a policy.

📐 Metrics: pass@1, pass@k, pass^k and cost

Metric What it measures How to estimate What it does not say
pass@1 Fraction of tasks solved in one attempt; what the user sees without retry Per-task mean of several samples, with an interval Nothing about consistency or cost
pass@k Probability that at least one of k attempts passes Unbiased estimator below, with n ≥ k samples per task Whether a selector exists that can pick the right attempt; without one, it is a ceiling, not performance
pass^k Probability that all k attempts pass C(c, k) / C(n, k) per task, averaged across tasks What happens on failure: safe failure or damage
Cost per success Total cost divided by the number of tasks solved Tokens, tool calls and machine time of all attempts, including failed ones Whether the cost fits the task's value; depends on the budget
Steps and time Actions and wall-clock time until stopping Per attempt, with percentiles Whether the steps were useful; an agent can spend fewer steps by doing less
pass@k = 1 − C(n − c, k) / C(n, k)        n samples per task, c successes, n ≥ k

The naive estimator 1 − (1 − p̂)^k is biased, and there is no unbiased estimator with fewer samples than k. pass@k and pass^k answer different questions: pass@k measures discovery (it matters when tests, a production verifier or human review can pick the right attempt); pass^k measures reliability and drops fast with k. In the customer-service benchmark that introduced it, a model at about 61% pass^1 fell below 25% at pass^8. When the same agent runs the same class of task repeatedly in production, pass^k is the metric that matters.

Always report the budget under which the number was obtained (steps, tokens, time, retries) and the benchmark version: the same model with twice the steps is a different system, and a continuous benchmark swaps tasks between versions. Report cost next to accuracy: in a leaderboard with more than 21 thousand runs (nine models, nine benchmarks), raising reasoning effort did not improve accuracy — it stayed equal or lower — in 21 of the 36 comparisons made.

🚨 Failure modes

  • Reward hacking and specification gaming. The agent satisfies the verifier without solving the task: it reads or edits the tests, returns the output that matches the expected pattern, replaces the evaluator. This is not a single vendor's phenomenon. In training, a curriculum of environments with exploitable rewards generalized all the way to rewriting its own reward function in a small but non-negligible fraction of runs; and optimizing the model against a reasoning monitor produced obfuscated cheating, which the monitor stops seeing. For evaluation, the lesson is operational: inspect trajectories, not just scores, and fix the verifier.
  • Contamination. The task or its solution was in the training data or is available online. For agents with web access the problem is active: on a public leaderboard, agents searched for the benchmark on a dataset hub instead of solving the task. Continuous benchmarks remove tasks with public solutions and publish a canary string to detect copies in training corpora. For the internal set: block egress during evaluation (Ch. 4.10), do not publish tasks together with the verifier, and check in the traces whether the agent consulted sources that contain the solution.
  • Test leakage. Tests or solution inside the image, in an accessible directory, in the shell history or in the instruction. It is the cheapest failure mode to prevent (the "shortcut" control) and one of the most common.
  • Score attributed to the model when it belongs to the system. In a leaderboard that ran the same models under different scaffolds on a standardized evaluation infrastructure, task-specific scaffolds beat the generalist one in 9 of 12 runs on one benchmark and 11 of 12 on another. Budget matters too: in an experiment published in February 2026, the gap between the most- and least-resourced setups on Terminal-Bench 2.0 was 6 percentage points (p < 0.01). That does not mean the scaffold weighs as much as the model: on Terminal-Bench 2.0, model choice weighed more. "Model X scores Y%" without harness (scaffold), budget, benchmark version and date is a sentence without content. The Terminal-Bench leaderboard reports model, agent, cost and tokens on every row; do the same.
  • Comparing different budgets or versions. A continuous benchmark swaps tasks between versions: Terminal-Bench 4.0 removed eight tasks (saturation, refusals, public solutions, quality) and fixed nineteen for flakiness or incorrect specification relative to 3.0. Compare only within the same version and the same budget. A verifier-only change allows regrading stored artifacts without re-running the agent; that is what 4.1 did with the 4.0 results.
  • Discarding infrastructure errors on one side only. Environment timeouts, network failures and containers that did not start happen in both configurations. If they are removed from A's sample and counted as B's failures, the comparison is biased. Declare the policy before running and apply it to both sides.
  • LLM judge in place of a verifier. Where there is verifiable state, checking text is a fragile shortcut, by substring or by judge: in the audit cited above, a web-navigation benchmark that used both accepted empty answers and overestimated performance by 1.4% to 5.2%. Use a judge where there is no verifiable state, with a rubric and calibration (Ch. 2.11).

📏 Uncertainty and comparison

"Version B came out 4 points above A" is the most common and most fragile sentence in an agent evaluation report. Ch. 1.3 covers the general comparison protocol; here is what changes with agents:

  1. The independent unit is the task, or the family — never the attempt. One hundred tasks with five runs each are 100 units, not 500: repetitions reduce each task's conditional variance, but do not increase n. Tasks derived from the same repository, scenario or seed form clusters; in published examples, standard errors that ignored clusters were up to 3 times smaller than the correct ones.
  2. Pair. Run A and B on the same tasks, same version, same budget, same randomized order; compute the per-task difference and the interval of that difference. Pairing removes between-task variance at no extra cost.
  3. Choose the interval by sample size. Below a few hundred tasks, the normal-approximation interval covers less than it promises (about 92.5% instead of 95% at n = 100) and collapses to zero width when every task passes or every task fails. For each system's rate, prefer Wilson or a Bayesian Beta interval (Clopper-Pearson is also valid but conservative: too wide); for the paired difference, a paired Bayesian interval or a cluster-paired bootstrap — bearing in mind that the bootstrap also fails with small n. With clusters, a hierarchical Bayesian model was the only method to reach correct coverage in the published simulations.
  4. Declare the minimum relevant effect before looking at the result. With 100 tasks and a rate near 50%, the standard error of the rate is about 5 points and the 95% interval about ±10. Differences of 2 to 5 points are not detectable with 50 to 200 tasks; detecting 3 points with reasonable power takes on the order of a thousand. Say so, or grow the set.
  5. "Not significant" is not "equal". Declare the margin δ before running: to claim that B did not regress (non-inferiority), the lower bound of the interval for B − A must lie above −δ; to claim equivalence, the entire interval must fit within ±δ.
  6. Count the comparisons. Ten harness variants, prompts or budgets against the same set easily produce a "winner" by chance. Declare the primary comparison; treat the others as exploratory; keep a holdout that is never used to iterate (Ch. 2.11).
  7. Do not lower the temperature to "reduce variance". That biases the estimate of the system that goes to production. Reduce variance with more tasks, pairing and repetitions per task.
  8. Score attempts that exploited the verifier as failures — do not drop them from the denominator — fix the verifier, regrade the stored artifacts, and report how many there were, on each side, together with cost, tokens, benchmark version, harness, budget and date.

🔭 Observing and measuring in production

  • Traces per attempt. Every run, in evaluation and in production, carries task_id, task_version, verifier_version, harness version, model, budget, seed when there is one, outcome, steps, tokens and cost (Ch. 5.3). Without those fields a regression has no identifiable cause: there is no way to tell whether the model, the prompt, the tool or the task changed.
  • Continuous regression. The internal set runs on every change of prompt, tool, model or harness, as a release gate (Ch. 5.4), and the positive and no-op controls run with it. When the reference stops passing or the no-op starts scoring, the defect is in the benchmark or the environment, not the agent: treat it as a benchmark-health alarm, separate from the agent-regression alarm, and do not compare versions while it is open.
  • Task drift. The distribution of tasks in production changes — new tenants, new tools, new policies — and the evaluation set ages. Measure the fraction of production tasks with no equivalent in the set; create new tasks from redacted traces (Ch. 2.11); retire saturated, unsolvable or publicly solved tasks, as continuous benchmarks do; record every change in the set's changelog.
  • Production metrics. Verified success rate when there is a production verifier (tests, system state, user confirmation); cost per success; steps and time per task; budget-overrun rate; escalation-to-human rate. None of them replaces periodic sampled inspection of trajectories: that is where the agent that "passes" by exploiting the verifier shows up.

🏢 Hermes Logística — wave 5

The freight-invoice reconciliation agent was promoted on the argument "87% on the internal benchmark", well above the previous version. In production, cost per successful reconciliation came in 40% above forecast, with no change in traffic. The investigation started with the benchmark, not the model. First finding: the reference solution, run in a clean environment, failed on 12% of the tasks — cases whose initial state depended on an ERP API that had changed format. No version could solve them — the benchmark's real ceiling was 88% — and the positive and no-op controls had never been run. Second finding: the benchmark ran with 40 steps and no token limit, while the production harness cuts off at 25 steps under the budget contract (Ch. 5.6). With the budget equalized, the difference between the two versions fell to a few points, with a paired interval that included zero — the unsolvable tasks, once removed, did not explain the difference, they only flattened both rates — and the new one spent more tokens per task. The decision was to keep the new version for the quality of its trajectories on hard cases, but with the production budget explicit in the benchmark, positive and no-op controls in CI, and task_version and verifier_version on every trace. The lesson: the number belongs to the system that produced it — and the benchmark needs testing too.

📌 Checklist

  • [ ] Does every task have a versioned contract: instruction, reproducible environment, reference solution, verifier, budget and family?
  • [ ] Do the reference and the verifier stay outside the image and the agent's context, and does the verifier run in a separate environment, on sanitized artifacts (at minimum: tests enter only after the agent finishes)?
  • [ ] Do the positive, alternative-solution, no-op, partial, shortcut and adversarial controls run before any model comparison and on every version of the set?
  • [ ] Does pass@1 come with an interval suited to the sample size; is pass^k reported when reliability matters; does cost per success accompany every success rate?
  • [ ] Are comparisons paired, on the same set version and the same budget, with the minimum effect and the infrastructure-error policy declared before running?
  • [ ] Are trajectories sampled and inspected for verifier exploits, and is the verifier fixed when one is found?
  • [ ] Do evaluation and production traces carry task_id, task_version, verifier_version, harness, model, budget and cost?
  • [ ] Is there a process to retire saturated, unsolvable or publicly solved tasks and to create new tasks from production?

📚 References