AI Wiki中文/EN

Agent evaluation: what exactly did the agent get right?

智能体评测

Specify the environment, the success check and the trial protocol; compute pass@k and pass^k from repeated trials, keep tasks paired in uncertainty estimates, and audit checkers against trivial agents.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

Ninety percent of what?

A team wants to put an agent in front of customers to change orders. A vendor reports that its agent “solves 64% of tasks”; an in-house prototype solves 70%. Before choosing, the team needs to know what a task is, who decided that it was solved, how many times each task was run, and whether the same agent would succeed again tomorrow on the same request. A customer who gets a correct refund on Monday and a wrong one on Tuesday has not been served 50% well; the deployment has failed.

Agent evaluation differs from evaluating a single model output in three ways. The agent acts over many steps in an environment that changes state; there are usually several valid ways to reach the goal; and the agent, its tools and sometimes the simulated user are stochastic. A trustworthy evaluation therefore fixes the environment, defines success as a checkable property of the final state, repeats trials, and reports uncertainty over tasks.

This article uses three benchmarks as worked designs: SWE-bench for repository-level code changes checked by tests, SWE-bench WebArena for web tasks checked by answers and site state, WebArena and τ-bench for tool-using customer-service agents checked by database state and repeated trials. τ-bench The program is an original synthetic audit: tasks have hidden success probabilities and trials are coin flips. It calls no model, tool or website and says nothing about any real agent’s performance.

Environment, checker, trials and tasks

Freeze the environment. SWE-bench builds each task from a merged pull request in one of 12 popular Python repositories, starting from about 90,000 pull requests. A candidate must resolve an issue and change test files; it is kept only if applying the pull request turns at least one test from failing to passing and installation does not fail. 2,294 tasks remain. Each task pins the codebase to the pull request’s base commit. Construction WebArena hosts four working websites (shopping, a forum, collaborative development and content management) plus tools and knowledge resources in Docker containers, so that runs are reproducible rather than dependent on live sites. Environment τ-bench defines databases, API tools and written domain policies for retail and airline customer service, with 115 and 50 tasks respectively. Domains

Check outcomes, not paths. SWE-bench applies the agent’s patch with the Unix patch program and runs the task’s tests; a task is resolved only if the patch applies and all tests pass. Each task has at least one fail-to-pass test, 40% have at least two, and a median of 51 further tests check that existing behaviour still works. Evaluation and robustness WebArena compares textual answers with exact_match, must_include, or fuzzy_match, the last judged by gpt-4-0613, and checks site navigation or content changes with programmatic functions that locate the relevant database record, URL or page element. It argues this is more reliable than comparing action sequences and accommodates different valid paths. Evaluation annotation τ-bench defines an episode’s reward as a product:

r=raction×routput∈{0,1},r=r_{\mathrm{action}}\times r_{\mathrm{output}}\in\{0,1\},

where raction is 1 if the final database equals the unique annotated goal state and routput is 1 if the agent’s replies contain the required information. The authors state that r=1 can be necessary but not sufficient: an agent might process a return without the explicit user confirmation the policy requires. Reward

Include tasks a trivial agent should fail and tasks a careful agent should refuse. WebArena includes unachievable tasks whose correct answer is “N/A”, to test whether agents avoid unfounded claims. In its ablation, telling GPT-4 it may stop on impossible tasks led it to declare 54.9% of feasible tasks impossible; removing the hint raised overall success from 11.70% to 14.41% while reducing correct “N/A” answers from 77.78% to 44.44%. Results and analysis A useful habit is to run non-AI baselines through the checker before running any agent: an empty patch, an agent that always answers “N/A”, or a scripted policy that follows the happy path. Each score they obtain tells you what the checker rewards without competence.

Repeat trials and choose the reliability notion. τ-bench distinguishes pass@k, the chance that at least one of k independent trials succeeds, from pass^k, the chance that all k succeed, averaged over tasks. If a task is run n times with c successes, unbiased estimates are Metric definition

