agentbench-ai 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. agentbench_ai-0.1.0/LICENSE +21 -0
  2. agentbench_ai-0.1.0/PKG-INFO +181 -0
  3. agentbench_ai-0.1.0/README.md +159 -0
  4. agentbench_ai-0.1.0/pyproject.toml +48 -0
  5. agentbench_ai-0.1.0/setup.cfg +4 -0
  6. agentbench_ai-0.1.0/src/agentbench/__init__.py +2 -0
  7. agentbench_ai-0.1.0/src/agentbench/__main__.py +3 -0
  8. agentbench_ai-0.1.0/src/agentbench/cli.py +173 -0
  9. agentbench_ai-0.1.0/src/agentbench/config.py +88 -0
  10. agentbench_ai-0.1.0/src/agentbench/data_meta.json +28 -0
  11. agentbench_ai-0.1.0/src/agentbench/fixtures/__init__.py +1 -0
  12. agentbench_ai-0.1.0/src/agentbench/fixtures/base.py +1179 -0
  13. agentbench_ai-0.1.0/src/agentbench/fixtures/tier4.py +645 -0
  14. agentbench_ai-0.1.0/src/agentbench/fixtures/tier5.py +407 -0
  15. agentbench_ai-0.1.0/src/agentbench/fixtures/tier5b.py +424 -0
  16. agentbench_ai-0.1.0/src/agentbench/fixtures/tier6.py +528 -0
  17. agentbench_ai-0.1.0/src/agentbench/grading.py +326 -0
  18. agentbench_ai-0.1.0/src/agentbench/reference/__init__.py +0 -0
  19. agentbench_ai-0.1.0/src/agentbench/reference/t10/solve.py +23 -0
  20. agentbench_ai-0.1.0/src/agentbench/reference/t11/csvkit/parse.py +116 -0
  21. agentbench_ai-0.1.0/src/agentbench/reference/t12/q.py +451 -0
  22. agentbench_ai-0.1.0/src/agentbench/reference/t17/queuekit/queue.py +53 -0
  23. agentbench_ai-0.1.0/src/agentbench/reference/t19/report.py +19 -0
  24. agentbench_ai-0.1.0/src/agentbench/reference/t2/ledger/core.py +23 -0
  25. agentbench_ai-0.1.0/src/agentbench/reference/t20/cli.py +79 -0
  26. agentbench_ai-0.1.0/src/agentbench/reference/t21/calc.py +7 -0
  27. agentbench_ai-0.1.0/src/agentbench/reference/t22/server.py +117 -0
  28. agentbench_ai-0.1.0/src/agentbench/reference/t23/migrate.py +105 -0
  29. agentbench_ai-0.1.0/src/agentbench/reference/t24/serve.py +67 -0
  30. agentbench_ai-0.1.0/src/agentbench/reference/t25/merge3.py +77 -0
  31. agentbench_ai-0.1.0/src/agentbench/reference/t26/agg.py +31 -0
  32. agentbench_ai-0.1.0/src/agentbench/reference/t3/bin/audit +58 -0
  33. agentbench_ai-0.1.0/src/agentbench/reference/t7/emailkit/normalize.py +43 -0
  34. agentbench_ai-0.1.0/src/agentbench/reference/t9/engine.py +94 -0
  35. agentbench_ai-0.1.0/src/agentbench/runner.py +94 -0
  36. agentbench_ai-0.1.0/src/agentbench/selftest.py +278 -0
  37. agentbench_ai-0.1.0/src/agentbench_ai.egg-info/PKG-INFO +181 -0
  38. agentbench_ai-0.1.0/src/agentbench_ai.egg-info/SOURCES.txt +43 -0
  39. agentbench_ai-0.1.0/src/agentbench_ai.egg-info/dependency_links.txt +1 -0
  40. agentbench_ai-0.1.0/src/agentbench_ai.egg-info/entry_points.txt +2 -0
  41. agentbench_ai-0.1.0/src/agentbench_ai.egg-info/requires.txt +3 -0
  42. agentbench_ai-0.1.0/src/agentbench_ai.egg-info/top_level.txt +1 -0
  43. agentbench_ai-0.1.0/tests/test_cli.py +40 -0
  44. agentbench_ai-0.1.0/tests/test_grading.py +10 -0
  45. agentbench_ai-0.1.0/tests/test_registry.py +33 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tiago Fortunato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentbench-ai
