@tangle-network/agent-bench 2.0.0 → 4.0.0

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 (222) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +32 -2
  3. package/dist/adapters.d.ts +3 -3
  4. package/dist/adapters.js +3 -5
  5. package/dist/adapters.js.map +1 -1
  6. package/dist/benchmarks/_harness.d.ts +4 -4
  7. package/dist/benchmarks/_harness.js +5 -2
  8. package/dist/benchmarks/_harness.js.map +1 -1
  9. package/dist/benchmarks/aec-bench.d.ts +2 -2
  10. package/dist/benchmarks/aec-bench.js +49 -42
  11. package/dist/benchmarks/aec-bench.js.map +1 -1
  12. package/dist/benchmarks/agentbench.d.ts +2 -2
  13. package/dist/benchmarks/agentbench.js +41 -34
  14. package/dist/benchmarks/agentbench.js.map +1 -1
  15. package/dist/benchmarks/appworld.d.ts +4 -4
  16. package/dist/benchmarks/appworld.js +67 -53
  17. package/dist/benchmarks/appworld.js.map +1 -1
  18. package/dist/benchmarks/bfcl.d.ts +2 -2
  19. package/dist/benchmarks/bfcl.js +52 -44
  20. package/dist/benchmarks/bfcl.js.map +1 -1
  21. package/dist/benchmarks/cad-design.d.ts +2 -2
  22. package/dist/benchmarks/cad-design.js +53 -44
  23. package/dist/benchmarks/cad-design.js.map +1 -1
  24. package/dist/benchmarks/cadbench.d.ts +2 -2
  25. package/dist/benchmarks/cadbench.js +1 -1
  26. package/dist/benchmarks/cadgenbench.d.ts +2 -2
  27. package/dist/benchmarks/cadgenbench.js +1 -1
  28. package/dist/benchmarks/commit0.d.ts +2 -2
  29. package/dist/benchmarks/commit0.js +38 -31
  30. package/dist/benchmarks/commit0.js.map +1 -1
  31. package/dist/benchmarks/crag.d.ts +2 -2
  32. package/dist/benchmarks/crag.js +37 -32
  33. package/dist/benchmarks/crag.js.map +1 -1
  34. package/dist/benchmarks/dabstep.d.ts +2 -2
  35. package/dist/benchmarks/dabstep.js +41 -34
  36. package/dist/benchmarks/dabstep.js.map +1 -1
  37. package/dist/benchmarks/finresearchbench.d.ts +4 -4
  38. package/dist/benchmarks/finresearchbench.js +61 -48
  39. package/dist/benchmarks/finresearchbench.js.map +1 -1
  40. package/dist/benchmarks/finsearchcomp.d.ts +3 -3
  41. package/dist/benchmarks/finsearchcomp.js +54 -43
  42. package/dist/benchmarks/finsearchcomp.js.map +1 -1
  43. package/dist/benchmarks/frames.d.ts +2 -2
  44. package/dist/benchmarks/frames.js +66 -51
  45. package/dist/benchmarks/frames.js.map +1 -1
  46. package/dist/benchmarks/hotpotqa.d.ts +2 -2
  47. package/dist/benchmarks/hotpotqa.js +59 -47
  48. package/dist/benchmarks/hotpotqa.js.map +1 -1
  49. package/dist/benchmarks/humaneval.d.ts +3 -3
  50. package/dist/benchmarks/humaneval.js +39 -35
  51. package/dist/benchmarks/humaneval.js.map +1 -1
  52. package/dist/benchmarks/mcad-bench.d.ts +2 -2
  53. package/dist/benchmarks/mcad-bench.js +68 -56
  54. package/dist/benchmarks/mcad-bench.js.map +1 -1
  55. package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
  56. package/dist/benchmarks/mcad-cq-bench.js +69 -57
  57. package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
  58. package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
  59. package/dist/benchmarks/mcad-cq-golds.js +1 -1
  60. package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
  61. package/dist/benchmarks/mcad-golds.d.ts +1 -1
  62. package/dist/benchmarks/mcad-golds.js.map +1 -1
  63. package/dist/benchmarks/mind2web.d.ts +3 -3
  64. package/dist/benchmarks/mind2web.js +62 -49
  65. package/dist/benchmarks/mind2web.js.map +1 -1
  66. package/dist/benchmarks/nomiracl.d.ts +2 -2
  67. package/dist/benchmarks/nomiracl.js +43 -36
  68. package/dist/benchmarks/nomiracl.js.map +1 -1
  69. package/dist/benchmarks/open-rag-bench.d.ts +2 -2
  70. package/dist/benchmarks/open-rag-bench.js +37 -32
  71. package/dist/benchmarks/open-rag-bench.js.map +1 -1
  72. package/dist/benchmarks/programbench.d.ts +2 -2
  73. package/dist/benchmarks/programbench.js +28 -23
  74. package/dist/benchmarks/programbench.js.map +1 -1
  75. package/dist/benchmarks/rag-shared.d.ts +2 -2
  76. package/dist/benchmarks/rag-shared.js +15 -13
  77. package/dist/benchmarks/rag-shared.js.map +1 -1
  78. package/dist/benchmarks/ragbench.d.ts +2 -2
  79. package/dist/benchmarks/ragbench.js +34 -29
  80. package/dist/benchmarks/ragbench.js.map +1 -1
  81. package/dist/benchmarks/simpleqa.d.ts +2 -2
  82. package/dist/benchmarks/simpleqa.js +62 -51
  83. package/dist/benchmarks/simpleqa.js.map +1 -1
  84. package/dist/benchmarks/swe-bench.d.ts +4 -4
  85. package/dist/benchmarks/swe-bench.js +47 -41
  86. package/dist/benchmarks/swe-bench.js.map +1 -1
  87. package/dist/benchmarks/t2-ragbench.d.ts +2 -2
  88. package/dist/benchmarks/t2-ragbench.js +37 -32
  89. package/dist/benchmarks/t2-ragbench.js.map +1 -1
  90. package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
  91. package/dist/benchmarks/tau-bench-shared.js +43 -36
  92. package/dist/benchmarks/tau-bench-shared.js.map +1 -1
  93. package/dist/benchmarks/tau2-bench.d.ts +2 -2
  94. package/dist/benchmarks/tau2-bench.js.map +1 -1
  95. package/dist/benchmarks/tau3-banking.d.ts +2 -2
  96. package/dist/benchmarks/tau3-banking.js.map +1 -1
  97. package/dist/benchmarks/terminal-bench.d.ts +2 -2
  98. package/dist/benchmarks/terminal-bench.js +29 -23
  99. package/dist/benchmarks/terminal-bench.js.map +1 -1
  100. package/dist/benchmarks/toollm.d.ts +2 -2
  101. package/dist/benchmarks/toollm.js +40 -34
  102. package/dist/benchmarks/toollm.js.map +1 -1
  103. package/dist/benchmarks/trata-hedge.d.ts +2 -2
  104. package/dist/benchmarks/trata-hedge.js +46 -38
  105. package/dist/benchmarks/trata-hedge.js.map +1 -1
  106. package/dist/benchmarks/types.d.ts +33 -63
  107. package/dist/benchmarks/types.js +36 -1
  108. package/dist/benchmarks/types.js.map +1 -0
  109. package/dist/benchmarks/webarena-verified.d.ts +2 -2
  110. package/dist/benchmarks/webarena-verified.js +29 -24
  111. package/dist/benchmarks/webarena-verified.js.map +1 -1
  112. package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
  113. package/dist/cadbench-htzAmMaI.js.map +1 -0
  114. package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
  115. package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
  116. package/dist/cli.d.ts +1 -0
  117. package/dist/cli.js +667 -0
  118. package/dist/cli.js.map +1 -0
  119. package/dist/index.d.ts +43 -22
  120. package/dist/index.js +297 -144
  121. package/dist/index.js.map +1 -1
  122. package/package.json +7 -4
  123. package/pier_agents/candidate_contract.py +226 -74
  124. package/pier_agents/tangle_candidate.py +79 -1
  125. package/pier_agents/workspace_boundary.py +29 -1
  126. package/scripts/enterpriseops-gym-run.sh +82 -0
  127. package/scripts/grade-recorded-evidence.mjs +6 -6
  128. package/scripts/harvey-lab-judge.py +50 -0
  129. package/scripts/harvey-lab-run.sh +53 -0
  130. package/scripts/harvey-lab-sandbox.sh +21 -0
  131. package/scripts/healthbench-professional-run.sh +30 -0
  132. package/scripts/healthbench_professional_run.py +112 -0
  133. package/scripts/mlcr-run.sh +17 -0
  134. package/scripts/mlcr_run.py +133 -0
  135. package/scripts/prbench-run.sh +39 -0
  136. package/scripts/prbench_run.py +53 -0
  137. package/scripts/verify-packed-consumer.mjs +32 -27
  138. package/scripts/verify-pier-agent.mts +142 -25
  139. package/src/adapters.ts +5 -7
  140. package/src/benchmarks/_harness.test.mts +18 -1
  141. package/src/benchmarks/_harness.ts +12 -7
  142. package/src/benchmarks/aec-bench.test.mts +14 -14
  143. package/src/benchmarks/aec-bench.ts +62 -56
  144. package/src/benchmarks/agent-eval-contract.test.mts +38 -0
  145. package/src/benchmarks/agentbench.ts +44 -37
  146. package/src/benchmarks/appworld.test.mts +7 -7
  147. package/src/benchmarks/appworld.ts +88 -75
  148. package/src/benchmarks/bfcl.ts +60 -53
  149. package/src/benchmarks/cad-design.ts +34 -32
  150. package/src/benchmarks/cadbench.ts +34 -32
  151. package/src/benchmarks/cadgenbench.ts +30 -28
  152. package/src/benchmarks/commit0.test.mts +9 -9
  153. package/src/benchmarks/commit0.ts +50 -43
  154. package/src/benchmarks/crag.ts +45 -40
  155. package/src/benchmarks/dabstep-official.test.mts +8 -8
  156. package/src/benchmarks/dabstep.test.mts +11 -11
  157. package/src/benchmarks/dabstep.ts +47 -40
  158. package/src/benchmarks/external-adapters.test.mts +43 -44
  159. package/src/benchmarks/finresearchbench.ts +57 -47
  160. package/src/benchmarks/finsearchcomp.ts +72 -67
  161. package/src/benchmarks/frames.ts +76 -69
  162. package/src/benchmarks/hotpotqa.ts +69 -64
  163. package/src/benchmarks/humaneval.ts +37 -35
  164. package/src/benchmarks/mcad-bench.test.mts +30 -30
  165. package/src/benchmarks/mcad-bench.ts +66 -60
  166. package/src/benchmarks/mcad-cq-bench.ts +69 -63
  167. package/src/benchmarks/mcad-cq-golds.ts +1 -1
  168. package/src/benchmarks/mcad-cq.test.mts +40 -40
  169. package/src/benchmarks/mcad-golds.ts +1 -1
  170. package/src/benchmarks/mind2web.ts +66 -58
  171. package/src/benchmarks/nomiracl.ts +53 -46
  172. package/src/benchmarks/open-rag-bench.ts +47 -42
  173. package/src/benchmarks/programbench.test.mts +10 -10
  174. package/src/benchmarks/programbench.ts +38 -33
  175. package/src/benchmarks/rag-benchmarks.test.mts +31 -31
  176. package/src/benchmarks/rag-shared.ts +13 -16
  177. package/src/benchmarks/ragbench.ts +44 -39
  178. package/src/benchmarks/simpleqa.ts +78 -73
  179. package/src/benchmarks/swe-bench.test.mts +3 -3
  180. package/src/benchmarks/swe-bench.ts +66 -61
  181. package/src/benchmarks/t2-ragbench.ts +47 -42
  182. package/src/benchmarks/tau-bench-shared.ts +51 -44
  183. package/src/benchmarks/tau-pin.test.mts +1 -1
  184. package/src/benchmarks/tau2-bench.ts +2 -2
  185. package/src/benchmarks/tau3-banking.ts +2 -2
  186. package/src/benchmarks/terminal-bench.test.mts +3 -3
  187. package/src/benchmarks/terminal-bench.ts +41 -36
  188. package/src/benchmarks/toollm.ts +54 -47
  189. package/src/benchmarks/trata-hedge.ts +57 -52
  190. package/src/benchmarks/types.ts +70 -59
  191. package/src/benchmarks/webarena-verified.ts +49 -42
  192. package/src/cli.ts +74 -0
  193. package/src/corpus-replay.mts +9 -9
  194. package/src/examples/benchmark-matrix.mts +13 -10
  195. package/src/gate-cli.mts +5 -5
  196. package/src/gate.test.mts +14 -12
  197. package/src/gate.ts +23 -22
  198. package/src/index.ts +20 -11
  199. package/src/pier-agent.ts +108 -38
  200. package/src/pier-trial-controller.test.mts +48 -1
  201. package/src/pier-trial-controller.ts +121 -8
  202. package/src/published.test.mts +534 -0
  203. package/src/published.ts +524 -0
  204. package/src/run-benchmarks-cli.mts +2 -2
  205. package/src/run-benchmarks.test.mts +58 -48
  206. package/src/run-benchmarks.ts +64 -57
  207. package/src/swe-bench-env.ts +6 -6
  208. package/src/worker.ts +1 -1
  209. package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
  210. package/dist/benchmarks/enterpriseops-gym.js +0 -236
  211. package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
  212. package/dist/cadbench-Byr5gO1M.js.map +0 -1
  213. package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
  214. package/fixtures/enterpriseops-gym.json +0 -103
  215. package/scripts/enterpriseops_gym_judge.py +0 -281
  216. package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
  217. package/src/benchmarks/enterpriseops-gym.ts +0 -343
  218. package/src/eops-skills/address-every-subtask.md +0 -5
  219. package/src/eops-skills/exact-tools-and-args.md +0 -5
  220. package/src/eops-skills/full-sequence-to-goal.md +0 -5
  221. package/src/eops-skills/ground-every-value.md +0 -5
  222. package/src/eops-skills/honor-the-policies.md +0 -5