passk^=1T∑t=1T(ctk)(nk),pass@k^=1−1T∑t=1T(n−ctk)(nk),k≤n.\widehat{\mathrm{pass}^k}=\frac1T\sum_{t=1}^{T}\frac{\binom{c_t}{k}}{\binom{n}{k}},\qquad \widehat{\mathrm{pass@}k}=1-\frac1T\sum_{t=1}^{T}\frac{\binom{n-c_t}{k}}{\binom{n}{k}},\qquad k\le n .

Pass@k suits settings where a verifier can pick the successful attempt, such as code checked by tests. Pass^k suits settings where every interaction must be right, such as customer service. Both equal the average success rate when k=1. If task t has true success probability pt and trials are independent, the targets are

passk=1T∑tpt k,pass@k=1−1T∑t(1−pt)k.\mathrm{pass}^k=\frac1T\sum_t p_t^{\,k},\qquad \mathrm{pass@}k=1-\frac1T\sum_t\left(1-p_t\right)^{k}.

Because xk is convex, the average of ptk is at least the k-th power of the average p. Two agents with similar pass^1 can therefore have very different pass^k: one that always succeeds on some tasks and rarely on others keeps a high pass^k, while one that succeeds 70% of the time on every task decays as 0.7k. τ-bench reports that gpt-4o with function calling had pass^1 of 61.2% on retail tasks but pass^8 below 25%. Main results

Quantify uncertainty over tasks, keeping pairs. Two agents evaluated on the same tasks give paired data. A task-level bootstrap resamples task indices once per replicate and uses both agents’ counts for each drawn task:

Δ∗(b)=1Tn∑j=1T(cIj(b)A−cIj(b)B),Ij(b)∼Uniform{1,…,T}.\Delta^{*(b)}=\frac{1}{Tn}\sum_{j=1}^{T}\left(c^{A}_{I_j^{(b)}}-c^{B}_{I_j^{(b)}}\right),\qquad I_j^{(b)}\sim\mathrm{Uniform}\{1,\ldots,T\}.

The percentile interval of Δ* describes uncertainty about the population of tasks like these; it does not cover changes of environment, tool versions or user simulator. Resampling the two agents’ tasks independently would discard the pairing; when the agents’ per-task results are positively correlated, as they usually are because some tasks are harder for everyone, this widens the interval.

Watch contamination, retrieval and cost. SWE-bench notes that its collection process can add new tasks created after a model’s training date, and compares results on pull requests before and after 2023 in its oracle-retrieval setting, finding little difference for most models. In the same table GPT-4 was run on a 25% random subset because of budget, which the authors flag as possibly affecting its numbers. Contamination and subsets With BM25 retrieval the best model in the paper, Claude 2, resolved 1.96% of issues; giving models the files edited by the reference patch (“oracle” retrieval) changes the task, so the two settings must not be mixed in one table. Retrieval settings τ-bench estimates that one trial over its retail tasks with gpt-4o as the agent and gpt-4 as user simulator costs about 200 dollars, a reason to state the number of trials. The same paragraph gives per-task costs of 0.38 dollars for the agent and 0.23 dollars for the user simulator, which over 115 tasks would come to about 70 dollars, so treat the total as a rough order of magnitude. Cost

A synthetic audit: same tasks, two metrics, one checker

The program builds two hypothetical agents on 40 tasks. “Steady” succeeds with probability 0.7 on every task. “Split” always succeeds on 22 tasks and succeeds with probability 0.2 on the other 18, so its true pass^1 is 0.64. Each task is run eight times. We compute the estimators above, compare them with the true values, look at what single-trial evaluations would conclude, build a paired task-bootstrap interval, and finally test a substring checker against an agent that lists many candidate answers.

"""Original synthetic agent-benchmark audit. No model, tool or website is called:
each task has a hidden success probability and trials are Bernoulli draws."""
import json
import math
import random

TASKS = 40
TRIALS = 8


def true_probabilities():
    steady = [0.7] * TASKS
    split = [1.0 if t < 22 else 0.2 for t in range(TASKS)]
    return {'steady': steady, 'split': split}


def run_trials(probabilities, seed):
    rng = random.Random(seed)
    return [sum(rng.random() < p for _ in range(TRIALS)) for p in probabilities]


