@tangle-network/agent-bench 2.0.0 → 3.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 (215) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +24 -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 +9 -8
  120. package/dist/index.js +61 -56
  121. package/dist/index.js.map +1 -1
  122. package/package.json +7 -4
  123. package/scripts/enterpriseops-gym-run.sh +82 -0
  124. package/scripts/grade-recorded-evidence.mjs +6 -6
  125. package/scripts/harvey-lab-judge.py +50 -0
  126. package/scripts/harvey-lab-run.sh +53 -0
  127. package/scripts/harvey-lab-sandbox.sh +21 -0
  128. package/scripts/healthbench-professional-run.sh +30 -0
  129. package/scripts/healthbench_professional_run.py +112 -0
  130. package/scripts/mlcr-run.sh +17 -0
  131. package/scripts/mlcr_run.py +133 -0
  132. package/scripts/prbench-run.sh +39 -0
  133. package/scripts/prbench_run.py +53 -0
  134. package/scripts/verify-packed-consumer.mjs +32 -27
  135. package/src/adapters.ts +5 -7
  136. package/src/benchmarks/_harness.test.mts +18 -1
  137. package/src/benchmarks/_harness.ts +12 -7
  138. package/src/benchmarks/aec-bench.test.mts +14 -14
  139. package/src/benchmarks/aec-bench.ts +62 -56
  140. package/src/benchmarks/agent-eval-contract.test.mts +38 -0
  141. package/src/benchmarks/agentbench.ts +44 -37
  142. package/src/benchmarks/appworld.test.mts +7 -7
  143. package/src/benchmarks/appworld.ts +88 -75
  144. package/src/benchmarks/bfcl.ts +60 -53
  145. package/src/benchmarks/cad-design.ts +34 -32
  146. package/src/benchmarks/cadbench.ts +34 -32
  147. package/src/benchmarks/cadgenbench.ts +30 -28
  148. package/src/benchmarks/commit0.test.mts +9 -9
  149. package/src/benchmarks/commit0.ts +50 -43
  150. package/src/benchmarks/crag.ts +45 -40
  151. package/src/benchmarks/dabstep-official.test.mts +8 -8
  152. package/src/benchmarks/dabstep.test.mts +11 -11
  153. package/src/benchmarks/dabstep.ts +47 -40
  154. package/src/benchmarks/external-adapters.test.mts +43 -44
  155. package/src/benchmarks/finresearchbench.ts +57 -47
  156. package/src/benchmarks/finsearchcomp.ts +72 -67
  157. package/src/benchmarks/frames.ts +76 -69
  158. package/src/benchmarks/hotpotqa.ts +69 -64
  159. package/src/benchmarks/humaneval.ts +37 -35
  160. package/src/benchmarks/mcad-bench.test.mts +30 -30
  161. package/src/benchmarks/mcad-bench.ts +66 -60
  162. package/src/benchmarks/mcad-cq-bench.ts +69 -63
  163. package/src/benchmarks/mcad-cq-golds.ts +1 -1
  164. package/src/benchmarks/mcad-cq.test.mts +40 -40
  165. package/src/benchmarks/mcad-golds.ts +1 -1
  166. package/src/benchmarks/mind2web.ts +66 -58
  167. package/src/benchmarks/nomiracl.ts +53 -46
  168. package/src/benchmarks/open-rag-bench.ts +47 -42
  169. package/src/benchmarks/programbench.test.mts +10 -10
  170. package/src/benchmarks/programbench.ts +38 -33
  171. package/src/benchmarks/rag-benchmarks.test.mts +31 -31
  172. package/src/benchmarks/rag-shared.ts +13 -16
  173. package/src/benchmarks/ragbench.ts +44 -39
  174. package/src/benchmarks/simpleqa.ts +78 -73
  175. package/src/benchmarks/swe-bench.test.mts +3 -3
  176. package/src/benchmarks/swe-bench.ts +66 -61
  177. package/src/benchmarks/t2-ragbench.ts +47 -42
  178. package/src/benchmarks/tau-bench-shared.ts +51 -44
  179. package/src/benchmarks/tau-pin.test.mts +1 -1
  180. package/src/benchmarks/tau2-bench.ts +2 -2
  181. package/src/benchmarks/tau3-banking.ts +2 -2
  182. package/src/benchmarks/terminal-bench.test.mts +3 -3
  183. package/src/benchmarks/terminal-bench.ts +41 -36
  184. package/src/benchmarks/toollm.ts +54 -47
  185. package/src/benchmarks/trata-hedge.ts +57 -52
  186. package/src/benchmarks/types.ts +70 -59
  187. package/src/benchmarks/webarena-verified.ts +49 -42
  188. package/src/cli.ts +74 -0
  189. package/src/corpus-replay.mts +9 -9
  190. package/src/examples/benchmark-matrix.mts +13 -10
  191. package/src/gate-cli.mts +5 -5
  192. package/src/gate.test.mts +14 -12
  193. package/src/gate.ts +23 -22
  194. package/src/index.ts +17 -11
  195. package/src/published.test.mts +534 -0
  196. package/src/published.ts +524 -0
  197. package/src/run-benchmarks-cli.mts +2 -2
  198. package/src/run-benchmarks.test.mts +58 -48
  199. package/src/run-benchmarks.ts +64 -57
  200. package/src/swe-bench-env.ts +6 -6
  201. package/src/worker.ts +1 -1
  202. package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
  203. package/dist/benchmarks/enterpriseops-gym.js +0 -236
  204. package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
  205. package/dist/cadbench-Byr5gO1M.js.map +0 -1
  206. package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
  207. package/fixtures/enterpriseops-gym.json +0 -103
  208. package/scripts/enterpriseops_gym_judge.py +0 -281
  209. package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
  210. package/src/benchmarks/enterpriseops-gym.ts +0 -343
  211. package/src/eops-skills/address-every-subtask.md +0 -5
  212. package/src/eops-skills/exact-tools-and-args.md +0 -5
  213. package/src/eops-skills/full-sequence-to-goal.md +0 -5
  214. package/src/eops-skills/ground-every-value.md +0 -5
  215. package/src/eops-skills/honor-the-policies.md +0 -5
