AI Infra
0%
Part VII · Chapter 52

Evaluating Agents and Capabilities

AuthorChangkun Ou
Reading time~15 min

An agent does not merely produce an answer. It observes an environment, chooses actions, calls tools, and changes state. Evaluating one therefore requires more than reading its final message. The evaluation must run the complete system in a controlled environment and check what actually happened.

This distinction is easy to miss. An agent may say that it issued a refund while the customer database remains unchanged. It may produce a working patch after reading a secret test file. It may reach the correct page while violating an identity check that the policy required first. The final sentence is evidence about what the agent claims. The environment state and retained action log are evidence about what it did.

A reliable evaluation follows one rule:

Evaluate the versioned system, verify the resulting state, and inspect the trajectory only where the task imposes genuine process constraints.

2026-06-21T21:26:57.043855 image/svg+xml Matplotlib v3.11.0, https://matplotlib.org/
Figure 52.1. Longer tasks create more opportunities for failure. The curves are an idealized illustration: even a high probability of completing each stage can produce a much lower probability of completing the whole trajectory.

From episodic return to tool-using agents

The underlying measurement problem predates language models. Reinforcement learning formalized an agent as a policy interacting with an environment over an episode, with performance measured from the rewards produced by that interaction (Sutton and Barto 2018). Modern language-model agents preserve the episode but replace a compact simulator with browsers, repositories, databases, APIs, and human conversations. The difficult part is no longer merely collecting a numeric reward. It is specifying which real-world state counts as success, recreating the starting state, and distinguishing an agent error from a broken tool or evaluator.

Agent benchmarks made that shift explicit. AgentBench combined several interactive environments (Liu et al. 2024). WebArena used self-hosted websites and functional task checks (Zhou et al. 2024). SWE-bench asked systems to edit a repository so that an issue-specific test harness passes (Jimenez et al. 2024). OSWorld configured real desktop states and evaluated the state left after GUI actions (Xie et al. 2024). GAIA instead used questions whose short answers may require browsing, files, code, or multimodal reasoning (Mialon et al. 2024). These benchmarks do not measure one interchangeable quantity. They illustrate several ways to turn an interaction into checkable evidence.

Define the system under test

An agent score belongs to a configuration, not to model weights alone. At minimum, the configuration includes:

  • the model revision, serving route, decoding settings, and reasoning budget;
  • the system prompt, tool descriptions, orchestration loop, and context policy;
  • the tool implementations, credentials, permissions, and network policy;
  • the sandbox image, dependency versions, initial data, and reset procedure;
  • the task, simulated user if any, time or turn budget, and grader revision.

The first two groups are the model and Chapter 41. The others determine what the system can observe and change. A new prompt, browser controller, context compactor, or timeout can move the score without any change to the model. Report such a result as a system result. A model comparison is justified only when the remaining configuration is held fixed, and even then the fixed harness may favor one model's API conventions over another's. Controlled model-harness pairings in Harness-Bench demonstrate why the configuration, rather than either component in isolation, is the defensible unit of reporting (Yao et al. 2026).

A useful task contract makes the condition executable:

AgentTask:
  task_id, task_revision, source, slice_labels
  initial_state_fixture, reset_check
  user_request, available_tools, permissions
  hard_process_constraints
  terminal_conditions, step_limit, time_limit
  outcome_assertions, partial_credit_rubric
  grader_revision, grader_test_manifest

AgentRun:
  task_id, system_spec_hash, attempt, seed
  initial_state_hash, observation_action_log
  final_state_hash, terminal_reason
  outcome_assertion_results, constraint_results
  partial_score, cost, latency
  infrastructure_status, artifact_locations

This record separates the task definition from one stochastic attempt. It also prevents silent changes to the environment or grader from masquerading as model progress.

A simulated user is part of the instrument, not neutral background. Its model, prompt, persona, available information, and stopping behavior can change the conversation and therefore the score. Pin those choices, sample production-like variation, and compare a subset of simulated interactions with representative humans before using the result as evidence about human-agent interaction.

Score state and constraints separately

Let one run on task ii produce the trajectory

τir=(s0,o0,a1,o1,,aT,sT).\tau_{ir}=(s_0,o_0,a_1,o_1,\ldots,a_T,s_T).

