How are AI agents benchmarked?

Learning path, stage 5 of 5: Shipping to production · question 8 of 10

Agent benchmarks measure end-to-end task success in realistic environments, not single answers. SWE-bench gives a real GitHub issue and checks whether the agent's patch makes the hidden tests pass. GAIA tests assistant tasks that need browsing and tools. τ-bench (tau-bench) simulates customer-service conversations with tools and policies. AgentBench covers several interactive environments.

Well-known benchmarks

  • SWE-bench / SWE-bench Verified: resolve real Python repo issues, graded by unit tests. Verified is a human-checked subset.
  • GAIA: general assistant questions with clear answers that need several steps and tools.
  • τ-bench: a tool–agent–user loop in retail and airline domains, with policy rules. Reports pass^k, meaning consistency over k tries.
  • AgentBench: operating system, database, web and game environments.

Interpreting results carefully

  • Contamination: benchmark data may have leaked into training data.
  • Scaffolding matters: the same model scores very differently with a different agent harness.
  • Variance: run several attempts. Report pass@1 and consistency.
  • Public benchmarks ≠ your task. Build an internal eval from your own workflows.

Sources

Code example

tsx
1// pass@1 and pass^k (all k trials succeed) from repeated agent runs.
2type Trials = boolean[]; // results of k independent attempts on one task
3
4export function passAt1(tasks: Trials[]) {
5 const perTask = tasks.map((t) => t.filter(Boolean).length / t.length);
6 return perTask.reduce((a, b) => a + b, 0) / tasks.length;
7}
8
9// pass^k: the chance that ALL k attempts succeed (a reliability measure, as in τ-bench)
10export function passHatK(tasks: Trials[], k: number) {
11 const choose = (n: number, r: number) => {
12 let c = 1;
13 for (let i = 0; i < r; i++) c = (c * (n - i)) / (i + 1);
14 return c;
15 };
16 const perTask = tasks.map((t) => {
17 const n = t.length, c = t.filter(Boolean).length;
18 return c < k ? 0 : choose(c, k) / choose(n, k);
19 });
20 return perTask.reduce((a, b) => a + b, 0) / tasks.length;
21}
22
23console.log(passAt1([[true, true, false], [true, false, false]])); // 0.5
24console.log(passHatK([[true, true, false], [true, true, true]], 2)); // (1/3 + 1) / 2

To run it: follow the one-time setup guide, add npm i @anthropic-ai/sdk zod @opentelemetry/api vitest, save the code as a .ts file and run npx tsx file.ts. Anything marked declare is a part you supply.

Practice this question

Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the AI Agents & LLMs set.

Open in study app