@@ -1,25 +1,38 @@
1
1
  /**
2
- * BenchmarkAdapter — the seam every external benchmark implements so the
3
- * agent-runtime loop can be A/B'd (blind vs steering vs steering+memory) against
4
- * a REAL, DETERMINISTIC judge. The worker produces an `artifact` (a patch, a
5
- * command transcript, a final state); the benchmark's own harness scores it.
2
+ * agent-bench's benchmarks are agent-eval `BenchmarkAdapter`s, the one benchmark contract, each with the
3
+ * `runtime` hooks an agent-runtime worker needs: the prompt, the deliverable parser, the in-box workspace
4
+ * setup and extraction, and, where the benchmark's own protocol is the worker, that worker.
6
5
  *
7
- * The point: no self-authored judge, no invented score noise. The number comes
8
- * from the benchmark's published evaluation harness.
6
+ * The point: no self-authored judge, no invented score noise. `evaluate` is the benchmark's published
7
+ * evaluation harness, run on the artifact the worker produced.
8
+ *
9
+ * A public benchmark reports every task, so each one also has `loadAll`, a loader that ignores agent-eval's
10
+ * search/dev/holdout splits, as agent-eval's own Harbor adapter has. `loadDataset(split)` serves the same
11
+ * tasks by agent-eval's deterministic split.
9
12
  */
10
13
 
11
- import type { AgentTurnUsage, OutputAdapter } from '@tangle-network/agent-runtime/kernel'
14
+ import {
15
+ type BenchmarkAdapter,
16
+ type BenchmarkDatasetItem,
17
+ type BenchmarkEvaluation,
18
+ type BenchmarkLoadOptions,
19
+ type BenchmarkRuntimeHooks,
20
+ deterministicSplit,
21
+ selectBenchmarkItems,
22
+ } from '@tangle-network/agent-eval/benchmarks'
23
+ import type { RunSplitTag } from '@tangle-network/agent-eval'
24
+ import type { AgentTurnUsage } from '@tangle-network/agent-runtime/kernel'
25
+ import type { SandboxEvent } from '@tangle-network/sandbox'
12
26
 