Here ii identifies the task; rr identifies a repeated attempt; s0s_0 and sTs_T are the initial and final environment states; oto_t is the observation available at step tt; ata_t is the action chosen after that observation; and TT is the step at which the run terminates. The exact state may not be visible to the agent. It must still be visible to the evaluator wherever the evaluator claims to verify it.

Define Gi(s0,sT){0,1}G_i(s_0,s_T)\in\{0,1\} as the task's outcome check. For a refund task, it might verify a new database record, the correct amount, and the expected account balance. Let Cij(τir){0,1}C_{ij}(\tau_{ir})\in\{0,1\} check hard process constraint jj, such as obtaining authorization before issuing the refund. If task ii has JiJ_i hard constraints, required success is

Yir=Gi(s0,sT)j=1JiCij(τir).Y_{ir}=G_i(s_0,s_T)\prod_{j=1}^{J_i} C_{ij}(\tau_{ir}).

YirY_{ir} represents required success and is one only when the outcome and every hard constraint pass. When Ji=0J_i=0, the empty product is one, so success depends only on the outcome. This formulation does not require the agent to follow an author's preferred route. It checks the final state and only those intermediate facts that are part of the real requirement.

The distinction matters:

Signal Appropriate use Common mistake
Final environment state Functional completion Trusting the agent's narration instead
Hard trajectory constraints Authorization, safety, ordering, prohibited actions Requiring one canonical sequence of valid actions
Partial-credit rubric Progress on a genuinely decomposable task Awarding points for verbose plans that changed nothing
Cost, latency, and steps Efficiency, usually conditional on validity Calling a cheap failure efficient
Transcript and tool trace Diagnosis and audit Treating plausible reasoning as proof of completion

Outcome checks should normally be independent of the agent's output channel. Read the database through an evaluator credential, run tests from a clean checkout, or query the browser backend. When only a model judge can assess the artifact, apply the validation and confirmation discipline of Chapter 50. A model grading another model is not an independent state check merely because it receives a different prompt.

I Verified initial fixture R Versioned agent run I->R S Final-state assertions R->S state C Declared trace constraints S->C trace O Outcome + audit record C->O
Figure 52.2. An agent run begins from a verified fixture. The evaluator checks final state for completion, checks the trace only for declared constraints, and retains both results with the run artifacts.

Make every task valid and resettable

A runnable task is not automatically a valid task. Before using a case, verify four things.

First, the request must be solvable from the information and permissions given. Have a competent human complete it from the same initial state, under the same policy and budget where practical. Second, the outcome checks must accept more than the reference path. Tests should describe required behavior, not reproduce the original developer's patch. Third, known bad solutions must fail. Seed wrong-account refunds, incomplete patches, forbidden actions, and superficially correct final messages. Fourth, the reset must restore every state the next run can observe, including database rows, files, browser sessions, clock-dependent data, rate limits, and caches.

SWE-bench provides a useful warning. Its original tasks paired real issues with repository tests, but professional review later found cases with underspecified issues or inappropriate tests and produced a 500-case Verified subset (OpenAI 2024). A later audit still found material problems among frequently failed Verified cases (OpenAI 2026). Executable grading did not fail as an idea. The audits instead show that a grader is software and needs tests, versioning, and continuing review like any other critical component.

Long tasks often need partial credit, but the rubric must describe observable work. PaperBench decomposed research replication into a hierarchy of gradable requirements and separately evaluated its automated judge (Starace et al. 2025). That pattern is useful beyond research: preserve the binary end-to-end completion rate, add component scores for diagnosis, and validate the component grader. Do not replace the difficult end-to-end result with an easier average of milestones.

Separate agent failures from evaluation failures

Every run needs a terminal reason, not just a zero. A practical taxonomy is:

  • success: the outcome and all hard constraints pass;
  • agent failure: the agent stops, times out, takes a prohibited action, or leaves an incorrect state while the evaluation machinery remains healthy;
  • harness compatibility failure: the chosen model cannot use the harness or tool protocol as configured;
  • environment failure: a service, dependency, network route, or reset is broken independently of the agent's decisions;
  • grader failure: the run completes but the evaluator crashes, cannot read the state, or produces an indeterminate verdict.