@@ -22,7 +22,7 @@
22
22
  import { readFile } from 'node:fs/promises'
23
23
  import { join } from 'node:path'
24
24
  import { benchRoot, preflightVenvImports, readJsonReport, runStagedJudge, stageFile, venvPython } from './_harness'
25
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
25
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
26
26
 
27
27
  const FIXTURES = join(benchRoot, 'fixtures', 'aec-bench.json')
28
28
 
@@ -70,11 +70,13 @@ function recordToTask(rec: AecRecord): BenchTask {
70
70
  }
71
71
  return {
72
72
  id: rec.id,
73
- split: rec.discipline,
74
- // instruction.md is fully self-contained and already specifies the exact JSON
75
- // output schema + the "write to /workspace/output.md" contract the verifier
76
- // keys off — we pass it through verbatim so the verify.py extractor matches.
77
- prompt: rec.instruction,
73
+ payload: {
74
+ subset: rec.discipline,
75
+ // instruction.md is fully self-contained and already specifies the exact JSON
76
+ // output schema + the "write to /workspace/output.md" contract the verifier
77
+ // keys off — we pass it through verbatim so the verify.py extractor matches.
78
+ prompt: rec.instruction,
79
+ },
78
80
  metadata: meta as unknown as Record<string, unknown>,
79
81
  }
