Topic 6 of 6 · 6 min read
Benchmarking agents on your own tasks
Goal: Build a small benchmark from your own past tasks and compare two agents on success, cost and time.
Public leaderboards tell you which agent is good in general; a small benchmark built from your own closed tasks tells you which one is good for your work.
Check yourself · 1 of 3
Why keep grading tests hidden from the agent in a benchmark task?
Why it matters
SWE-bench turned real GitHub issues into tasks: the agent gets a repository and an issue, and hidden tests decide whether the fix works. You can copy the method. Your issue tracker is full of tasks with known answers, written in your codebase, with your conventions. A general score says nothing about those.
How to build one
- Pick 20 to 50 closed tasks. Choose bugs and small features that were merged, spanning easy to hard. Skip tasks that needed a meeting to understand.
- Freeze the start. Record the commit just before the fix. The agent starts there.
- Write the prompt. Use the original issue text, nothing the fix commit reveals.
- Hidden tests. Use the tests from the fix, or write new ones, and keep them out of the agent's view so it cannot edit them away.
- Run in the harness. Same container, tools, limits and number of trials for every agent.
- Record per task: pass or fail, tokens or cost, wall-clock time and step count.
Watch for contamination
If a task came from a public repository, the model may have seen the fix during training and recall it. Prefer private code, or tasks newer than the model's training data, and treat public-repo scores with caution.
Before and after
A weak comparison: "Agent A felt smarter on three tries." A better one:
| Agent | Solved (of 30) | Median cost per task | Median time |
|---|---|---|---|
| Agent A | 21 | $0.62 | 4.1 min |
| Agent B | 19 | $0.18 | 2.3 min |
Agent A solves two more, at over three times the cost. With 30 tasks that gap may be noise, so rerun trials before choosing.
What goes wrong
- Too few tasks. A difference of one or two tasks is not a result.
- Tests visible to the agent. It can special-case the test.
- Comparing without cost. The best agent may be unaffordable.
- Stale benchmark. Once you tune prompts on the set, it no longer measures new work. Keep a held-out slice.
Examples
From closed issue to task
Issue 812 "Pagination returns duplicates" was fixed in commit 9ab3. The task starts at the parent commit with the issue text as the prompt. The test added in the fix is the hidden grader.
Two agents, one table
Both agents solve about two thirds of 30 tasks. The cheaper one costs a quarter as much per task. For a nightly bulk job you pick the cheaper one. For hard production incidents you may pay for the one that solves more.
Key points
- Build tasks from your own closed issues: a frozen commit, the original issue text and hidden tests.
- Keep the grading tests out of the agent's reach so it cannot edit or special-case them.
- Run every agent in the same harness with the same limits and number of trials.
- Report success rate, cost per task and time per task together, not success alone.
- Watch for contamination and for noise when the task count is small.
Common mistakes
- Using 5 tasks and drawing conclusions from a one-task difference.
- Leaving the grading tests in the repository the agent can edit.
- Choosing on success rate alone and ignoring cost and time.
- Tuning prompts on the benchmark and then reusing it as a fair test.
Check yourself · 2 of 3
Two agents solve 21 and 19 of 30 tasks. What should you check before naming a winner?
Check yourself · 3 of 3
In agent benchmarking, what does contamination mean?
Practice items, not counted towards your mastery.
Start here
- Demystifying evals for AI agents (Anthropic) (opens in a new tab)ArticleFree
Anthropic's practical guide to grading agents: graders, trials, pass@k versus pass^k and reading transcripts.
- tau-bench: Tool-Agent-User Interaction in Real-World Domains (Yao et al.) (opens in a new tab)PaperFree
Introduces pass^k and grades agents on the final database state with simulated users and policy rules.
- SWE-bench (opens in a new tab)ToolFree
The reference benchmark built from real GitHub issues, graded by tests the agent never sees.
More for this topic
- SWE-bench: Can Language Models Resolve Real-World GitHub Issues? (Jimenez et al.) (opens in a new tab)PaperFree
The paper behind SWE-bench: how tasks are built from issues and graded by held-out tests.