These categories support different decisions. Agent failures count against the tested system. Environment and grader failures usually produce invalid attempts that are rerun after repair, with their rates reported. Compatibility failures belong to the system configuration and should not disappear; they show that the pairing cannot perform the task as deployed.

Predeclare the policy. Otherwise a team can inflate a score by relabeling weak runs as infrastructure problems after reading the trace. Retain service logs and health probes that justify each exclusion. Run a cheap smoke task before an expensive batch, and fail the batch when reset checks or canary assertions fail.

One attempt is not reliability

Agents are stochastic and interactive. The same configuration can take a new path on each attempt, while a simulated user or mutable service adds further variation. Let

pi=PrR(Yir=1)p_i=\Pr_R(Y_{ir}=1)

be task ii's probability of required success under the declared run distribution RR. Here YirY_{ir} is the binary result defined above, and RR includes the production-like randomness in decoding, users, tools, and environment conditions. Under independent attempts with the same pip_i,

pass@ki=1(1pi)k.\operatorname{pass@}k_i = 1-(1-p_i)^k.

passik=pik.\operatorname{pass}^k_i = p_i^k.

The first quantity is pass@k, the probability of at least one success in kk attempts. It measures whether the system can succeed when retries are allowed. The second is the probability that all kk attempts succeed. It measures repeated reliability. kk is the number of attempts; neither metric creates new tasks. τ\tau-bench introduced passk^k while evaluating tool-using agents in dynamic conversations and checking final database state against an annotated goal (Yao et al. 2025).

Set a per-attempt success probability and inspect how the two questions diverge.

import numpy as np
import matplotlib.pyplot as plt

p = 0.6
k = np.arange(1, 11)
at_least_one = 1 - (1 - p) ** k
every_attempt = p ** k

plt.figure(figsize=(5, 3))
plt.plot(k, at_least_one, "o-", label="pass@k: at least one")
plt.plot(k, every_attempt, "s-", label="pass^k: every attempt")
plt.xlabel("attempts, k")
plt.ylabel("probability")
plt.ylim(0, 1)
plt.legend()
plt.tight_layout()
plt.show()

The closed forms assume independent, identically distributed attempts and known pip_i. Real evaluations estimate pip_i from few repetitions, and failures may be correlated through shared services or user simulators. With nn valid attempts and cic_i observed successes for task ii, the first finite-sample formula below estimates at least one success, while the second estimates kk successes. These are the task estimators used by τ\tau-bench.

pass@k^i=1(ncik)(nk).\widehat{\operatorname{pass@}k}_i =1-\frac{\binom{n-c_i}{k}}{\binom{n}{k}}.

passk^i=(cik)(nk),kn.\widehat{\operatorname{pass}^k}_i =\frac{\binom{c_i}{k}}{\binom{n}{k}}, \quad k\le n.

Here (ak)\binom{a}{k} counts the subsets of kk attempts chosen from aa attempts. Average these task-level estimates with the suite's declared task weights. Keep repetitions nested inside tasks, report the number of valid attempts, and use the paired and cluster-aware methods of Chapter 48. Do not compute passk^k by raising a pooled suite accuracy to the kkth power when tasks have different success probabilities.

Reliability also changes with task horizon. More steps create more places for tool, planning, context, and recovery failures. A suite should therefore report success by meaningful length or difficulty slices rather than allowing many short tasks to hide collapse on longer work. Length is not a causal explanation, however: tool quality, observability, and task composition can change with it.

Use traces for diagnosis, not retrospective storytelling

Once outcomes are scored, traces can locate where the system failed. Preserve observations, tool requests and responses, state-changing events, model usage, terminal reason, and grader evidence. Then apply a fixed failure taxonomy such as perception, planning, tool selection, invalid arguments, policy violation, state verification, or recovery.

Do not assign a root cause from the final outcome alone. A missing refund can come from a planning error, an API rejection, an expired credential, or a grader reading the wrong database. Sample failures for independent adjudication, allow multiple contributing labels, measure agreement on the labels, and turn confirmed evaluator defects into regression tests. The purpose of the trace is to improve the system and its measurement, not to rescue a preferred score with a persuasive post-hoc explanation.

The operating contract