def pass_hat(counts, n, k):
    """Unbiased estimate of P(all k trials succeed), averaged over tasks."""
    return sum(math.comb(c, k) / math.comb(n, k) for c in counts) / len(counts)


def pass_at(counts, n, k):
    """Unbiased estimate of P(at least one of k trials succeeds), averaged over tasks."""
    return sum(1 - math.comb(n - c, k) / math.comb(n, k) for c in counts) / len(counts)


def truth(probabilities, k):
    return dict(pass_hat=sum(p ** k for p in probabilities) / len(probabilities),
                pass_at=sum(1 - (1 - p) ** k for p in probabilities) / len(probabilities))


def percentile(values, q):
    values = sorted(values)
    index = (len(values) - 1) * q
    low = math.floor(index)
    high = min(low + 1, len(values) - 1)
    return values[low] + (values[high] - values[low]) * (index - low)


def paired_task_bootstrap(a, b, reps=2000, seed=7):
    """Resample task IDs once per replicate and keep both agents' counts paired."""
    rng = random.Random(seed)
    diffs = []
    for _ in range(reps):
        ids = [rng.randrange(len(a)) for _ in a]
        diffs.append(sum(a[i] - b[i] for i in ids) / (len(ids) * TRIALS))
    return [percentile(diffs, 0.025), percentile(diffs, 0.975)]


def checker_audit():
    """A substring checker rewards an agent that lists every candidate answer."""
    gold = ['42', 'Paris', 'blue']
    honest = ['42', 'Lyon', 'blue']
    shotgun = ['41 42 43', 'Paris Lyon Nice', 'red blue green']
    exact = lambda out: sum(o.strip() == g for o, g in zip(out, gold)) / len(gold)
    contains = lambda out: sum(g in o.split() for o, g in zip(out, gold)) / len(gold)
    unique = lambda out: sum(o.split() == [g] for o, g in zip(out, gold)) / len(gold)
    return {name: dict(exact=round(exact(out), 4), contains=round(contains(out), 4),
                       contains_single_answer=round(unique(out), 4))
            for name, out in (('honest', honest), ('shotgun', shotgun))}


if __name__ == '__main__':
    probs = true_probabilities()
    counts = {name: run_trials(p, seed) for seed, (name, p) in enumerate(probs.items())}
    table = {}
    for name in probs:
        table[name] = {f'k={k}': dict(
            est_pass_hat=round(pass_hat(counts[name], TRIALS, k), 4),
            est_pass_at=round(pass_at(counts[name], TRIALS, k), 4),
            true_pass_hat=round(truth(probs[name], k)['pass_hat'], 4),
            true_pass_at=round(truth(probs[name], k)['pass_at'], 4)) for k in (1, 4, 8)}
    single = []
    for rep in range(10):
        rates = {}
        for j, name in enumerate(probs):
            rng = random.Random(1000 + 10 * rep + j)
            rates[name] = sum(rng.random() < p for p in probs[name]) / TASKS
        single.append(rates)
    steady_wins = sum(r['steady'] > r['split'] for r in single)
    split_wins = sum(r['split'] > r['steady'] for r in single)
    print(json.dumps(dict(
        tasks=TASKS, trials_per_task=TRIALS,
        success_counts={name: ''.join(str(c) for c in v) for name, v in counts.items()},
        metrics=table,
        one_trial_runs=[[r['steady'], r['split']] for r in single],
        one_trial_wins=dict(steady=steady_wins, split=split_wins, ties=10 - steady_wins - split_wins),
        pass1_difference_steady_minus_split=round(
            (sum(counts['steady']) - sum(counts['split'])) / (TASKS * TRIALS), 4),
        paired_bootstrap_95=[round(x, 4) for x in paired_task_bootstrap(counts['steady'], counts['split'])],
        checker_audit=checker_audit(),
    ), indent=2))