13
- export interface BenchTask {
14
- /** Stable benchmark instance id. */
15
- id: string
16
- /** The task statement handed to the worker agent. */
27
+ /** What the worker is handed, and the publisher's subset (domain, category, language, dataset version) the task is in. */
28
+ export interface BenchPayload {
17
29
  prompt: string
18
- split?: string
19
- /** Benchmark-specific fields the worker/judge need (repo, base_commit, gold, …). */
20
- metadata?: Record<string, unknown>
30
+ subset?: string
21
31
  }
22
32
 
33
+ /** One benchmark instance. `metadata` carries the fields the worker and judge need (repo, base_commit, gold, …). */
34
+ export type BenchTask = BenchmarkDatasetItem<BenchPayload>
35
+
23
36
  export interface JudgeArtifactFileReceipt {
24
37
  /** POSIX path relative to the capture directory. */
25
38
  path: string
@@ -46,12 +59,9 @@ export interface JudgeArtifactReceipt {
46
59
  treeSha256: `sha256:${string}`
47
60
  }
48
61
 
49
- export interface BenchScore {
50
- /** Did the deterministic judge pass (tests resolved / state correct)? */
51
- resolved: boolean
52
- /** 0..1 — 1 = fully resolved; partial credit where the harness supports it. */
53
- score: number
54
- detail?: string
62
+ /** agent-eval's verdict (`passed`: the judge passed; `score` 0..1 with partial credit where the harness has it;
63
+ * `notes`), plus the evidence agent-bench's judges keep. */
64
+ export interface BenchEvaluation extends BenchmarkEvaluation {
55
65
  /** Present only when the caller explicitly requested durable judge evidence. */
56
66
  judgeArtifacts?: JudgeArtifactReceipt
57
67
  /** The judge model turn's exact Runtime usage record, present only when the
@@ -61,45 +71,46 @@ export interface BenchScore {
61
71
  judgeUsage?: AgentTurnUsage
62
72
  }
63
73
 
64
- export interface LoadOptions {
65
- limit?: number
66
- split?: string
67
- ids?: string[]
74
+ /** agent-eval's load options (`limit`, `ids`), plus the publisher's subset. */
75
+ export interface LoadOptions extends BenchmarkLoadOptions {
76
+ subset?: string
77
+ }
78
+
79
+ /** The runtime hooks over agent-runtime's sandbox events. `workspaceSetup` runs in the box before the agent
80
+ * shot (a non-zero exit fails the shot); `workspaceExtract` runs in the still-alive box after it, and its
81
+ * stdout is the judged artifact (empty stdout falls back to `output`, then the final answer text). */
82
+ export type BenchRuntime = BenchmarkRuntimeHooks<BenchPayload, string, SandboxEvent>
83
+
84
+ /** An agent-eval `BenchmarkAdapter` an agent-runtime worker runs. */
85
+ export interface RuntimeBenchmark extends BenchmarkAdapter<BenchTask, BenchPayload, string, SandboxEvent> {
86
+ readonly id: string
87
+ readonly runtime: BenchRuntime
88
+ /** Every task in the publisher's order, ignoring agent-eval's splits. */
89
+ loadAll(options?: LoadOptions): Promise<BenchTask[]>
90
+ /** The benchmark's own judge on the worker's artifact. */
91
+ evaluate(item: BenchTask, artifact: string): Promise<BenchEvaluation>
92
+ }
93
+
94
+ export type RuntimeBenchmarkSpec = Omit<RuntimeBenchmark, 'loadDataset' | 'assignSplit' | 'runtime'> & {
95
+ assignSplit?: RuntimeBenchmark['assignSplit']
96
+ /** `prompt` defaults to the task's `payload.prompt`. */
97
+ runtime?: Omit<BenchRuntime, 'prompt'> & Partial<Pick<BenchRuntime, 'prompt'>>
68
98
  }
69
99
 
70
- export interface BenchmarkAdapter {
71
- readonly name: string
72
- /** Throw with actionable guidance when the harness/judge isn't installed/runnable. */
73
- preflight(): Promise<void>
74
- loadTasks(opts?: LoadOptions): Promise<BenchTask[]>
75
- /** DETERMINISTIC judge: score the worker's produced artifact for a task. */
76
- judge(task: BenchTask, artifact: string): Promise<BenchScore>
77
- /** Gold/oracle artifact — lets us self-verify the judge before spending model tokens. */
78
- goldArtifact(task: BenchTask): Promise<string | undefined>
79
- /** How to extract the judged artifact from a run's event stream. Optional —
80
- * defaults to the agent's final answer text (the research/QA case). SWE sets
81
- * it to a patch parser. This is `benchmark = adapter` owning its deliverable,
82
- * so the gate runner (`runGate` / `runBenchmark`) needs no
83
- * per-benchmark branching. */
84
- output?: OutputAdapter<string>
85
- /** Post-shot deliverable extraction from the box FILESYSTEM, not the event stream.
86
- * When set, the shot runner execs `command` in the STILL-ALIVE box after the agent
87
- * turn drains and uses its stdout as the judged artifact — the durable way to capture
88
- * a git diff of the agent's in-box edits (standard SWE-bench practice: SWE-agent /
89
- * OpenHands read the diff from repo STATE), instead of hoping the model printed a
90
- * fenced diff in its reply. Empty stdout ⇒ the runner falls back to `output` (the
91
- * event-stream parse). `cwd` defaults to the box root. */
92
- boxExtract?(task: BenchTask): { command: string; cwd?: string }
93
- /** Optional workspace pre-stage run in the box BEFORE the agent shot (same
94
- * session as `boxExtract`). For repo-state benchmarks (SWE-bench) this clones
95
- * the instance repo at `base_commit` into a fixed path so the agent only edits
96
- * — the harness owns the checkout, not the (stochastic) model. A non-zero exit
97
- * fails the shot loud rather than letting the agent run against an empty box. */
98
- boxSetup?(task: BenchTask): { command: string; cwd?: string }
99
- /** Benchmark-owned worker leaf. Set when the benchmark's native protocol IS the
100
- * worker (e.g. AppWorld's interactive ReAct episode runs inside the engine,
101
- * not as a chat completion) — the experiment uses this instead of the
102
- * BACKEND-selected client; the steer still flows through the per-round prompt.
103
- * Typed loosely to avoid a runtime import cycle; the harness casts it. */
104
- leafClient?: (cfg: { model: string; routerBaseUrl: string; routerKey: string }) => unknown
100
+ /** Build a `RuntimeBenchmark`: splits default to agent-eval's `deterministicSplit` over `<id>::<task id>`. */
101
+ export function runtimeBenchmark(spec: RuntimeBenchmarkSpec): RuntimeBenchmark {
102
+ const assignSplit =
103
+ spec.assignSplit ?? ((itemId: string): RunSplitTag => deterministicSplit(`${spec.id}::${itemId}`))
104
+ return {
105
+ ...spec,
106
+ runtime: { prompt: (task) => task.payload.prompt, ...spec.runtime },
107
+ assignSplit,
108
+ async loadDataset(split, options) {
109
+ const tasks = await spec.loadAll(options?.ids?.length ? { ids: options.ids } : {})
110
+ const inSplit = tasks
111
+ .map((task) => ({ ...task, split: task.split ?? assignSplit(task.id) }))
112
+ .filter((task) => task.split === split)
113
+ return selectBenchmarkItems(inSplit, options)
114
+ },
115
+ }
105
116
  }
@@ -11,7 +11,7 @@ import { access, readFile, stat } from 'node:fs/promises'
11
11
  import { join, resolve } from 'node:path'
12
12
  import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
13
13
  import { benchRoot, runVenvPython } 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', 'webarena-verified.json')
17
17
  const DATASET_REL = join('assets', 'dataset', 'webarena-verified.json')
@@ -78,17 +78,19 @@ function rowToTask(row: WebArenaRow): BenchTask {
78
78
  }
79
79
  return {
80
80
  id: String(row.task_id),
81
- prompt: [
82
- 'Run this WebArena-Verified browser task in the official environment.',
83
- `Goal: ${row.intent}`,
84
- row.start_urls?.length ? `Start URL templates: ${row.start_urls.join(', ')}` : undefined,
85
- row.sites?.length ? `Sites: ${row.sites.join(', ')}` : undefined,
86
- '',
87
- 'Return the path to the official WebArena-Verified run output directory for this task.',
88
- 'The judge expects that directory to contain the task response and network trace files.',
89
- ]
90
- .filter(Boolean)
91
- .join('\n'),
81
+ payload: {
82
+ prompt: [
83
+ 'Run this WebArena-Verified browser task in the official environment.',
84
+ `Goal: ${row.intent}`,
85
+ row.start_urls?.length ? `Start URL templates: ${row.start_urls.join(', ')}` : undefined,
86
+ row.sites?.length ? `Sites: ${row.sites.join(', ')}` : undefined,
87
+ '',
88
+ 'Return the path to the official WebArena-Verified run output directory for this task.',
89
+ 'The judge expects that directory to contain the task response and network trace files.',
90
+ ]
91
+ .filter(Boolean)
92
+ .join('\n'),
93
+ },
92
94
  metadata: meta as unknown as Record<string, unknown>,
93
95
  }
94
96
  }
@@ -96,7 +98,7 @@ function rowToTask(row: WebArenaRow): BenchTask {
96
98
  function readMeta(task: BenchTask): WebArenaMeta {
97
99
  const md = task.metadata
98
100
  if (!md || typeof md.taskId !== 'number') {
99
- throw new Error(`webarena-verified task ${task.id} missing metadata — loadTasks did not populate it`)
101
+ throw new Error(`webarena-verified task ${task.id} missing metadata — loadAll did not populate it`)
100
102
  }
101
103
  return md as unknown as WebArenaMeta
102
104
  }
@@ -147,41 +149,20 @@ print(json.dumps(json.loads(result_path.read_text())))
147
149
  return JSON.parse(stdout.trim().split('\n').at(-1) ?? '{}') as Record<string, unknown>
148
150
  }
149
151
 
150
- export function createWebArenaVerifiedAdapter(): BenchmarkAdapter {
152
+ export function createWebArenaVerifiedAdapter(): RuntimeBenchmark {
151
153
  const fixturesMode = process.env.WEBARENA_VERIFIED_FIXTURES === '1'
152
154
 
153
- return {
154
- name: 'webarena-verified',
155
- output: webarenaOutputDirOutput,
156
-
157
- async preflight() {
158
- if (fixturesMode) return
159
- const dir = webarenaDir()
160
- if (!dir) {
161
- throw new Error(
162
- 'WEBARENA_VERIFIED_DIR is required. Fix: clone https://github.com/ServiceNow/webarena-verified, install its deps in bench/.venv, and set WEBARENA_VERIFIED_DIR=/path/to/webarena-verified.',
163
- )
164
- }
165
- await assertFile(join(dir, DATASET_REL), 'official dataset')
166
- await assertFile(join(dir, 'src', 'webarena_verified', '__main__.py'), 'official CLI module')
167
- await runVenvPython(
168
- 'import sys; sys.path.insert(0, sys.argv[1]); import webarena_verified; print("ok")',
169
- [join(dir, 'src')],
170
- )
171
- },
155
+ return runtimeBenchmark({
156
+ id: 'webarena-verified',
172
157
 
173
- async loadTasks(opts: LoadOptions = {}) {
158
+ async loadAll(opts: LoadOptions = {}) {
174
159
  if (fixturesMode) return loadFixtures(opts)
175
160
  const dir = webarenaDir()
176
161
  if (!dir) throw new Error('WEBARENA_VERIFIED_DIR is required to load official WebArena-Verified tasks')
177
162
  return loadOfficialRows(dir, opts)
178
163
  },
179
164
 
180
- async goldArtifact() {
181
- return undefined
182
- },
183
-
184
- async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
165
+ async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
185
166
  const dir = webarenaDir()
186
167
  if (!dir) throw new Error('WEBARENA_VERIFIED_DIR is required to judge WebArena-Verified artifacts')
187
168
  const outputDir = resolve(artifact.trim())
@@ -190,11 +171,37 @@ export function createWebArenaVerifiedAdapter(): BenchmarkAdapter {
190
171
  const report = await runOfficialEval(dir, meta.taskId, outputDir)
191
172
  const score = typeof report.score === 'number' ? report.score : 0
192
173
  const status = typeof report.status === 'string' ? report.status : 'unknown'
174
+ const raw = { taskId: meta.taskId, status, outputDir }
193
175
  return {
194
- resolved: score === 1,
176
+ passed: score === 1,
195
177
  score,
196
- detail: JSON.stringify({ taskId: meta.taskId, status, outputDir }),
178
+ notes: JSON.stringify(raw),
179
+ raw,
197
180
  }
198
181
  },
199
- }
182
+
183
+ runtime: {
184
+ output: webarenaOutputDirOutput,
185
+
186
+ async preflight() {
187
+ if (fixturesMode) return
188
+ const dir = webarenaDir()
189
+ if (!dir) {
190
+ throw new Error(
191
+ 'WEBARENA_VERIFIED_DIR is required. Fix: clone https://github.com/ServiceNow/webarena-verified, install its deps in bench/.venv, and set WEBARENA_VERIFIED_DIR=/path/to/webarena-verified.',
192
+ )
193
+ }
194
+ await assertFile(join(dir, DATASET_REL), 'official dataset')
195
+ await assertFile(join(dir, 'src', 'webarena_verified', '__main__.py'), 'official CLI module')
196
+ await runVenvPython(
197
+ 'import sys; sys.path.insert(0, sys.argv[1]); import webarena_verified; print("ok")',
198
+ [join(dir, 'src')],
199
+ )
200
+ },
201
+
202
+ async goldArtifact() {
203
+ return undefined
204
+ },
205
+ },
206
+ })
200
207
  }
package/src/cli.ts ADDED
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * agent-bench run <benchmark> --target <model:|app:|profile:> [--tasks N] [--task <publisher task id>]... [--out <dir>] [-- <runner args>]
4
+ * agent-bench list
5
+ *
6
+ * Runs a published benchmark with its publisher's own runner and grader (src/published.ts), prints the score with what it
7
+ * measured, and writes the run record to --out (default ./agent-bench-runs/<benchmark>-<time>).
8
+ */
9
+ import path from 'node:path'
10
+ import { PUBLISHED_BENCHMARKS, runPublished } from './published'
11
+
12
+ const usage = 'usage: agent-bench run <benchmark> --target <model:<router model>|app:<agent app>@<harness/model>|profile:<harness/model>> [--tasks N] [--task <id>]... [--judge bridge/<harness/model>] [--experiment <id>] [--candidate <id>] [--split search|dev|holdout] [--out <dir>] [-- <runner args>]\n agent-bench list'
13
+
14
+ async function main(argv: string[]): Promise<number> {
15
+ const [command, ...rest] = argv
16
+ if (command === 'list') {
17
+ for (const benchmark of Object.values(PUBLISHED_BENCHMARKS)) {
18
+ console.log(`${benchmark.name} ${benchmark.version} ${benchmark.repository}@${benchmark.ref.slice(0, 12)} ${benchmark.measured} judge=${benchmark.judge ?? 'deterministic'} license=${benchmark.license}`)
19
+ }
20
+ return 0
21
+ }
22
+ if (command !== 'run' || !rest[0] || rest[0].startsWith('-')) {
23
+ console.error(usage)
24
+ return 2
25
+ }
26
+ const name = rest[0]
27
+ const separator = rest.indexOf('--')
28
+ const own = separator === -1 ? rest.slice(1) : rest.slice(1, separator)
29
+ const runnerArgs = separator === -1 ? [] : rest.slice(separator + 1)
30
+ let target: string | undefined
31
+ let tasks: number | undefined
32
+ const taskIds: string[] = []
33
+ let out: string | undefined
34
+ let judge: string | undefined
35
+ const record: { experimentId?: string; candidateId?: string; splitTag?: 'search' | 'dev' | 'holdout' } = {}
36
+ for (let i = 0; i < own.length; i++) {
37
+ const flag = own[i]
38
+ const value = own[i + 1]
39
+ if (value === undefined) throw new Error(`${flag} needs a value\n${usage}`)
40
+ if (flag === '--target') target = value
41
+ else if (flag === '--tasks') tasks = Number.parseInt(value, 10)
42
+ else if (flag === '--task') taskIds.push(value)
43
+ else if (flag === '--out') out = value
44
+ else if (flag === '--judge') judge = value
45
+ else if (flag === '--experiment') record.experimentId = value
46
+ else if (flag === '--candidate') record.candidateId = value
47
+ else if (flag === '--split') record.splitTag = value as 'search' | 'dev' | 'holdout'
48
+ else throw new Error(`unknown option ${flag}\n${usage}`)
49
+ i++
50
+ }
51
+ if (!target) throw new Error(`--target is required\n${usage}`)
52
+ if (tasks !== undefined && !(Number.isSafeInteger(tasks) && tasks > 0)) throw new Error('--tasks must be a positive integer')
53
+ const run = await runPublished(name, target, {
54
+ ...(tasks === undefined ? {} : { tasks }),
55
+ ...(taskIds.length ? { taskIds } : {}),
56
+ ...(judge === undefined ? {} : { judge }),
57
+ ...(Object.keys(record).length ? { record } : {}),
58
+ args: runnerArgs,
59
+ out: path.resolve(out ?? path.join('agent-bench-runs', `${name}-${new Date().toISOString().replace(/[:.]/g, '-')}`)),
60
+ })
61
+ console.log(`${run.benchmark} ${run.version} on ${run.target}: ${run.passed} of ${run.tasks} passed, score ${run.score.toFixed(3)}, measured ${run.measured}, judge ${run.judge === null ? 'deterministic' : run.judge} (${run.official ? 'official' : `${[run.judge !== run.publisherJudge ? `substituted for ${run.publisherJudge}` : undefined, run.unofficial].filter(Boolean).join('; ')}, not official`})`)
62
+ if (run.app) {
63
+ console.log(`app: ${run.app.app} profile ${run.app.profileName ?? '?'} ${run.app.profileVersion ?? ''} ${run.app.profileDigest.slice(0, 19)} from ${run.app.profileUrl}; ` +
64
+ `its production model ${JSON.stringify(run.app.productionModel)} replaced by ${run.model}; its MCP servers not mounted: ${run.app.omittedMcp.join(', ') || 'none'}`)
65
+ }
66
+ console.log(`record: ${path.join(path.dirname(run.resultPath), `${run.benchmark}-run.json`)}`)
67
+ console.log(`run records: ${run.runRecords}`)
68
+ return 0
69
+ }
70
+
71
+ main(process.argv.slice(2)).then((code) => process.exit(code), (error: unknown) => {
72
+ console.error(error instanceof Error ? error.message : String(error))
73
+ process.exit(1)
74
+ })
@@ -30,13 +30,13 @@
30
30
  import { readFile } from 'node:fs/promises'
31
31
  import { argv } from 'node:process'
32
32
  import { fileURLToPath } from 'node:url'
33
- import type { BenchmarkAdapter, BenchScore, BenchTask } from './benchmarks/types'
33
+ import type { BenchEvaluation, BenchTask, RuntimeBenchmark } from './benchmarks/types'
34
34
  import { ADAPTERS } from './adapters'
35
35
  import type { BenchRunRecord } from './corpus'
36
36
  import { selfConsistencySelect, summarizeSelector, summarizeVerifierSelector } from './selector'
37
37
 
38
38
  /** The benchmark's own judge - the EXTERNAL, write-only anchor (learning-flywheel.md). */
39
- export type Judge = (task: BenchTask, artifact: string) => Promise<BenchScore>
39
+ export type Judge = (task: BenchTask, artifact: string) => Promise<BenchEvaluation>
40
40
 
41
41
  /**
42
42
  * The recorded FINAL output of a controller-run: the last attempt that actually
@@ -88,7 +88,7 @@ export async function scoreCandidateOffline(
88
88
  )
89
89
  }
90
90
  const verdict = await judge(task, candidateOutput)
91
- return { resolved: verdict.resolved === true, score: verdict.score }
91
+ return { resolved: verdict.passed === true, score: verdict.score }
92
92
  }
93
93
 
94
94
  /** Parse the corpus JSONL; fail loud on empty/unreadable. */
@@ -115,12 +115,12 @@ async function readCorpus(corpusPath: string): Promise<BenchRunRecord[]> {
115
115
 
116
116
  /**
117
117
  * Resolve every recorded instanceId for one benchmark to its BenchTask in a single
118
- * loadTasks call (the judge needs the task's gold/judge metadata). Fail loud when a
118
+ * loadAll call (the judge needs the task's gold/judge metadata). Fail loud when a
119
119
  * recorded instance is absent from the live/fixture dataset - that is corpus/dataset
120
120
  * drift, not a replayable record.
121
121
  */
122
- async function loadTaskMap(adapter: BenchmarkAdapter, ids: string[]): Promise<Map<string, BenchTask>> {
123
- const tasks = await adapter.loadTasks({ ids })
122
+ async function loadTaskMap(adapter: RuntimeBenchmark, ids: string[]): Promise<Map<string, BenchTask>> {
123
+ const tasks = await adapter.loadAll({ ids })
124
124
  const byId = new Map<string, BenchTask>()
125
125
  for (const t of tasks) byId.set(t.id, t)
126
126
  return byId
@@ -249,7 +249,7 @@ async function main(): Promise<void> {
249
249
 
250
250
  // --judge: preflight, resolve recorded instances -> BenchTask, re-run the judge
251
251
  // on each recorded final output, compare the replayed verdict to record.resolved.
252
- await adapter.preflight()
252
+ await adapter.runtime.preflight?.()
253
253
  const ids = [...new Set(replayable.map((r) => r.instanceId))]
254
254
  const taskMap = await loadTaskMap(adapter, ids)
255
255
 
@@ -265,9 +265,9 @@ async function main(): Promise<void> {
265
265
  console.warn(`[${bench}] instance ${r.instanceId} not in dataset - corpus/dataset drift; skipping`)
266
266
  continue
267
267
  }
268
- const verdict = await adapter.judge(task, out)
268
+ const verdict = await adapter.evaluate(task, out)
269
269
  judged += 1
270
- if ((verdict.resolved === true) === (r.resolved === true)) agree += 1
270
+ if ((verdict.passed === true) === (r.resolved === true)) agree += 1
271
271
  }
272
272
  const rate = judged > 0 ? agree / judged : 0
273
273
  console.log(
@@ -13,7 +13,7 @@
13
13
  * # live: real benchmarks graded by their real graders
14
14
  * TANGLE_API_KEY=... BENCHMARKS=humaneval tsx src/examples/benchmark-matrix.mts
15
15
  */
16
- import type { BenchmarkAdapter, BenchScore, BenchTask } from '../benchmarks/types'
16
+ import { type BenchEvaluation, type BenchTask, type RuntimeBenchmark, runtimeBenchmark } from '../benchmarks/types'
17
17
  import { type BenchCell, type BenchShot, printBenchmarksReport, runBenchmarks } from '../run-benchmarks'
18
18
 
19
19
  /** The matrix: three cells spanning harnesses, models, and transports. */
@@ -46,22 +46,25 @@ async function live(): Promise<void> {
46
46
  /** Offline proof: a stub registry whose judge is deterministic, and a stub shot whose "ability"
47
47
  * differs per cell — so the leaderboard ORDER reflects the cells, with no model or sandbox. */
48
48
  async function demo(): Promise<void> {
49
- const stub = (name: string, n: number): BenchmarkAdapter => ({
50
- name,
51
- preflight: async () => {},
52
- loadTasks: async (o) =>
49
+ const stub = (name: string, n: number): RuntimeBenchmark => runtimeBenchmark({
50
+ id: name,
51
+ loadAll: async (o) =>
53
52
  Array.from({ length: o?.limit ?? n }, (_, i) => ({
54
53
  id: `${name}-${i}`,
55
- prompt: `task ${i}`,
54
+ payload: { prompt: `task ${i}` },
56
55
  metadata: { gold: `G-${name}-${i}` },
57
56
  })),
58
- judge: async (t: BenchTask, a: string): Promise<BenchScore> => ({
59
- resolved: a === t.metadata?.gold,
57
+ evaluate: async (t: BenchTask, a: string): Promise<BenchEvaluation> => ({
58
+ passed: a === t.metadata?.gold,
60
59
  score: a === t.metadata?.gold ? 1 : 0,
60
+ raw: {},
61
61
  }),
62
- goldArtifact: async (t: BenchTask) => String(t.metadata?.gold),
62
+ runtime: {
63
+ preflight: async () => {},
64
+ goldArtifact: async (t: BenchTask) => String(t.metadata?.gold),
65
+ },
63
66
  })
64
- const registry: Record<string, BenchmarkAdapter> = {
67
+ const registry: Record<string, RuntimeBenchmark> = {
65
68
  'demo-coding': stub('demo-coding', 8),
66
69
  'demo-research': stub('demo-research', 8),
67
70
  }
package/src/gate-cli.mts CHANGED
@@ -2,12 +2,12 @@
2
2
  * Run the diverse-vs-blind gate THROUGH the recursive atom, end to end, in two lines:
3
3
  *
4
4
  * export TANGLE_API_KEY=... # router + the deployable judge's creds
5
- * BENCH=enterpriseops-gym EOPS_FIXTURES=1 N=20 K=4 tsx src/gate-cli.mts
5
+ * BENCH=swe-bench N=20 K=4 tsx src/gate-cli.mts
6
6
  *
7
7
  * The arms are equal-k by construction (both open K children; blind = K identical copies,
8
8
  * diverse = K distinct strategy directives). The deployable selector is the benchmark's OWN
9
- * judge — pick a benchmark whose `adapter.judge` is a runnable checker (enterpriseops-gym,
10
- * swe-bench, terminal-bench), NOT an LLM-judge bench (finsearchcomp), or the selector is not
9
+ * judge — pick a benchmark whose `adapter.evaluate` is a runnable checker (swe-bench,
10
+ * terminal-bench), NOT an LLM-judge bench (finsearchcomp), or the selector is not
11
11
  * deployable and the result does not answer the gate.
12
12
  *
13
13
  * Output is a verdict-first report: the headline delta, the per-arm resolve table, the equal-k
@@ -35,7 +35,7 @@ const defaultStrategies: ReadonlyArray<string> = [
35
35
  ]
36
36
 
37
37
  async function main(): Promise<void> {
38
- const benchKey = process.env.BENCH ?? 'enterpriseops-gym'
38
+ const benchKey = must('BENCH')
39
39
  const adapter = resolveAdapter(benchKey)
40
40
  const model = process.env.WORKER_MODEL ?? 'deepseek/deepseek-v4.1-flash'
41
41
  const routerBaseUrl = process.env.ROUTER_BASE ?? 'https://router.tangle.tools/v1'
@@ -65,7 +65,7 @@ async function main(): Promise<void> {
65
65
  routerKey,
66
66
  n: Number(process.env.N ?? 20),
67
67
  ...(process.env.IDS ? { ids: process.env.IDS.split(',') } : {}),
68
- ...(process.env.SPLIT ? { split: process.env.SPLIT } : {}),
68
+ ...(process.env.SUBSET ? { subset: process.env.SUBSET } : {}),
69
69
  ...(process.env.PER_CHILD_TOKENS ? { perChildTokens: Number(process.env.PER_CHILD_TOKENS) } : {}),
70
70
  })
71
71
 
package/src/gate.test.mts CHANGED
@@ -4,7 +4,7 @@
4
4
  * drives the `Supervisor`, the per-child deployable verdict drives selection, the paired metric is
5
5
  * derived from the run's own trajectory, and the conserved pool yields equal-k across arms.
6
6
  *
7
- * The LIVE solve-and-grade path (`benchSolverRegistry` → router + `adapter.judge`) is exercised
7
+ * The LIVE solve-and-grade path (`benchSolverRegistry` → router + `adapter.evaluate`) is exercised
8
8
  * by a real gate run against a deployable-checker domain, not here.
9
9
  *
10
10
  * tsx bench/src/gate.test.mts
@@ -21,7 +21,7 @@ import type {
21
21
  ExecutorFactory,
22
22
  ExecutorResult,
23
23
  } from '@tangle-network/agent-runtime/kernel'
24
- import type { BenchmarkAdapter, BenchScore, BenchTask } from './benchmarks/types'
24
+ import { type BenchEvaluation, type BenchTask, type RuntimeBenchmark, runtimeBenchmark } from './benchmarks/types'
25
25
  import { runGate, type SolveTask } from './gate'
26
26
 
27
27
  /** A child whose verdict is decided purely by whether its prompt carries the STRONG marker — so a
@@ -62,23 +62,25 @@ const stubRegistry: ExecutorRegistry = {
62
62
  },
63
63
  }
64
64
 
65
- function stubAdapter(n: number): BenchmarkAdapter {
65
+ function stubAdapter(n: number): RuntimeBenchmark {
66
66
  const tasks: BenchTask[] = Array.from({ length: n }, (_v, i) => ({
67
67
  id: `t${i}`,
68
- prompt: `solve instance ${i}`,
68
+ payload: { prompt: `solve instance ${i}` },
69
69
  }))
70
- return {
71
- name: 'stub-bench',
72
- preflight: () => Promise.resolve(),
73
- loadTasks: (opts) =>
70
+ return runtimeBenchmark({
71
+ id: 'stub-bench',
72
+ loadAll: (opts) =>
74
73
  Promise.resolve(opts?.limit !== undefined ? tasks.slice(0, opts.limit) : tasks),
75
- // judge is NOT exercised on the injected-registry path (the stub leaf sets verdicts directly);
74
+ // evaluate is NOT exercised on the injected-registry path (the stub leaf sets verdicts directly);
76
75
  // a real run reaches the adapter judge through benchSolverRegistry.
77
- judge: (): Promise<BenchScore> => {
76
+ evaluate: (): Promise<BenchEvaluation> => {
78
77
  throw new Error('stub judge must not be called on the injected-registry path')
79
78
  },
80
- goldArtifact: () => Promise.resolve(undefined),
81
- }
79
+ runtime: {
80
+ preflight: () => Promise.resolve(),
81
+ goldArtifact: () => Promise.resolve(undefined),
82
+ },
83
+ })
82
84
  }
83
85
 
84
86
  const profile = {