Measure agent reliability with pass^k

EasyAgents

Why it matters Agent benchmarks for customer-service and tool-use tasks report pass^k because a reliable agent must succeed on every attempt.

pass@k asks whether an agent succeeds at least once in k tries. For agents that act for real users, the stricter question is whether it succeeds every time: pass^k.

Write pass_hat_k(results, k). results is a list of (n, c) pairs per task: n trials run, c of them succeeded (n >= k). The unbiased per-task estimate of "k fresh trials all succeed" is C(c, k) / C(n, k), which is 0 when c < k. Return the mean over tasks as a float (0.0 for an empty list).

Signaturedef pass_hat_k(results, k)

Example

pass_hat_k([(4, 2)], 2) gives 0.16666666666666666.

Understand the idea

Two agents can both succeed 50% of the time per try and still differ a lot in practice. pass@k is generous: it counts a task solved if any of k tries works, which suits code generation with tests. pass^k is strict: every one of k tries must work, which suits agents that book tickets or refund customers, where a user may run the same request many times.

Example: 4 trials, 2 succeeded, k = 2. There are C(4, 2) = 6 ways to pick 2 trials, and only C(2, 2) = 1 picks both successes, so pass^2 = 1/6 = 0.167. The naive (2/4)^2 = 0.25 is too optimistic.

Rule: pass^k = C(c, k) / C(n, k), averaged over tasks.

Tool-use benchmarks for customer-service agents report pass^k curves, and they drop fast as k grows, exposing flaky agents.

solution.pyPython idle
Ctrl/Cmd + Enter runs sample tests

Run checks the first 2 tests. Submit checks all 4.

  • Sample 1: examplepass_hat_k([(4, 2)], 2)
  • Sample 2: several taskspass_hat_k([(8, 8), (8, 6), (8, 1), (8, 0)], 3)
  • Test 3: k onepass_hat_k([(5, 3), (5, 4)], 1)
  • Test 4: emptypass_hat_k([], 2)