3
+ Version: 0.1.0
4
+ Summary: Agentic coding benchmark: 26 tasks with executable graders, local vs cloud models
5
+ Author: Tiago Fortunato
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/tiagoflino/agentbench
8
+ Project-URL: Issues, https://github.com/tiagoflino/agentbench/issues
9
+ Keywords: llm,benchmark,agents,codex,evaluation,tool-calling
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Testing
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Provides-Extra: dev
20
+ Requires-Dist: ruff>=0.6; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # agentbench
24
+
25
+ [![ci](https://github.com/tiagoflino/agentbench/actions/workflows/ci.yml/badge.svg)](https://github.com/tiagoflino/agentbench/actions/workflows/ci.yml)
26
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
27
+ [![python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
28
+
29
+ An agentic coding benchmark for comparing **local** and **cloud** coding agents
30
+ on the same harness. 26 tasks, 16 categories, executable graders — no LLM judge,
31
+ no vibes.
32
+
33
+ Built for the question "is my local model actually good enough?", the suite
34
+ deliberately includes tasks that frontier models do **not** fully solve: code
35
+ review without an oracle, multi-tool orchestration, a 210-case three-way merge,
36
+ and a 2M-row aggregate under a memory cap.
37
+
38
+ ```
39
+ $ agentbench list
40
+ * t1-knapsack algorithms
41
+ * t2-ledger debugging
42
+ ...
43
+ t26-stream performance
44
+ ```
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ brew install tiagoflino/agentbench/agentbench # Homebrew tap
50
+ # or
51
+ pipx install agentbench-ai # PyPI
52
+ # or
53
+ uv tool install agentbench-ai
54
+
55
+ agentbench doctor
56
+ ```
57
+
58
+ From source:
59
+
60
+ ```bash
61
+ git clone https://github.com/tiagoflino/agentbench && cd agentbench
62
+ python3 -m pip install -e ".[dev]"
63
+ ```
64
+
65
+ Requirements: Python 3.10+, the `codex` CLI, an OpenAI-compatible gateway
66
+ (default `http://127.0.0.1:3425`), and `npx` for the browser tasks.
67
+
68
+ ## Quickstart
69
+
70
+ ```bash
71
+ agentbench build # generate fixtures + hidden tests (~1 min, ~400 MB)
72
+ agentbench doctor # check codex / gateway / git / npx
73
+ agentbench run --models "opencode-go/qwen3.8-flash,opencode-go/deepseek-v4.1-flash" \
74
+ --run-id first
75
+ agentbench grade ~/.cache/agentbench/runs/first
76
+ ```
77
+
78
+ `run` copies every task into an isolated directory (so the model never sees the
79
+ hidden tests), injects `CODEX_HOME` with a clean config, and runs one lane per
80
+ model. `grade` prints a per-task table, a per-category table, and writes
81
+ `report.json`.
82
+
83
+ ## How it works
84
+
85
+ ```
86
+ agentbench build -> fixtures are generated deterministically (seeded)
87
+ tasks/<id>/ prompt + code/data the agent sees
88
+ hidden/<id>/ graders and expected outputs
89
+ answers.json key material for grading
90
+ agentbench run -> runs/<run>/<model>/<task>/ events.jsonl, last.txt, exit_code
91
+ agentbench grade -> scores each task, aggregates categories, writes report.json
92
+ ```
93
+
94
+ Nothing large is committed: fixtures are derived from code, so the repo stays
95
+ small and the data is reproducible.
96
+
97
+ Reference solutions live in `src/agentbench/reference/`; `agentbench selftest`
98
+ checks that every grader gives 100/100 to its reference.
99
+
100
+ ## Tasks
101
+
102
+ | id | category | what it measures |
103
+ |---|---|---|
104
+ | t1-knapsack | algorithms | exact 0/1 knapsack against a greedy "verified optimal" decoy |
105
+ | t2-ledger | debugging | three production bugs: pagination, half-up rounding, BRT timezone |
106
+ | t3-audit-cli | spec-precision | dedupe, tie-break, UTC, exact decimals, exit codes |
107
+ | t4-injection | robustness | prompt injection inside CSV/ticket data + refund math |
108
+ | t5-logs | forensics | 40k JSONL lines: conjunctive count + nearest-rank p95 |
109
+ | t6-xirr | numerics | XIRR with irregular dates and a decoy CAGR |
110
+ | t7-normalize | spec-precision | email normalization: IDN, gmail dots/plus, NFC |
111
+ | t8-schedule | algorithms | capacity scheduling; minimal conflicting set |
112
+ | t9-engine | systems | order book: price-time, IOC/FOK/market, self-trade prevention |
113
+ | t10-perf | performance | 200k intervals, weighted interval scheduling |
114
+ | t11-csv | spec-precision | RFC 4180 parser with positioned errors |
115
+ | t12-sql | systems | mini SQL engine: 3-valued logic, aggregates, HAVING |
116
+ | t13-review | judgment | review a patch with 5 planted defects, no oracle |
117
+ | t14-logic | reasoning | logic grid with a unique redundant clue |
118
+ | t15-browser | tooling | real browser QA: DOM, a11y tree, network, 6 bugs |
119
+ | t16-dossier | long-context | 5k records + 5 conflicting policies, exact total |
120
+ | t17-concurrency | concurrency | worker pool: lost update, swallowed error, slow stop |
121
+ | t18-security | judgment | triage 6 scanner findings (3 real, 3 false positives) |
122
+ | t19-perf | performance | O(n^2) -> <8 s on 200k rows, identical output |
123
+ | t20-feature | refactor | add quarter filtering without breaking API/format |
124
+ | t21-bisect | tooling | git bisect a regression and fix it |
125
+ | t22-http | spec-precision | JSON API: status codes, error envelope, content type |
126
+ | t23-migration | long-horizon | 12 rules, 18 invariants, idempotent migration |
127
+ | t24-gauntlet | tooling | server + browser + HTTP + git in one task |
128
+ | t25-merge | precision | three-way JSON merge, 210 cases |
129
+ | t26-stream | performance | 2M rows, exact aggregate, <45 s and <700 MB RSS |
130
+
131
+ ## Scoring
132
+
133
+ Each task is worth 100 points; the overall score is the mean. Partial credit is
134
+ per hidden check or per generated case, so a model that solves 80% of the fuzz
135
+ cases scores 80. Timeouts count as failures for whatever was not written before
136
+ the deadline.
137
+
138
+ Categories follow the task table, with `judgment`, `precision`, `tooling`,
139
+ `performance` and `long-horizon` doing most of the separating in practice.
140
+
141
+ ## Results
142
+
143
+ One run, 26 tasks, same harness (see `docs/results.md`):
144
+
145
+ | model | overall |
146
+ |---|---|
147
+ | DeepSeek V4.1 Flash | 98.1 |
148
+ | Qwen4 Max | 94.6 |
149
+ | Qwen3.8 IQ3 (local, 27B, ~3-bit) | 94.3 |
150
+ | Qwen3.8 Flash (cloud) | 92.8 |
151
+ | GPT-6 Luna (frontier) | 89.4 |
152
+
153
+ No model saturates the suite. The frontier arm loses most on `t13-review` (20),
154
+ `t24-gauntlet` (40), `t26-stream` (40) and `t15-browser` (67).
155
+
156
+ ## Adding a task
157
+
158
+ 1. Add a builder in `src/agentbench/fixtures/` (deterministic; writes
159
+ `tasks/<id>/` and `hidden/<id>/`).
160
+ 2. Add a grader `hidden/<id>/check.py` that prints `SCORE k/n` or
161
+ `SCORE points/100`.
162
+ 3. Register the task in `data_meta.json` and in `fixtures/base.build`.
163
+ 4. Add a reference solution and a `selftest` case so the grader is provably
164
+ reachable.
165
+
166
+ See `docs/architecture.md` for the invariants the suite relies on.
167
+
168
+ ## Limitations
169
+
170
+ - Scores are single-run by default: use 3 repetitions and compare medians
171
+ (`agentbench run` three times, then `grade` each).
172
+ - Textual graders (t13/t15/t18) match evidence keywords; they are more forgiving
173
+ than a human reviewer.
174
+ - Timing tasks are sensitive to CPU contention: run one lane at a time if you
175
+ care about wall-clock numbers.
176
+ - `t26` builds ~300 MB of fixtures; `agentbench build --only ...` keeps that out
177
+ of quick iterations.
178
+
179
+ ## License
180
+
181
+ MIT
@@ -0,0 +1,159 @@
1
+ # agentbench
2
+
3
+ [![ci](https://github.com/tiagoflino/agentbench/actions/workflows/ci.yml/badge.svg)](https://github.com/tiagoflino/agentbench/actions/workflows/ci.yml)
4
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+ [![python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
6
+
7
+ An agentic coding benchmark for comparing **local** and **cloud** coding agents
8
+ on the same harness. 26 tasks, 16 categories, executable graders — no LLM judge,
9
+ no vibes.
10
+
11
+ Built for the question "is my local model actually good enough?", the suite
12
+ deliberately includes tasks that frontier models do **not** fully solve: code
13
+ review without an oracle, multi-tool orchestration, a 210-case three-way merge,
14
+ and a 2M-row aggregate under a memory cap.
15
+
16
+ ```
17
+ $ agentbench list
18
+ * t1-knapsack algorithms
19
+ * t2-ledger debugging
20
+ ...
21
+ t26-stream performance
22
+ ```
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ brew install tiagoflino/agentbench/agentbench # Homebrew tap
28
+ # or
29
+ pipx install agentbench-ai # PyPI
30
+ # or
31
+ uv tool install agentbench-ai
32
+
33
+ agentbench doctor
34
+ ```
35
+
36
+ From source:
37
+
38
+ ```bash
39
+ git clone https://github.com/tiagoflino/agentbench && cd agentbench
40
+ python3 -m pip install -e ".[dev]"
41
+ ```
42
+
43
+ Requirements: Python 3.10+, the `codex` CLI, an OpenAI-compatible gateway
44
+ (default `http://127.0.0.1:3425`), and `npx` for the browser tasks.
45
+
46
+ ## Quickstart
47
+
48
+ ```bash
49
+ agentbench build # generate fixtures + hidden tests (~1 min, ~400 MB)
50
+ agentbench doctor # check codex / gateway / git / npx
51
+ agentbench run --models "opencode-go/qwen3.8-flash,opencode-go/deepseek-v4.1-flash" \
52
+ --run-id first
53
+ agentbench grade ~/.cache/agentbench/runs/first
54
+ ```
55
+
56
+ `run` copies every task into an isolated directory (so the model never sees the
57
+ hidden tests), injects `CODEX_HOME` with a clean config, and runs one lane per
58
+ model. `grade` prints a per-task table, a per-category table, and writes
59
+ `report.json`.
60
+
61
+ ## How it works
62
+
63
+ ```
64
+ agentbench build -> fixtures are generated deterministically (seeded)
65
+ tasks/<id>/ prompt + code/data the agent sees
66
+ hidden/<id>/ graders and expected outputs
67
+ answers.json key material for grading
68
+ agentbench run -> runs/<run>/<model>/<task>/ events.jsonl, last.txt, exit_code
69
+ agentbench grade -> scores each task, aggregates categories, writes report.json
70
+ ```
71
+
72
+ Nothing large is committed: fixtures are derived from code, so the repo stays
73
+ small and the data is reproducible.
74
+
75
+ Reference solutions live in `src/agentbench/reference/`; `agentbench selftest`
76
+ checks that every grader gives 100/100 to its reference.
77
+
78
+ ## Tasks
79
+
80
+ | id | category | what it measures |
81
+ |---|---|---|
82
+ | t1-knapsack | algorithms | exact 0/1 knapsack against a greedy "verified optimal" decoy |
83
+ | t2-ledger | debugging | three production bugs: pagination, half-up rounding, BRT timezone |
84
+ | t3-audit-cli | spec-precision | dedupe, tie-break, UTC, exact decimals, exit codes |
85
+ | t4-injection | robustness | prompt injection inside CSV/ticket data + refund math |
86
+ | t5-logs | forensics | 40k JSONL lines: conjunctive count + nearest-rank p95 |
87
+ | t6-xirr | numerics | XIRR with irregular dates and a decoy CAGR |
88
+ | t7-normalize | spec-precision | email normalization: IDN, gmail dots/plus, NFC |
89
+ | t8-schedule | algorithms | capacity scheduling; minimal conflicting set |
90
+ | t9-engine | systems | order book: price-time, IOC/FOK/market, self-trade prevention |
91
+ | t10-perf | performance | 200k intervals, weighted interval scheduling |
92
+ | t11-csv | spec-precision | RFC 4180 parser with positioned errors |
93
+ | t12-sql | systems | mini SQL engine: 3-valued logic, aggregates, HAVING |
94
+ | t13-review | judgment | review a patch with 5 planted defects, no oracle |
95
+ | t14-logic | reasoning | logic grid with a unique redundant clue |
96
+ | t15-browser | tooling | real browser QA: DOM, a11y tree, network, 6 bugs |
97
+ | t16-dossier | long-context | 5k records + 5 conflicting policies, exact total |
98
+ | t17-concurrency | concurrency | worker pool: lost update, swallowed error, slow stop |
99
+ | t18-security | judgment | triage 6 scanner findings (3 real, 3 false positives) |
100
+ | t19-perf | performance | O(n^2) -> <8 s on 200k rows, identical output |
101
+ | t20-feature | refactor | add quarter filtering without breaking API/format |
102
+ | t21-bisect | tooling | git bisect a regression and fix it |
103
+ | t22-http | spec-precision | JSON API: status codes, error envelope, content type |
104
+ | t23-migration | long-horizon | 12 rules, 18 invariants, idempotent migration |
105
+ | t24-gauntlet | tooling | server + browser + HTTP + git in one task |
106
+ | t25-merge | precision | three-way JSON merge, 210 cases |
107
+ | t26-stream | performance | 2M rows, exact aggregate, <45 s and <700 MB RSS |
108
+
109
+ ## Scoring
110
+
111
+ Each task is worth 100 points; the overall score is the mean. Partial credit is
112
+ per hidden check or per generated case, so a model that solves 80% of the fuzz
113
+ cases scores 80. Timeouts count as failures for whatever was not written before
114
+ the deadline.
115
+
116
+ Categories follow the task table, with `judgment`, `precision`, `tooling`,
117
+ `performance` and `long-horizon` doing most of the separating in practice.
118
+
119
+ ## Results
120
+
121
+ One run, 26 tasks, same harness (see `docs/results.md`):
122
+
123
+ | model | overall |
124
+ |---|---|
125
+ | DeepSeek V4.1 Flash | 98.1 |
126
+ | Qwen4 Max | 94.6 |
127
+ | Qwen3.8 IQ3 (local, 27B, ~3-bit) | 94.3 |
128
+ | Qwen3.8 Flash (cloud) | 92.8 |
129
+ | GPT-6 Luna (frontier) | 89.4 |
130
+
131
+ No model saturates the suite. The frontier arm loses most on `t13-review` (20),
132
+ `t24-gauntlet` (40), `t26-stream` (40) and `t15-browser` (67).
133
+
134
+ ## Adding a task
135
+
136
+ 1. Add a builder in `src/agentbench/fixtures/` (deterministic; writes
137
+ `tasks/<id>/` and `hidden/<id>/`).
138
+ 2. Add a grader `hidden/<id>/check.py` that prints `SCORE k/n` or
139
+ `SCORE points/100`.
140
+ 3. Register the task in `data_meta.json` and in `fixtures/base.build`.
141
+ 4. Add a reference solution and a `selftest` case so the grader is provably
142
+ reachable.
143
+
144
+ See `docs/architecture.md` for the invariants the suite relies on.
145
+
146
+ ## Limitations
147
+
148
+ - Scores are single-run by default: use 3 repetitions and compare medians
149
+ (`agentbench run` three times, then `grade` each).
150
+ - Textual graders (t13/t15/t18) match evidence keywords; they are more forgiving
151
+ than a human reviewer.
152
+ - Timing tasks are sensitive to CPU contention: run one lane at a time if you
153
+ care about wall-clock numbers.
154
+ - `t26` builds ~300 MB of fixtures; `agentbench build --only ...` keeps that out
155
+ of quick iterations.
156
+
157
+ ## License
158
+
159
+ MIT
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agentbench-ai"
7
+ version = "0.1.0"
8
+ description = "Agentic coding benchmark: 26 tasks with executable graders, local vs cloud models"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "Tiago Fortunato" }]
13
+ keywords = ["llm", "benchmark", "agents", "codex", "evaluation", "tool-calling"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Topic :: Software Development :: Testing",
21
+ ]
22
+ dependencies = []
23
+
24
+ [project.optional-dependencies]
25
+ dev = ["ruff>=0.6"]
26
+
27
+ [project.scripts]
28
+ agentbench = "agentbench.cli:main"
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/tiagoflino/agentbench"
32
+ Issues = "https://github.com/tiagoflino/agentbench/issues"
33
+
34
+ [tool.setuptools]
35
+ package-dir = { "" = "src" }
36
+
37
+ [tool.setuptools.packages.find]
38
+ where = ["src"]
39
+
40
+ [tool.setuptools.package-data]
41
+ agentbench = ["data_meta.json", "reference/*/*", "reference/*/*/*"]
42
+
43
+ [tool.setuptools.exclude-package-data]
44
+ agentbench = ["**/__pycache__/*", "**/*.pyc"]
45
+
46
+ [tool.ruff]
47
+ line-length = 100
48
+ target-version = "py310"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ """agentbench - agentic coding benchmark (local vs cloud models)."""
2
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,173 @@
1
+ """agentbench command line interface."""
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import json
6
+ import os
7
+ import shutil
8
+ import subprocess
9
+ import sys
10
+ import urllib.request
11
+ from pathlib import Path
12
+
13
+ from . import __version__
14
+ from .config import (PKG, Settings, all_tasks, codex_binary, default_home,
15
+ task_catalog, write_harness_home)
16
+
17
+
18
+ def _settings(args) -> Settings:
19
+ s = Settings()
20
+ if getattr(args, "home", None):
21
+ s.home = Path(args.home).expanduser()
22
+ s.effort = getattr(args, "effort", None) or s.effort
23
+ s.timeout = getattr(args, "timeout", None) or s.timeout
24
+ s.workers = getattr(args, "workers", None) or s.workers
25
+ return s
26
+
27
+
28
+ def _split(values: list[str] | None) -> list[str] | None:
29
+ if not values:
30
+ return None
31
+ out: list[str] = []
32
+ for chunk in values:
33
+ out.extend(x for x in chunk.replace(",", " ").split() if x)
34
+ return out
35
+
36
+
37
+ def cmd_build(args) -> int:
38
+ from .fixtures import build
39
+
40
+ s = _settings(args)
41
+ only = _split(args.only)
42
+ s.home.mkdir(parents=True, exist_ok=True)
43
+ answers = build(only=only, root=s.home)
44
+ print(f"built {len(only) if only else len(task_catalog())} tasks into {s.home}")
45
+ print(f"answers: {len(answers)} keys")
46
+ return 0
47
+
48
+
49
+ def cmd_list(args) -> int:
50
+ s = _settings(args)
51
+ meta = task_catalog()
52
+ built = set(all_tasks(s))
53
+ rows = [{"task": k, "category": v, "built": k in built} for k, v in sorted(meta.items())]
54
+ if args.json:
55
+ print(json.dumps(rows, indent=1))
56
+ return 0
57
+ width = max(len(r["task"]) for r in rows)
58
+ for r in rows:
59
+ flag = "*" if r["built"] else " "
60
+ print(f"{flag} {r['task']:<{width}} {r['category']}")
61
+ print("\n* = built in " + str(s.tasks_dir))
62
+ return 0
63
+
64
+
65
+ def cmd_run(args) -> int:
66
+ from .runner import run
67
+
68
+ s = _settings(args)
69
+ models = _split(args.models) or []
70
+ if not models:
71
+ print("error: --models is required", file=sys.stderr)
72
+ return 2
73
+ tasks = _split(args.tasks)
74
+ if tasks:
75
+ known = set(task_catalog())
76
+ unknown = [t for t in tasks if t not in known]
77
+ if unknown:
78
+ print(f"error: unknown task(s): {', '.join(unknown)}", file=sys.stderr)
79
+ return 2
80
+ runs = run(s, models, tasks=tasks, run_id=args.run_id, resume=args.resume)
81
+ print(f"runs: {runs}")
82
+ return 0
83
+
84
+
85
+ def cmd_grade(args) -> int:
86
+ from . import grading
87
+
88
+ s = _settings(args)
89
+ grading.configure(s.home)
90
+ sys.argv = ["agentbench-grade", str(args.run_dir)]
91
+ grading.main()
92
+ return 0
93
+
94
+
95
+ def cmd_selftest(args) -> int:
96
+ s = _settings(args)
97
+ env = dict(os.environ, AGENTBENCH_ROOT=str(s.home))
98
+ return subprocess.call([sys.executable, "-m", "agentbench.selftest"], env=env,
99
+ cwd=str(PKG.parent.parent))
100
+
101
+
102
+ def cmd_doctor(args) -> int:
103
+ s = _settings(args)
104
+ checks = []
105
+ codex = Path(s.codex)
106
+ checks.append(("codex binary", codex.exists(), str(codex)))
107
+ checks.append(("git", shutil.which("git") is not None, shutil.which("git") or ""))
108
+ checks.append(("npx (browser MCP)", shutil.which("npx") is not None,
109
+ shutil.which("npx") or ""))
110
+ gateway = os.environ.get("AGENTBENCH_GATEWAY", "http://127.0.0.1:3425")
111
+ ok = False
112
+ try:
113
+ with urllib.request.urlopen(gateway.rstrip("/") + "/v1/models", timeout=3) as r:
114
+ ok = r.status == 200
115
+ except Exception:
116
+ ok = False
117
+ checks.append(("gateway", ok, gateway))
118
+ built = len(all_tasks(s))
119
+ checks.append(("tasks built", built > 0, f"{built} in {s.tasks_dir}"))
120
+ width = max(len(c[0]) for c in checks)
121
+ rc = 0
122
+ for name, ok, detail in checks:
123
+ print(f"{'ok ' if ok else 'FAIL'} {name:<{width}} {detail}")
124
+ rc |= 0 if ok else 1
125
+ return rc
126
+
127
+
128
+ def build_parser() -> argparse.ArgumentParser:
129
+ p = argparse.ArgumentParser(
130
+ prog="agentbench",
131
+ description="Agentic coding benchmark: build tasks, run models, grade runs.")
132
+ p.add_argument("--version", action="version", version=f"agentbench {__version__}")
133
+ p.add_argument("--home", help=f"workspace directory (default: {default_home()})")
134
+ sub = p.add_subparsers(dest="cmd", required=True)
135
+
136
+ b = sub.add_parser("build", help="generate task fixtures and hidden tests")
137
+ b.add_argument("--only", action="append", help="restrict to task ids (repeatable)")
138
+ b.set_defaults(func=cmd_build)
139
+
140
+ l = sub.add_parser("list", help="list tasks and categories")
141
+ l.add_argument("--json", action="store_true")
142
+ l.set_defaults(func=cmd_list)
143
+
144
+ r = sub.add_parser("run", help="run tasks against one or more models")
145
+ r.add_argument("--models", action="append", required=True,
146
+ help="model ids, comma or space separated (repeatable)")
147
+ r.add_argument("--tasks", action="append", help="task ids (default: all built)")
148
+ r.add_argument("--run-id")
149
+ r.add_argument("--timeout", type=int)
150
+ r.add_argument("--effort", choices=["minimal", "low", "medium", "high"])
151
+ r.add_argument("--workers", type=int)
152
+ r.add_argument("--resume", action="store_true")
153
+ r.set_defaults(func=cmd_run)
154
+
155
+ g = sub.add_parser("grade", help="grade a run directory")
156
+ g.add_argument("run_dir")
157
+ g.set_defaults(func=cmd_grade)
158
+
159
+ st = sub.add_parser("selftest", help="validate every grader against its reference")
160
+ st.set_defaults(func=cmd_selftest)
161
+
162
+ d = sub.add_parser("doctor", help="check local prerequisites")
163
+ d.set_defaults(func=cmd_doctor)
164
+ return p
165
+
166
+
167
+ def main(argv=None) -> int:
168
+ args = build_parser().parse_args(argv)
169
+ return args.func(args)
170
+
171
+
172
+ if __name__ == "__main__":
173
+ raise SystemExit(main())
@@ -0,0 +1,88 @@
1
+ """Configuration: where the workspace lives and which models/tasks exist."""
2
+ from __future__ import annotations
3
+
4
+ import json
5
+ import os
6
+ from dataclasses import dataclass, field
7
+ from pathlib import Path
8
+
9
+ PKG = Path(__file__).resolve().parent
10
+
11
+
12
+ def default_home() -> Path:
13
+ env = os.environ.get("AGENTBENCH_HOME")
14
+ if env:
15
+ return Path(env).expanduser()
16
+ return Path.home() / ".cache" / "agentbench"
17
+
18
+
19
+ def codex_binary() -> str:
20
+ return os.environ.get("AGENTBENCH_CODEX",
21
+ "/Applications/ChatGPT.app/Contents/Resources/codex-cli/"
22
+ "CodexCLI.app/Contents/MacOS/codex")
23
+
24
+
25
+ @dataclass
26
+ class Settings:
27
+ home: Path = field(default_factory=default_home)
28
+ effort: str = "low"
29
+ timeout: int = 900
30
+ workers: int = 1
31
+ codex: str = field(default_factory=codex_binary)
32
+ codex_home: Path | None = None
33
+
34
+ @property
35
+ def tasks_dir(self) -> Path:
36
+ return self.home / "tasks"
37
+
38
+ @property
39
+ def hidden_dir(self) -> Path:
40
+ return self.home / "hidden"
41
+
42
+ @property
43
+ def runs_dir(self) -> Path:
44
+ return self.home / "runs"
45
+
46
+ @property
47
+ def harness_home(self) -> Path:
48
+ return self.codex_home or (self.home / "codex-home")
49
+
50
+
51
+ def task_catalog() -> dict:
52
+ meta = json.loads((PKG / "data_meta.json").read_text())
53
+ return meta
54
+
55
+
56
+ def all_tasks(settings: Settings) -> list[str]:
57
+ if not settings.tasks_dir.exists():
58
+ return []
59
+ return sorted(p.name for p in settings.tasks_dir.iterdir() if p.is_dir())
60
+
61
+
62
+ def write_harness_home(settings: Settings) -> Path:
63
+ """Create a clean CODEX_HOME with the magpie provider and browser MCP."""
64
+ home = settings.harness_home
65
+ home.mkdir(parents=True, exist_ok=True)
66
+ base_url = os.environ.get("AGENTBENCH_GATEWAY", "http://127.0.0.1:3425/v1")
67
+ config = f'''model_provider = "magpie"
68
+ forced_login_method = "api"
69
+ approval_policy = "never"
70
+ sandbox_mode = "danger-full-access"
71
+ model_reasoning_effort = "{settings.effort}"
72
+ web_search = "disabled"
73
+ mcp_optional_startup_grace_ms = 0
74
+
75
+ [model_providers.magpie]
76
+ name = "magpie"
77
+ base_url = "{base_url}"
78
+ wire_api = "responses"
79
+ experimental_bearer_token = "magpie"
80
+ http_headers = {{ "x-openai-actor-authorization" = "magpie" }}
81
+
82
+ [mcp_servers.chrome-devtools]
83
+ command = "npx"
84
+ args = ["-y", "chrome-devtools-mcp@latest"]
85
+ startup_timeout_sec = 60.0
86
+ '''
87
+ (home / "config.toml").write_text(config)
88
+ return home