A release-grade agent evaluation can be summarized as nine commitments:

  1. Name the deployment decision and target task population.
  2. Version the model, harness, tools, permissions, environment, budgets, user simulator, and grader as one system specification.
  3. Prove that each task is solvable and that its reset restores a checked initial state.
  4. Verify completion from environment state; use the trace only for declared constraints and diagnosis.
  5. Test the grader with known successes, known failures, and adversarial near misses.
  6. Predeclare terminal reasons, invalid-run handling, retry rules, and partial credit.
  7. Repeat stochastic tasks and report both capability and reliability metrics with their denominators and uncertainty.
  8. Retain per-run artifacts so every aggregate can be reconstructed.
  9. Keep a locked confirmation suite and carry validated production failures back as regression cases, following Chapter 53.
What's contested

Outcome-only grading is robust to valid, unexpected strategies but can accept a lucky or unsafe route. Dense process grading exposes how a run unfolded but can penalize legitimate strategies and encode the evaluator author's assumptions. Expert annotations of web-agent trajectories show both sides of this problem: rule-based graders miss valid outcomes, while model judges can be misled by an agent's incorrect reasoning (Lù et al. 2025). The defensible default is neither extreme: verify required outcomes, declare hard process constraints narrowly, and use richer trajectory labels for diagnosis unless they have been validated as part of the target construct.

Lower-layer constraint

The evaluation cannot observe state that the execution layer does not expose. If a sandbox records only the agent's text, no later judge can prove which files, credentials, network calls, or database rows changed. The logging, isolation, reset, and identity guarantees of Chapter 41 therefore set the ceiling on what this chapter can measure. Evaluation design begins one layer below the grader.

Further reading

  • Sutton, Richard S.; Barto, Andrew G.. Reinforcement Learning: An Introduction. The MIT Press, 2018. mitpress.mit.edu
    Sutton and Barto formalize an agent as a policy interacting with an environment over time and develop return-based evaluation for episodic and continuing tasks.
  • Liu et al., “AgentBench: Evaluating LLMs as Agents,” 2024. proceedings.iclr.cc
    AgentBench evaluates language-model agents across eight interactive environments, making multi-turn decisions and environment interaction the object of evaluation.
  • Zhou et al., “WebArena: A Realistic Web Environment for Building Autonomous Agents,” 2024. proceedings.iclr.cc
    WebArena provides self-hosted functional websites and long-horizon tasks evaluated for functional correctness, allowing different valid action paths to reach the same goal.
  • Jimenez et al., “SWE-bench: Can Language Models Resolve Real-World GitHub Issues?,” 2024. proceedings.iclr.cc
    SWE-bench places a repository at a pre-fix commit, asks a system to resolve a real issue, and evaluates the resulting patch with executable tests.
  • Xie et al., “OSWorld: Benchmarking Multimodal Agents for Open-Ended Tasks in Real Computer Environments,” 2024. proceedings.neurips.cc
    OSWorld defines desktop tasks with explicit initial-state setup and custom execution-based evaluators across web, file, command-line, and application workflows.
  • Mialon et al., “GAIA: A Benchmark for General AI Assistants,” 2024. proceedings.iclr.cc
    GAIA evaluates assistants on human-authored questions that may require browsing, files, code, multimodal interpretation, and tool use before producing a short verifiable answer.
  • Yao et al., “τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains,” 2025. arXiv:2406.12045
    Tau-bench evaluates conversations between a tool-using agent and a simulated user, compares final database state with an annotated goal, and introduces pass-to-the-k for repeated reliability.
  • Starace et al., “PaperBench: Evaluating AI's Ability to Replicate AI Research,” 2025. arXiv:2504.01848
    PaperBench decomposes long research-replication tasks into hierarchical rubric items and evaluates the automated judge on a separate judge benchmark.
  • Yao et al., “Harness-Bench: Measuring Harness Effects across Models in Realistic Agent Workflows,” 2026. arXiv:2605.27922
    Harness-Bench compares model and harness pairings under fixed task, sandbox, budget, timeout, and evaluator conditions, treating configuration-level performance as the measured object.
  • Lù et al., “AgentRewardBench: Evaluating Automatic Evaluations of Web Agent Trajectories,” 2025. arXiv:2504.08942
    AgentRewardBench compares rule-based and model-based trajectory evaluators with expert labels for success, side effects, and repetition, exposing complementary grader failure modes.

Comments

Log in to comment