Recorded output
{
  "tasks": 40,
  "trials_per_task": 8,
  "success_counts": {
    "steady": "5625565584345676674776686646565546785567",
    "split": "8888888888888888888888212102040143131100"
  },
  "metrics": {
    "steady": {
      "k=1": {
        "est_pass_hat": 0.7,
        "est_pass_at": 0.7,
        "true_pass_hat": 0.7,
        "true_pass_at": 0.7
      },
      "k=4": {
        "est_pass_hat": 0.2411,
        "est_pass_at": 0.9911,
        "true_pass_hat": 0.2401,
        "true_pass_at": 0.9919
      },
      "k=8": {
        "est_pass_hat": 0.075,
        "est_pass_at": 1.0,
        "true_pass_hat": 0.0576,
        "true_pass_at": 0.9999
      }
    },
    "split": {
      "k=1": {
        "est_pass_hat": 0.6312,
        "est_pass_at": 0.6312,
        "true_pass_hat": 0.64,
        "true_pass_at": 0.64
      },
      "k=4": {
        "est_pass_hat": 0.5507,
        "est_pass_at": 0.7796,
        "true_pass_hat": 0.5507,
        "true_pass_at": 0.8157
      },
      "k=8": {
        "est_pass_hat": 0.55,
        "est_pass_at": 0.875,
        "true_pass_hat": 0.55,
        "true_pass_at": 0.9245
      }
    }
  },
  "one_trial_runs": [
    [
      0.725,
      0.675
    ],
    [
      0.65,
      0.675
    ],
    [
      0.75,
      0.65
    ],
    [
      0.625,
      0.675
    ],
    [
      0.725,
      0.625
    ],
    [
      0.575,
      0.65
    ],
    [
      0.725,
      0.625
    ],
    [
      0.625,
      0.65
    ],
    [
      0.7,
      0.625
    ],
    [
      0.775,
      0.725
    ]
  ],
  "one_trial_wins": {
    "steady": 6,
    "split": 4,
    "ties": 0
  },
  "pass1_difference_steady_minus_split": 0.0688,
  "paired_bootstrap_95": [
    -0.0813,
    0.2188
  ],
  "checker_audit": {
    "honest": {
      "exact": 0.6667,
      "contains": 0.6667,
      "contains_single_answer": 0.6667
    },
    "shotgun": {
      "exact": 0.0,
      "contains": 1.0,
      "contains_single_answer": 0.0
    }
  }
}

The ranking depends on the metric:

MetricSteady, estimate (true)Split, estimate (true)Higher
pass^1 = pass@10.7000 (0.7000)0.6312 (0.6400)Steady
pass^40.2411 (0.2401)0.5507 (0.5507)Split
pass^80.0750 (0.0576)0.5500 (0.5500)Split
pass@40.9911 (0.9919)0.7796 (0.8157)Steady
pass@81.0000 (0.9999)0.8750 (0.9245)Steady

Steady is better if a verifier can choose among attempts, and on average per attempt. Split is far more reliable when every attempt must succeed: its pass^4 of 0.5507 is more than double Steady’s. The estimate of Steady’s pass^8 is 0.075 because 3 of 40 tasks happened to succeed in all eight trials, while the true value is 0.0576; with n=k the estimator reduces to the fraction of tasks with perfect records and is noisy.

Single-trial evaluations are unstable. Across ten independent single-trial runs, Steady scores between 0.575 and 0.775 and Split between 0.625 and 0.725; Steady ranks first in 6 runs and Split in 4. With eight trials per task, the observed pass^1 difference is 0.0688 (true difference 0.06), but the paired task-bootstrap interval is [−0.0813, 0.2188], which includes zero. Forty tasks are not enough to separate these agents on average success.

The checker audit shows how a lenient success check can reward the wrong behaviour. On three synthetic questions, an honest agent answering one candidate each scores 0.6667 under all three checks. A “shotgun” agent that outputs three candidates per question scores 0 under exact match, 1.0 under a contains-the-answer check, and 0 under a check that also requires a single answer. Benchmarks that use inclusion checks, such as must_include, need answer formats or additional constraints that make listing candidates unprofitable.

The estimators cost O(T) arithmetic per k, and the bootstrap O(BT) for B replicates; the expensive part of a real evaluation is running the trials, not computing the statistics.

A frozen benchmark answers a frozen question

Every benchmark measures behaviour under its own environment snapshot, tools, policies and checker. SWE-bench’s tests may not detect every wrong patch, and passing tests is not the same as a maintainable change. WebArena’s fuzzy_match delegates part of the judgement to a language model, so that judge’s errors become part of the score. τ-bench’s reward can mark a policy violation as success, as its authors note. Report what the checker verifies, and sample transcripts by hand.