80
82
  }
@@ -83,7 +85,7 @@ function readMeta(task: BenchTask): AecMeta {
83
85
  const md = task.metadata
84
86
  // Gold is optional (goldenPassMd may be null) — only the verifier + id are required.
85
87
  if (!md || typeof md.verifyPy !== 'string' || typeof md.taskId !== 'string') {
86
- throw new Error(`aec-bench task ${task.id} missing verifier metadata — loadTasks did not populate it`)
88
+ throw new Error(`aec-bench task ${task.id} missing verifier metadata — loadAll did not populate it`)
87
89
  }
88
90
  return md as unknown as AecMeta
89
91
  }
@@ -153,7 +155,7 @@ async function fetchInstance(id: string): Promise<AecRecord | null> {
153
155
 
154
156
  function selectFixtures(records: AecRecord[], opts: LoadOptions): BenchTask[] {
155
157
  let tasks = records.map(recordToTask)
156
- if (opts.split) tasks = tasks.filter((t) => t.split === opts.split)
158
+ if (opts.subset) tasks = tasks.filter((t) => t.payload.subset === opts.subset)
157
159
  if (opts.ids) {
158
160
  const want = new Set(opts.ids)
159
161
  tasks = tasks.filter((t) => want.has(t.id))
@@ -187,7 +189,7 @@ async function loadLive(opts: LoadOptions): Promise<BenchTask[]> {
187
189
  }
188
190
  const limit = opts.limit ?? DEFAULT_LIMIT
189
191
  let ids = await listAllInstances()
190
- if (opts.split) ids = ids.filter((id) => id.startsWith(`${opts.split}/`))
192
+ if (opts.subset) ids = ids.filter((id) => id.startsWith(`${opts.subset}/`))
191
193
  const records: AecRecord[] = []
192
194
  for (const id of ids) {
193
195
  if (records.length >= limit) break
@@ -201,7 +203,7 @@ async function loadLive(opts: LoadOptions): Promise<BenchTask[]> {
201
203
  }
202
204
  if (records.length === 0) {
203
205
  throw new Error(
204
- `aec-bench loadTasks found no runnable instances for ${JSON.stringify(opts)} ` +
206
+ `aec-bench loadAll found no runnable instances for ${JSON.stringify(opts)} ` +
205
207
  `(no tests/verify.py matched the requested split). Set AEC_FIXTURES=1 to run offline.`,
206
208
  )
207
209
  }
@@ -217,7 +219,7 @@ async function loadLive(opts: LoadOptions): Promise<BenchTask[]> {
217
219
  * NOT a silent 0 — verify.py's own except-trap writes reward 0.0, so an absent /
218
220
  * non-numeric reward.json is a real bug, surfaced by readJsonReport).
219
221
  */
220
- async function runVerifier(meta: AecMeta, artifact: string): Promise<BenchScore> {
222
+ async function runVerifier(meta: AecMeta, artifact: string): Promise<BenchEvaluation> {
221
223
  return runStagedJudge({
222
224
  tmpPrefix: 'aecbench-',
223
225
  timeoutMs: 120_000,
@@ -240,51 +242,25 @@ async function runVerifier(meta: AecMeta, artifact: string): Promise<BenchScore>
240
242
  () => ({}),
241
243
  )
242
244
  const score = Math.max(0, Math.min(1, reward))
245
+ const raw = { taskId: meta.taskId, discipline: meta.discipline, reward, fields: details }
243
246
  return {
244
- // resolved = full credit (all fields within tolerance), matching aec-bench's perfect_rate.
245
- resolved: score >= 1,
247
+ // passed = full credit (all fields within tolerance), matching aec-bench's perfect_rate.
248
+ passed: score >= 1,
246
249
  score,
247
- detail: JSON.stringify({ taskId: meta.taskId, discipline: meta.discipline, reward, fields: details }),
250
+ notes: JSON.stringify(raw),
251
+ raw,
248
252
  }
249
253
  },
250
254
  })
251
255
  }
252
256
 
253
- export function createAecBenchAdapter(): BenchmarkAdapter {
257
+ export function createAecBenchAdapter(): RuntimeBenchmark {
254
258
  const fixturesMode = process.env.AEC_FIXTURES === '1'
255
259
 
256
- return {
257
- name: 'aec-bench',
260
+ return runtimeBenchmark({
261
+ id: 'aec-bench',
258
262
 
259
- async preflight() {
260
- // The verifier is python3 over the stdlib (math/json/re) — no pip install.
261
- // Reuse the shared import-probe so the bench venv interpreter is proven to
262
- // exist + run before any judge spawns verify.py.
263
- await preflightVenvImports({
264
- modules: ['math', 'json', 're'],
265
- requireDocker: false,
266
- fix: 'Fix: python3 -m venv bench/.venv (verify.py only needs the stdlib — no pip install).',
267
- })
268
- if (fixturesMode) {
269
- await readFile(FIXTURES, 'utf8').catch((err) => {
270
- throw new Error(`AEC_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`)
271
- })
272
- return
273
- }
274
- const res = await fetch(`${RAW}/README.md`, { method: 'HEAD' }).catch((err) => {
275
- throw new Error(
276
- `aec-bench preflight failed reaching ${RAW}: ${err instanceof Error ? err.message : err}\n` +
277
- `Fix: ensure network access to raw.githubusercontent.com, or set AEC_FIXTURES=1 to run offline.`,
278
- )
279
- })
280
- if (!res.ok) {
281
- throw new Error(
282
- `aec-bench preflight: ${REPO} README HEAD ${res.status}. Set AEC_FIXTURES=1 to run against committed fixtures.`,
283
- )
284
- }
285
- },
286
-
287
- async loadTasks(opts: LoadOptions = {}) {
263
+ async loadAll(opts: LoadOptions = {}) {
288
264
  if (fixturesMode) return loadFixtures(opts)
289
265
  try {
290
266
  return await loadLive(opts)
@@ -301,19 +277,49 @@ export function createAecBenchAdapter(): BenchmarkAdapter {
301
277
  }
302
278
  },
303
279
 
304
- async goldArtifact(task: BenchTask) {
305
- // Gold = the task's own golden_pass.md (scores reward 1.0 through the SAME
306
- // verify.py the real artifact takes), proving the judge end-to-end. Tasks
307
- // without a golden_pass.md (non-md ground truth) have no oracle artifact.
308
- const meta = readMeta(task)
309
- return meta.goldenPassMd ?? undefined
310
- },
311
-
312
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
280
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
313
281
  const meta = readMeta(task)
314
282
  // verify.py fail-closes an empty/unparseable artifact to reward 0.0 itself,
315
283
  // so we pass it straight through (no pre-judging here).
316
284
  return runVerifier(meta, artifact)
317
285
  },
318
- }
286
+
287
+ runtime: {
288
+ async preflight() {
289
+ // The verifier is python3 over the stdlib (math/json/re) — no pip install.
290
+ // Reuse the shared import-probe so the bench venv interpreter is proven to
291
+ // exist + run before any judge spawns verify.py.
292
+ await preflightVenvImports({
293
+ modules: ['math', 'json', 're'],
294
+ requireDocker: false,
295
+ fix: 'Fix: python3 -m venv bench/.venv (verify.py only needs the stdlib — no pip install).',
296
+ })
297
+ if (fixturesMode) {
298
+ await readFile(FIXTURES, 'utf8').catch((err) => {
299
+ throw new Error(`AEC_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`)
300
+ })
301
+ return
302
+ }
303
+ const res = await fetch(`${RAW}/README.md`, { method: 'HEAD' }).catch((err) => {
304
+ throw new Error(
305
+ `aec-bench preflight failed reaching ${RAW}: ${err instanceof Error ? err.message : err}\n` +
306
+ `Fix: ensure network access to raw.githubusercontent.com, or set AEC_FIXTURES=1 to run offline.`,
307
+ )
308
+ })
309
+ if (!res.ok) {
310
+ throw new Error(
311
+ `aec-bench preflight: ${REPO} README HEAD ${res.status}. Set AEC_FIXTURES=1 to run against committed fixtures.`,
312
+ )
313
+ }
314
+ },
315
+
316
+ async goldArtifact(task: BenchTask) {
317
+ // Gold = the task's own golden_pass.md (scores reward 1.0 through the SAME
318
+ // verify.py the real artifact takes), proving the judge end-to-end. Tasks
319
+ // without a golden_pass.md (non-md ground truth) have no oracle artifact.
320
+ const meta = readMeta(task)
321
+ return meta.goldenPassMd ?? undefined
322
+ },
323
+ },
324
+ })
319
325
  }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * A ported adapter is agent-eval's `BenchmarkAdapter`: agent-eval's own runner takes it as is, and a real
3
+ * HotpotQA validation item (hotpotqa/hotpot_qa distractor, committed in bench/fixtures) runs through its
4
+ * runtime hooks and the published EM/F1 metric. No model, network or Docker.
5
+ */
6
+ import assert from 'node:assert/strict'
7
+ import { test } from 'node:test'
8
+ import { benchmarkScenarios } from '@tangle-network/agent-eval/benchmarks'
9
+ import { createHotpotqaAdapter } from './hotpotqa'
10
+
11
+ process.env.HOTPOTQA_FIXTURES = '1'
12
+
13
+ test('a real HotpotQA item runs through the agent-eval contract and the runtime hooks', async () => {
14
+ const adapter = createHotpotqaAdapter()
15
+ await adapter.runtime.preflight!()
16
+ const all = await adapter.loadAll()
17
+ assert.ok(all.length > 1, 'the committed validation rows load')
18
+
19
+ // agent-eval's runner reads the same tasks through loadDataset, each once, in the split assignSplit names.
20
+ const scenarios = await benchmarkScenarios(adapter)
21
+ assert.deepEqual(scenarios.map((s) => s.item.id).sort(), all.map((t) => t.id).sort())
22
+ for (const s of scenarios) assert.equal(s.splitTag, adapter.assignSplit(s.item.id))
23
+
24
+ const id = 'hotpotqa-5a8c7595554299585d9e36b6'
25
+ const [task] = await adapter.loadAll({ ids: [id] })
26
+ assert.equal(task?.id, id)
27
+ assert.match(adapter.runtime.prompt(task!), /Corliss Archer/)
28
+
29
+ const gold = await adapter.runtime.goldArtifact!(task!)
30
+ assert.ok(gold, 'the gold answer serializes through the worker contract')
31
+ const right = await adapter.evaluate(task!, gold!)
32
+ assert.equal(right.passed, true)
33
+ assert.equal(right.score, 1)
34
+
35
+ const wrong = await adapter.evaluate(task!, 'FINAL ANSWER: Secretary of State')
36
+ assert.equal(wrong.passed, false)
37
+ assert.ok(wrong.score < 1)
38
+ })
@@ -11,7 +11,7 @@ import { readFile } from 'node:fs/promises'
11
11
  import { join } from 'node:path'
12
12
  import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
13
13
  import { benchRoot } from './_harness'
14
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
14
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
15
15
 
16
16
  const FIXTURES = join(benchRoot, 'fixtures', 'agentbench-dbbench.json')
17
17
  const DEFAULT_SPLIT = 'dev'
@@ -69,18 +69,20 @@ function rowToTask(row: AgentBenchDbRow, index: number, split: string): BenchTas
69
69
  }
70
70
  return {
71
71
  id: `dbbench-${split}-${index}`,
72
- split,
73
- prompt: [
74
- 'Answer this AgentBench DBBench question using the table below.',
75
- 'Return only the answer value.',
76
- '',
77
- `Question: ${row.description}`,
78
- row.table?.table_name ? `Table: ${row.table.table_name}` : undefined,
79
- columns ? `Columns: ${columns}` : undefined,
80
- sampleRows ? `Rows JSON: ${JSON.stringify(sampleRows)}` : undefined,
81
- ]
82
- .filter(Boolean)
83
- .join('\n'),
72
+ payload: {
73
+ subset: split,
74
+ prompt: [
75
+ 'Answer this AgentBench DBBench question using the table below.',
76
+ 'Return only the answer value.',
77
+ '',
78
+ `Question: ${row.description}`,
79
+ row.table?.table_name ? `Table: ${row.table.table_name}` : undefined,
80
+ columns ? `Columns: ${columns}` : undefined,
81
+ sampleRows ? `Rows JSON: ${JSON.stringify(sampleRows)}` : undefined,
82
+ ]
83
+ .filter(Boolean)
84
+ .join('\n'),
85
+ },
84
86
  metadata: meta as unknown as Record<string, unknown>,
85
87
  }
86
88
  }
@@ -88,7 +90,7 @@ function rowToTask(row: AgentBenchDbRow, index: number, split: string): BenchTas
88
90
  function readMeta(task: BenchTask): AgentBenchMeta {
89
91
  const md = task.metadata
90
92
  if (!md || !Array.isArray(md.labels)) {
91
- throw new Error(`agentbench task ${task.id} missing metadata — loadTasks did not populate it`)
93
+ throw new Error(`agentbench task ${task.id} missing metadata — loadAll did not populate it`)
92
94
  }
93
95
  return md as unknown as AgentBenchMeta
94
96
  }
@@ -120,44 +122,49 @@ async function loadFixtures(opts: LoadOptions, split: string): Promise<BenchTask
120
122
  return selectRows(rows, opts, split)
121
123
  }
122
124
 
123
- export function createAgentBenchAdapter(): BenchmarkAdapter {
125
+ export function createAgentBenchAdapter(): RuntimeBenchmark {
124
126
  const fixturesMode = process.env.AGENTBENCH_FIXTURES === '1'
125
127
 
126
- return {
127
- name: 'agentbench',
128
- output: agentbenchAnswerOutput,
129
-
130
- async preflight() {
131
- if (fixturesMode) return
132
- const dir = agentbenchDir()
133
- if (!dir) {
134
- throw new Error('AGENTBENCH_DIR is required. Fix: clone https://github.com/THUDM/AgentBench and set AGENTBENCH_DIR=/path/to/AgentBench.')
135
- }
136
- await loadJsonl(join(dir, 'data', 'dbbench', `${DEFAULT_SPLIT}.jsonl`))
137
- },
128
+ return runtimeBenchmark({
129
+ id: 'agentbench',
138
130
 
139
- async loadTasks(opts: LoadOptions = {}) {
140
- const split = opts.split ?? DEFAULT_SPLIT
131
+ async loadAll(opts: LoadOptions = {}) {
132
+ const split = opts.subset ?? DEFAULT_SPLIT
141
133
  if (fixturesMode) return loadFixtures(opts, split)
142
134
  const dir = agentbenchDir()
143
135
  if (!dir) throw new Error('AGENTBENCH_DIR is required to load AgentBench DBBench tasks')
144
136
  return selectRows(await loadJsonl(join(dir, 'data', 'dbbench', `${split}.jsonl`)), opts, split)
145
137
  },
146
138
 
147
- async goldArtifact(task: BenchTask) {
148
- return readMeta(task).labels[0]
149
- },
150
-
151
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
139
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
152
140
  const meta = readMeta(task)
153
141
  const got = normalizeAnswer(artifact)
154
142
  const expected = meta.labels.map(normalizeAnswer)
155
143
  const resolved = expected.includes(got)
144
+ const raw = { subset: meta.subset, split: meta.split, expected: meta.labels, got: artifact }
156
145
  return {
157
- resolved,
146
+ passed: resolved,
158
147
  score: resolved ? 1 : 0,
159
- detail: JSON.stringify({ subset: meta.subset, split: meta.split, expected: meta.labels, got: artifact }),
148
+ notes: JSON.stringify(raw),
149
+ raw,
160
150
  }
161
151
  },
162
- }
152
+
153
+ runtime: {
154
+ output: agentbenchAnswerOutput,
155
+
156
+ async preflight() {
157
+ if (fixturesMode) return
158
+ const dir = agentbenchDir()
159
+ if (!dir) {
160
+ throw new Error('AGENTBENCH_DIR is required. Fix: clone https://github.com/THUDM/AgentBench and set AGENTBENCH_DIR=/path/to/AgentBench.')
161
+ }
162
+ await loadJsonl(join(dir, 'data', 'dbbench', `${DEFAULT_SPLIT}.jsonl`))
163
+ },
164
+
165
+ async goldArtifact(task: BenchTask) {
166
+ return readMeta(task).labels[0]
167
+ },
168
+ },
169
+ })
163
170
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Offline AppWorld adapter test. AppWorld has NO committed fixture (task data
3
3
  * exists only after `appworld download data`; fabricating a task would be a fake),
4
- * so loadTasks/judge both require the live engine. This exercises the only offline
4
+ * so loadAll/evaluate both require the live engine. This exercises the only offline
5
5
  * surface (the solution OutputAdapter, goldArtifact) and asserts preflight + the
6
- * engine-backed loadTasks FAIL LOUD with the documented install steps — never a
6
+ * engine-backed loadAll FAIL LOUD with the documented install steps — never a
7
7
  * fabricated task or score. Run: npx tsx --test src/benchmarks/appworld.test.mts
8
8
  */
9
9
  import assert from 'node:assert/strict'
@@ -30,13 +30,13 @@ test('solution OutputAdapter: last fenced ```python wins; fence-less falls back
30
30
 
31
31
  test('goldArtifact is undefined — reference solution ships only inside the engine bundle, not portable', async () => {
32
32
  const a = createAppWorldAdapter()
33
- assert.equal(await a.goldArtifact({ id: 't', prompt: '', metadata: { taskId: 't', split: 'dev' } }), undefined)
33
+ assert.equal(await a.runtime.goldArtifact!({ id: 't', payload: { prompt: '' }, metadata: { taskId: 't', split: 'dev' } }), undefined)
34
34
  })
35
35
 
36
36
  test('preflight passes when installed or FAILS LOUD with the install + download-data fix', async () => {
37
37
  const a = createAppWorldAdapter()
38
38
  try {
39
- await a.preflight()
39
+ await a.runtime.preflight!()
40
40
  } catch (err) {
41
41
  const e = err as Error
42
42
  assert.match(e.message, /pip install appworld/)
@@ -44,13 +44,13 @@ test('preflight passes when installed or FAILS LOUD with the install + download-
44
44
  }
45
45
  })
46
46
 
47
- test('loadTasks either enumerates live engine rows or FAILS LOUD without fabricating tasks', async () => {
47
+ test('loadAll either enumerates live engine rows or FAILS LOUD without fabricating tasks', async () => {
48
48
  const a = createAppWorldAdapter()
49
49
  try {
50
- const tasks = await a.loadTasks({ limit: 1 })
50
+ const tasks = await a.loadAll({ limit: 1 })
51
51
  assert.equal(tasks.length, 1)
52
52
  assert.ok(tasks[0].id.length > 0)
53
- assert.match(tasks[0].prompt, /Solve this by writing Python/)
53
+ assert.match(tasks[0].payload.prompt, /Solve this by writing Python/)
54
54
  } catch (err) {
55
55
  assert.match((err as Error).message, /appworld driver failed|appworld import failed/)
56
56
  }
@@ -6,16 +6,16 @@
6
6
  * evaluator: a driver runs the solution in a fresh `AppWorld(task_id=...)` world,
7
7
  * then `world.evaluate().to_dict()` reports `success` (binary TGC), `num_tests`
8
8
  * (per-requirement total) and the `passes`/`failures` lists. Score =
9
- * passes / num_tests — GRADED; resolved = success. Fully deterministic — no LLM judge.
9
+ * passes / num_tests — GRADED; passed = success. Fully deterministic — no LLM judge.
10
10
  *
11
- * loadTasks enumerates the real task suite via `load_task_ids(split)`
11
+ * loadAll enumerates the real task suite via `load_task_ids(split)`
12
12
  * (train|dev|test_normal|test_challenge); the prompt = `world.task.instruction`.
13
13
  * The OutputAdapter is stream-only, so the worker emits its solution as a fenced
14
14
  * ```python block which the driver executes.
15
15
  *
16
16
  * Requires for a live run: the bench `.venv` with `appworld` installed + the
17
17
  * unpacked engine + downloaded data (`appworld install` ; `appworld download
18
- * data`). preflight + loadTasks + judge all fail loud with the exact step when the
18
+ * data`). preflight + loadAll + evaluate all fail loud with the exact step when the
19
19
  * engine/data is absent — never a fabricated score.
20
20
  */
21
21
 
@@ -30,7 +30,7 @@ import {
30
30
  type ToolSpec,
31
31
  } from '@tangle-network/agent-runtime/kernel'
32
32
  import { benchRoot, preflightVenvImports, runVenvScriptStdin, venvPython } from './_harness'
33
- import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
33
+ import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
34
34
 
35
35
  const DRIVER = join(benchRoot, 'scripts', 'appworld_driver.py')
36
36
 
@@ -66,7 +66,7 @@ const WORKER_CONTRACT = [
66
66
  function readMeta(task: BenchTask): AppWorldMeta {
67
67
  const md = task.metadata
68
68
  if (!md || typeof md.taskId !== 'string') {
69
- throw new Error(`appworld task ${task.id} missing metadata.taskId — loadTasks did not populate it`)
69
+ throw new Error(`appworld task ${task.id} missing metadata.taskId — loadAll did not populate it`)
70
70
  }
71
71
  return md as unknown as AppWorldMeta
72
72
  }
@@ -91,25 +91,12 @@ async function driver(args: string[], input = ''): Promise<unknown> {
91
91
  return parsed
92
92
  }
93
93
 
94
- export function createAppWorldAdapter(): BenchmarkAdapter {
95
- return {
96
- name: 'appworld',
97
- output: appworldSolutionOutput,
98
-
99
- async preflight() {
100
- await preflightVenvImports({
101
- modules: ['appworld'],
102
- requireDocker: false,
103
- fix:
104
- 'Fix: bench/.venv/bin/pip install appworld ; ' +
105
- 'bench/.venv/bin/appworld install ; bench/.venv/bin/appworld download data ' +
106
- '(unpacks the engine + downloads the simulated-app data/tasks). ' +
107
- 'Set APPWORLD_ROOT to the data root if not the default.',
108
- })
109
- },
94
+ export function createAppWorldAdapter(): RuntimeBenchmark {
95
+ return runtimeBenchmark({
96
+ id: 'appworld',
110
97
 
111
- async loadTasks(opts: LoadOptions = {}): Promise<BenchTask[]> {
112
- const split = opts.split ?? DEFAULT_SPLIT
98
+ async loadAll(opts: LoadOptions = {}): Promise<BenchTask[]> {
99
+ const split = opts.subset ?? DEFAULT_SPLIT
113
100
  const out = (await driver([
114
101
  'load',
115
102
  '--split', split,
@@ -118,29 +105,21 @@ export function createAppWorldAdapter(): BenchmarkAdapter {
118
105
  ])) as { tasks?: Array<{ task_id: string; instruction: string }> }
119
106
  const tasks = out.tasks ?? []
120
107
  if (tasks.length === 0) {
121
- throw new Error(`appworld loadTasks returned no tasks for split=${split} ${JSON.stringify(opts)}`)
108
+ throw new Error(`appworld loadAll returned no tasks for split=${split} ${JSON.stringify(opts)}`)
122
109
  }
123
110
  return tasks.map(
124
111
  (t): BenchTask => ({
125
112
  id: t.task_id,
126
- split,
127
- prompt: t.instruction + WORKER_CONTRACT,
113
+ payload: {
114
+ subset: split,
115
+ prompt: t.instruction + WORKER_CONTRACT,
116
+ },
128
117
  metadata: { taskId: t.task_id, split } as unknown as Record<string, unknown>,
129
118
  }),
130
119
  )
131
120
  },
132
121
 
133
- async goldArtifact() {
134
- // Reference solution code ships only for train/dev, and only inside the
135
- // engine's decrypted `.bundle` (it is not a portable string this adapter can
136
- // emit across splits). The test splits are evaluation-only. So verify-judge
137
- // here requires a real solve on a train/dev task through the live engine
138
- // rather than a synthetic gold — returning a fabricated artifact would be a
139
- // fake. Returns undefined.
140
- return undefined
141
- },
142
-
143
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
122
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
144
123
  const meta = readMeta(task)
145
124
  const out = (await driver(['evaluate', '--task-id', meta.taskId, '--split', meta.split], artifact)) as {
146
125
  success?: boolean
@@ -157,22 +136,50 @@ export function createAppWorldAdapter(): BenchmarkAdapter {
157
136
  const total = out.num_tests ?? passes + fails
158
137
  const score = total > 0 ? passes / total : 0
159
138
  // failure_names = WHICH sub-tests failed — the evidence a trace analyst
160
- // steers on. Carried in `detail` so it reaches the verdict's `notes`.
139
+ // steers on. Carried in `raw` (and `notes`) so it reaches the verdict.
161
140
  const failures = Array.isArray(out.failure_names) ? out.failure_names : []
141
+ const raw = {
142
+ taskId: meta.taskId,
143
+ success: out.success,
144
+ passes,
145
+ fails,
146
+ total,
147
+ ...(failures.length ? { failures } : {}),
148
+ }
162
149
  return {
163
- resolved: out.success === true,
150
+ passed: out.success === true,
164
151
  score,
165
- detail: JSON.stringify({
166
- taskId: meta.taskId,
167
- success: out.success,
168
- passes,
169
- fails,
170
- total,
171
- ...(failures.length ? { failures } : {}),
172
- }),
152
+ notes: JSON.stringify(raw),
153
+ raw,
173
154
  }
174
155
  },
175
- }
156
+
157
+ runtime: {
158
+ output: appworldSolutionOutput,
159
+
160
+ async preflight() {
161
+ await preflightVenvImports({
162
+ modules: ['appworld'],
163
+ requireDocker: false,
164
+ fix:
165
+ 'Fix: bench/.venv/bin/pip install appworld ; ' +
166
+ 'bench/.venv/bin/appworld install ; bench/.venv/bin/appworld download data ' +
167
+ '(unpacks the engine + downloads the simulated-app data/tasks). ' +
168
+ 'Set APPWORLD_ROOT to the data root if not the default.',
169
+ })
170
+ },
171
+
172
+ async goldArtifact() {
173
+ // Reference solution code ships only for train/dev, and only inside the
174
+ // engine's decrypted `.bundle` (it is not a portable string this adapter can
175
+ // emit across splits). The test splits are evaluation-only. So verify-judge
176
+ // here requires a real solve on a train/dev task through the live engine
177
+ // rather than a synthetic gold — returning a fabricated artifact would be a
178
+ // fake. Returns undefined.
179
+ return undefined
180
+ },
181
+ },
182
+ })
176
183
  }
177
184
 
178
185
  /**
@@ -193,7 +200,7 @@ export function createAppWorldAdapter(): BenchmarkAdapter {
193
200
  * line 1; everything after line 1 is the steer (an analyst correction, a push
194
201
  * directive) appended to the system prompt — so the existing arms steer this
195
202
  * worker without modification. The artifact is the episode evaluation JSON
196
- * (AppWorld's evaluator ran in-world); judge() parses it, never re-executes.
203
+ * (AppWorld's evaluator ran in-world); evaluate() parses it, never re-executes.
197
204
  */
198
205
 
199
206
  export interface ReactResult {
@@ -488,29 +495,28 @@ const reactEpisodeOutput: OutputAdapter<string> = {
488
495
  },
489
496
  }
490
497
 
491
- export function createAppWorldReactAdapter(): BenchmarkAdapter {
498
+ export function createAppWorldReactAdapter(): RuntimeBenchmark {
492
499
  const base = createAppWorldAdapter()
493
- return {
494
- name: 'appworld-react',
495
- output: reactEpisodeOutput,
496
- preflight: () => base.preflight(),
500
+ return runtimeBenchmark({
501
+ id: 'appworld-react',
497
502
 
498
- async loadTasks(opts: LoadOptions = {}): Promise<BenchTask[]> {
499
- const tasks = await base.loadTasks(opts)
503
+ async loadAll(opts: LoadOptions = {}): Promise<BenchTask[]> {
504
+ const tasks = await base.loadAll(opts)
500
505
  return tasks.map((t) => {
501
506
  const meta = readMeta(t)
502
507
  return {
503
508
  ...t,
504
- // Header carries task identity to the leaf; the body (empty at round 0)
505
- // is the directive slot the arms append their steer into.
506
- prompt: `@appworld-react ${meta.taskId} ${meta.split}\n`,
509
+ payload: {
510
+ ...t.payload,
511
+ // Header carries task identity to the leaf; the body (empty at round 0)
512
+ // is the directive slot the arms append their steer into.
513
+ prompt: `@appworld-react ${meta.taskId} ${meta.split}\n`,
514
+ },
507
515
  }
508
516
  })
509
517
  },
510
518
 
511
- goldArtifact: () => Promise.resolve(undefined),
512
-
513
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
519
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
514
520
  const meta = readMeta(task)
515
521
  let out: ReactResult
516
522
  try {
@@ -528,22 +534,29 @@ export function createAppWorldReactAdapter(): BenchmarkAdapter {
528
534
  const passes = out.passes ?? 0
529
535
  const total = out.num_tests
530
536
  const failures = Array.isArray(out.failure_names) ? out.failure_names : []
537
+ const raw = {
538
+ taskId: meta.taskId,
539
+ success: out.success,
540
+ passes,
541
+ fails: out.fails ?? 0,
542
+ total,
543
+ turns: out.turns,
544
+ ...(failures.length ? { failures } : {}),
545
+ ...(out.transcript ? { transcriptTail: out.transcript.slice(-800) } : {}),
546
+ }
531
547
  return {
532
- resolved: out.success === true,
548
+ passed: out.success === true,
533
549
  score: total > 0 ? passes / total : 0,
534
- detail: JSON.stringify({
535
- taskId: meta.taskId,
536
- success: out.success,
537
- passes,
538
- fails: out.fails ?? 0,
539
- total,
540
- turns: out.turns,
541
- ...(failures.length ? { failures } : {}),
542
- ...(out.transcript ? { transcriptTail: out.transcript.slice(-800) } : {}),
543
- }),
550
+ notes: JSON.stringify(raw),
551
+ raw,
544
552
  }
545
553
  },
546
554
 
547
- leafClient: (c) => appworldToolLoopClient(c),
548
- }
555
+ runtime: {
556
+ output: reactEpisodeOutput,
557
+ preflight: async () => base.runtime.preflight?.(),
558
+ goldArtifact: () => Promise.resolve(undefined),
559
+ worker: (c) => appworldToolLoopClient(c),
560
+ },
561
+ })
549
562
  }