Simulated users and environments make trials repeatable but may not resemble real users. A user simulator with temperature 1.0, as τ-bench uses, produces variation in wording; it does not produce the range of goals, mistakes and adversarial behaviour of real customers. The cited results are each paper’s reported numbers for specific models and dates; they are not reproduced here and should not be compared across benchmarks.

Our program’s independence assumption is also strong. Real trials share prompts, caches and environment states; tasks generated from the same template, such as WebArena’s 812 tasks from 241 templates, are correlated, so treating them as independent overstates precision. Templates Resampling templates instead of tasks is a more cautious choice. The statistics of seeds, runs and aggregate metrics are covered further in the RL evaluation article; this article focuses on what agent tasks add.

Score the evaluation, not just the agent

  1. Why do WebArena and τ-bench check the final state of the website or database instead of comparing the agent’s actions with a reference sequence?

    Answer: Many different action sequences can reach the same correct state, and in τ-bench the simulated user can phrase the same request differently from trial to trial. Comparing with one reference path would mark valid alternatives as failures. Checking the outcome measures whether the goal was achieved, though it must be paired with checks for forbidden side effects.

  2. A task is run n=8 times and succeeds c=6 times. Compute its contributions to pass^4 and pass@4.

    Answer: pass^4: C(6,4)/C(8,4)=15/70≈0.2143. pass@4: 1−C(2,4)/C(8,4)=1−0/70=1, because any four trials must include at least two of the six successes. The same record looks unreliable for “all four” and perfect for “at least one”.

  3. A benchmark’s answer checker uses inclusion: the response passes if it contains the reference string. A new agent’s score jumps after it starts listing several possible answers. What would you check, and how would you fix the evaluation?

    Answer: Run a trivial “list everything” baseline through the checker; if it scores well, the jump may be an artefact. In the program, such an agent scores 1.0 under inclusion and 0 under exact or single-answer checks. Require a structured single answer, penalise extra candidates, or use exact matching where formats allow, and report results under both checkers during the transition.

  4. You must choose between two agents for an automated refund workflow where every incorrect refund requires manual repair, and between two coding agents whose patches are verified by tests before merge. Which metric fits each decision?

    Answer: For refunds, each customer interaction must be right, so report pass^k for a k that reflects repeated use, together with policy-violation checks. For test-verified coding, a verifier can select a successful attempt, so pass@k with the cost of k attempts is appropriate. In both cases evaluate on the same tasks, keep the comparison paired, and report the number of trials and tasks.

Write the evaluation protocol before the leaderboard

SWE-bench shows how to turn real repository history into executable tasks with fail-to-pass tests and how retrieval settings change difficulty; code tasks WebArena shows how to self-host realistic websites and check answers and state, including unachievable tasks; web tasks τ-bench adds simulated users, policy rules, database-state rewards and the pass^k reliability metric. conversational tool use

A useful agent report states the environment version, task source and filtering, checker and its known blind spots, trivial baselines, number of trials per task, the metric family (pass@k or pass^k), paired uncertainty over tasks or templates, cost, and a sample of failure transcripts.

Make a prediction, then check

Every customer-service interaction must be right. A task succeeds in 6 of 8 trials. What is its unbiased contribution to pass^4?

Choose one answer

Learning objectives

  • Specify a frozen environment, outcome-state checker, trivial baselines and trial count for an agent benchmark.
  • Compute pass@k and pass^k from repeated trials, choose the metric that fits the deployment, and express uncertainty with a paired task bootstrap.

Prerequisites & connections

Explore related knowledge →

References

  1. SWE-bench: Can Language Models Resolve Real-World GitHub Issues? — scoped arXiv v3
    Carlos E. Jimenez; John Yang; Alexander Wettig; Shunyu Yao; Kexin Pei; Ofir Press; Karthik Narasimhan · 2023
  2. WebArena: A Realistic Web Environment for Building Autonomous Agents — scoped arXiv v4
    Shuyan Zhou; Frank F. Xu; Hao Zhu; Xuhui Zhou; Robert Lo; Abishek Sridhar; Xianyi Cheng; Tianyue Ou; Yonatan Bisk; Daniel Fried; Uri Alon; Graham Neubig · 2023
  3. τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains — scoped arXiv v1
    Shunyu Yao; Noah Shinn; Pedram Razavi; Karthik Narasimhan · 2024

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Claude · 2026-12-02 · Independent AI check (Claude subagent, not the author); this is an automated AI technical check, not a human or expert review. Ran example.py and diffed against example.stdout.txt (identical); confirmed byte-identical code in both languages; recomputed the true pass^k/pass@k values (for example Split pass^4=(22+18·0.2^4)/40=0.5507, pass@4=0.8157), the Steady pass^8 estimate (3 of 40 tasks with 8/8), exercise 2 (C(6,4)/C(8,4)=15/70) and the quiz. Re-read via pdftotext τ-bench arXiv v1 section 3 (reward, pass^k definition and the estimators C(c,k)/C(n,k) and 1−C(n−c,k)/C(n,k), Table 1) and section 5 (setup, Table 2, pass^8, cost paragraph); SWE-bench arXiv v3 sections 2.1–2.3, section 5 text with Tables 2 and 7; WebArena arXiv v4 introduction, section 3.2 with Table 1, the 241-template sentence, and section 5 with Table 2 and 5.1. Not checked: appendices, benchmark code or harnesses, later benchmark versions.

  • Confirmed the τ-bench pass^k and pass@k unbiased estimators match section 3; reward r=r_action×r_output, r=1 necessary but not sufficient, 115/50 tasks, gpt-4o retail pass^1 61.2% with pass^8 below 25%, and user temperature 1.0 are supported.
  • Checked SWE-bench: ~90,000 PRs, 12 repositories, 2,294 tasks, fail-to-pass, 40% with at least two, median 51 extra tests, Unix patch, Claude 2 1.96% with BM25, Table 7 GPT-4 on a 25% subset due to budget, little before/after-2023 difference for most models; WebArena: 812 tasks from 241 templates, four self-hosted sites, three answer functions with gpt-4-0613, GPT-4 11.70%→14.41%, N/A 77.78%→44.44%, 54.9% of feasible tasks called impossible.
  • Found that τ-bench's own cost paragraph is internally inconsistent (0.38+0.23 dollars per task over 115 tasks is about 70 dollars, versus the stated ~200), now noted in the text; qualified the claim that unpaired resampling widens the interval to the case of positively correlated per-task results.
  • Compared zh and en section by section: claims, numbers, tables, exercises and answers match.

Source locations checked:

  • SWE-bench: Can Language Models Resolve Real-World GitHub Issues? — scoped arXiv v3 · pdftotext of arXiv v3: abstract; section 2.1 stages I–III, 2.2 task formulation and metric, 2.3 features (fail-to-pass, 40% with ≥2, median 51 extra tests, continually updatable), 2.4 opening (extraction lines 120–200); section 5 text around Tables 2–7 (lines 280–445): BM25 Claude 2 1.96%, oracle retrieval, Table 7 before/after 2023 with GPT-4 on 25% subset. Not read: appendix A, harness, SWE-bench Lite details.
  • WebArena: A Realistic Web Environment for Building Autonomous Agents — scoped arXiv v4 · pdftotext of arXiv v4: abstract, introduction (lines 84–125), intent analysis sentence (241 templates, 812 intents), section 3.2 and Table 1 (lines 360–445), section 5 Table 2 and 5.1 opening (lines 490–525): SR 11.70/14.41, SR_UA 77.78/44.44, 54.9% feasible tasks judged impossible, human 78.24%. Not read: appendices A.x, Table 3 template analysis.
  • τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains — scoped arXiv v1 · pdftotext of arXiv v1: abstract, intro paragraphs (lines 85–110), section 3 task instances, reward, pass^k definitions and estimators, Table 1 (lines 215–260), section 4 stages and 4.1 opening (lines 260–300), section 5 setup, Table 2, 5.1 (lines 340–410). Not read: 5.2 onward, appendices, code repository.

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.