@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.
- package/CHANGELOG.md +27 -0
- package/README.md +32 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +61 -48
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +54 -43
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-cq-bench.js +69 -57
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +62 -51
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +46 -38
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +43 -22
- package/dist/index.js +297 -144
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/pier_agents/candidate_contract.py +226 -74
- package/pier_agents/tangle_candidate.py +79 -1
- package/pier_agents/workspace_boundary.py +29 -1
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +6 -6
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/scripts/verify-pier-agent.mts +142 -25
- package/src/adapters.ts +5 -7
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +34 -32
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +57 -47
- package/src/benchmarks/finsearchcomp.ts +72 -67
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +78 -73
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +57 -52
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +13 -10
- package/src/gate-cli.mts +5 -5
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/index.ts +20 -11
- package/src/pier-agent.ts +108 -38
- package/src/pier-trial-controller.test.mts +48 -1
- package/src/pier-trial-controller.ts +121 -8
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +2 -2
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-Byr5gO1M.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
|
@@ -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
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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 —
|
|
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():
|
|
152
|
+
export function createWebArenaVerifiedAdapter(): RuntimeBenchmark {
|
|
151
153
|
const fixturesMode = process.env.WEBARENA_VERIFIED_FIXTURES === '1'
|
|
152
154
|
|
|
153
|
-
return {
|
|
154
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
176
|
+
passed: score === 1,
|
|
195
177
|
score,
|
|
196
|
-
|
|
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
|
+
})
|
package/src/corpus-replay.mts
CHANGED
|
@@ -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 {
|
|
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<
|
|
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.
|
|
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
|
-
*
|
|
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:
|
|
123
|
-
const tasks = await adapter.
|
|
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.
|
|
268
|
+
const verdict = await adapter.evaluate(task, out)
|
|
269
269
|
judged += 1
|
|
270
|
-
if ((verdict.
|
|
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
|
|
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):
|
|
50
|
-
name,
|
|
51
|
-
|
|
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
|
-
|
|
59
|
-
|
|
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
|
-
|
|
62
|
+
runtime: {
|
|
63
|
+
preflight: async () => {},
|
|
64
|
+
goldArtifact: async (t: BenchTask) => String(t.metadata?.gold),
|
|
65
|
+
},
|
|
63
66
|
})
|
|
64
|
-
const registry: Record<string,
|
|
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=
|
|
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.
|
|
10
|
-
*
|
|
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 =
|
|
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.
|
|
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.
|
|
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
|
|
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):
|
|
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
|
-
|
|
72
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
76
|
+
evaluate: (): Promise<BenchEvaluation> => {
|
|
78
77
|
throw new Error('stub judge must not be called on the injected-registry path')
|
|
79
78
|
},
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
runtime: {
|
|
80
|
+
preflight: () => Promise.resolve(),
|
|
81
|
+
goldArtifact: () => Promise.resolve(undefined),
|
|
82
|
+
},
|
|
83
|
+
})
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
const profile = {
|
package/src/gate.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* The gate's two non-negotiables, enforced structurally here:
|
|
14
14
|
* - DEPLOYABLE selector. Each fanout child SOLVES via the router, then is graded by the
|
|
15
|
-
* benchmark's OWN deterministic `adapter.
|
|
16
|
-
* the answer oracle). That `
|
|
15
|
+
* benchmark's OWN deterministic `adapter.evaluate` (a runnable checker — NOT an LLM judge, NOT
|
|
16
|
+
* the answer oracle). That `BenchEvaluation` becomes the child's `DefaultVerdict`, and `fanout`'s
|
|
17
17
|
* single-sourced `defaultSelectWinner` picks the best-scoring candidate. Selection therefore
|
|
18
18
|
* reads only the deployable verifier — selector ≠ oracle by construction.
|
|
19
19
|
* - EQUAL k. Both arms open the SAME number of children (k = strategies.length; blind = k
|
|
@@ -55,10 +55,10 @@ import {
|
|
|
55
55
|
runPersonified,
|
|
56
56
|
trajectoryReport,
|
|
57
57
|
} from '@tangle-network/agent-runtime/kernel'
|
|
58
|
-
import type {
|
|
58
|
+
import type { BenchTask, RuntimeBenchmark } from './benchmarks/types'
|
|
59
59
|
|
|
60
60
|
/** A fanout child's task: the prompt to solve with + the instance to grade against. The instance
|
|
61
|
-
* travels with the prompt so the solve-and-grade leaf can run `adapter.
|
|
61
|
+
* travels with the prompt so the solve-and-grade leaf can run `adapter.evaluate` without a closure
|
|
62
62
|
* over the per-task state (the registry closes only over the adapter + router config). */
|
|
63
63
|
export interface SolveTask {
|
|
64
64
|
readonly prompt: string
|
|
@@ -68,7 +68,7 @@ export interface SolveTask {
|
|
|
68
68
|
/** What `benchSolverRegistry` needs to build a solve-and-grade leaf. The router config is the
|
|
69
69
|
* cheapest leaf (one chat completion, no box); the adapter supplies the deployable judge. */
|
|
70
70
|
interface BenchSolverOptions {
|
|
71
|
-
readonly adapter:
|
|
71
|
+
readonly adapter: RuntimeBenchmark
|
|
72
72
|
readonly routerBaseUrl: string
|
|
73
73
|
readonly routerKey: string
|
|
74
74
|
}
|
|
@@ -93,16 +93,16 @@ const fnv = (prefix: string, value: unknown): string => {
|
|
|
93
93
|
* (e.g. the last fenced ```json block for a transcript bench), so the gate leaf honors
|
|
94
94
|
* `benchmark = adapter owns its deliverable`. Falls back to the trimmed reply when the adapter
|
|
95
95
|
* defines no output parser (the research/QA case). */
|
|
96
|
-
function extractArtifact(adapter:
|
|
97
|
-
if (!adapter.output) return content.trim()
|
|
96
|
+
function extractArtifact(adapter: RuntimeBenchmark, content: string): string {
|
|
97
|
+
if (!adapter.runtime.output) return content.trim()
|
|
98
98
|
const events = [{ type: 'agent', data: { finalText: content } }] as unknown as SandboxEvent[]
|
|
99
|
-
return adapter.output.parse(events)
|
|
99
|
+
return adapter.runtime.output.parse(events)
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* A single solve-and-grade leaf executor. Solves the task with ONE router completion, extracts
|
|
104
104
|
* the deliverable via the adapter, then grades it with the benchmark's deterministic judge and
|
|
105
|
-
* surfaces that `
|
|
105
|
+
* surfaces that `BenchEvaluation` as the child's `DefaultVerdict`. The verdict is what `fanout`'s
|
|
106
106
|
* deployable selector ranks on. Reports REAL token usage; a missing-usage provider records zero
|
|
107
107
|
* tokens but still one iteration (never a fabricated priced cost). Fail-loud: a router non-2xx or
|
|
108
108
|
* a judge throw rejects the leaf (the scope types it into a `down` settlement — never a silent 0).
|
|
@@ -118,14 +118,14 @@ function benchSolveLeaf(opts: BenchSolverOptions, spec: AgentSpec, ctx: Executor
|
|
|
118
118
|
const raw = result.out as { content?: unknown }
|
|
119
119
|
const content = typeof raw?.content === 'string' ? raw.content : ''
|
|
120
120
|
const candidate = extractArtifact(opts.adapter, content)
|
|
121
|
-
const score = await opts.adapter.
|
|
121
|
+
const score = await opts.adapter.evaluate(t.instance, candidate)
|
|
122
122
|
return {
|
|
123
123
|
outRef: fnv('bench', { id: t.instance.id, candidate }),
|
|
124
124
|
out: candidate,
|
|
125
125
|
verdict: {
|
|
126
|
-
valid: score.
|
|
126
|
+
valid: score.passed === true,
|
|
127
127
|
score: score.score,
|
|
128
|
-
...(score.
|
|
128
|
+
...(score.notes ? { notes: score.notes } : {}),
|
|
129
129
|
},
|
|
130
130
|
}
|
|
131
131
|
})
|
|
@@ -173,10 +173,10 @@ function defineSolverPersona(
|
|
|
173
173
|
/** The blind/diverse `fanout` over k children. Each item is a strategy directive appended to the
|
|
174
174
|
* task prompt; the blind arm passes k empty strategies (k identical prompts = the compute
|
|
175
175
|
* control). No `synthesize` → the deployable `defaultSelectWinner` returns the best-graded child. */
|
|
176
|
-
function solveFanout(strategies: ReadonlyArray<string>, instance: BenchTask): CombinatorShape<unknown, string> {
|
|
176
|
+
function solveFanout(strategies: ReadonlyArray<string>, instance: BenchTask, prompt: string): CombinatorShape<unknown, string> {
|
|
177
177
|
return fanout<unknown, string, string>(strategies, {
|
|
178
178
|
itemTask: (strategy): SolveTask => ({
|
|
179
|
-
prompt: strategy.length > 0 ? `${
|
|
179
|
+
prompt: strategy.length > 0 ? `${prompt}\n\n${strategy}` : prompt,
|
|
180
180
|
instance,
|
|
181
181
|
}),
|
|
182
182
|
label: (_s, i) => `solve:${i}`,
|
|
@@ -184,7 +184,7 @@ function solveFanout(strategies: ReadonlyArray<string>, instance: BenchTask): Co
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
interface RunGateOptions {
|
|
187
|
-
readonly adapter:
|
|
187
|
+
readonly adapter: RuntimeBenchmark
|
|
188
188
|
/** The ONE specificity: who the solver is (prompt / model / tools). */
|
|
189
189
|
readonly profile: AgentProfile
|
|
190
190
|
/**
|
|
@@ -198,7 +198,8 @@ interface RunGateOptions {
|
|
|
198
198
|
/** How many benchmark instances to run (the paired n). */
|
|
199
199
|
readonly n?: number
|
|
200
200
|
readonly ids?: string[]
|
|
201
|
-
|
|
201
|
+
/** The publisher's subset (domain, category, language), for benchmarks that have them. */
|
|
202
|
+
readonly subset?: string
|
|
202
203
|
/** Per-child token ceiling the conserved pool reserves. Default 60_000. */
|
|
203
204
|
readonly perChildTokens?: number
|
|
204
205
|
/** Per-child wall-clock deadline (ms) forwarded to the root budget. */
|
|
@@ -288,13 +289,13 @@ export async function runGate(opts: RunGateOptions): Promise<GateReport> {
|
|
|
288
289
|
throw new Error('runGate: need >= 2 strategies (k = strategies.length fixes both arms’ child count)')
|
|
289
290
|
}
|
|
290
291
|
const k = opts.strategies.length
|
|
291
|
-
await opts.adapter.preflight()
|
|
292
|
-
const tasks = await opts.adapter.
|
|
292
|
+
await opts.adapter.runtime.preflight?.()
|
|
293
|
+
const tasks = await opts.adapter.loadAll({
|
|
293
294
|
...(opts.n !== undefined ? { limit: opts.n } : {}),
|
|
294
295
|
...(opts.ids ? { ids: opts.ids } : {}),
|
|
295
|
-
...(opts.
|
|
296
|
+
...(opts.subset ? { subset: opts.subset } : {}),
|
|
296
297
|
})
|
|
297
|
-
if (tasks.length === 0) throw new Error('runGate: adapter.
|
|
298
|
+
if (tasks.length === 0) throw new Error('runGate: adapter.loadAll returned no tasks')
|
|
298
299
|
|
|
299
300
|
const registry = opts.solverRegistry ?? benchSolverRegistry(opts)
|
|
300
301
|
const perChildTokens = opts.perChildTokens ?? 60_000
|
|
@@ -330,7 +331,7 @@ export async function runGate(opts: RunGateOptions): Promise<GateReport> {
|
|
|
330
331
|
const runId = `gate:${armDef.label}:${task.id}`
|
|
331
332
|
const result: SupervisedResult<Outcome<string>> = await runPersonified<unknown, string>({
|
|
332
333
|
persona,
|
|
333
|
-
shape: solveFanout(armDef.strategies, task),
|
|
334
|
+
shape: solveFanout(armDef.strategies, task, opts.adapter.runtime.prompt(task)),
|
|
334
335
|
task: undefined,
|
|
335
336
|
budget,
|
|
336
337
|
shapeBudget: { fanout: k, perChild },
|
|
@@ -395,7 +396,7 @@ export async function runGate(opts: RunGateOptions): Promise<GateReport> {
|
|
|
395
396
|
const blind = arms.find((a) => a.label === 'blind')!
|
|
396
397
|
const diverse = arms.find((a) => a.label === 'diverse')!
|
|
397
398
|
return {
|
|
398
|
-
benchmark: opts.adapter.
|
|
399
|
+
benchmark: opts.adapter.id,
|
|
399
400
|
k,
|
|
400
401
|
n: tasks.length,
|
|
401
402
|
perTask,
|
package/src/index.ts
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
* and scores its agent's artifact against a real, deterministic judge — without owning the benchmark:
|
|
6
6
|
*
|
|
7
7
|
* import { resolveAdapter } from '@tangle-network/agent-bench'
|
|
8
|
-
* const verdict = await resolveAdapter('commit0').
|
|
8
|
+
* const verdict = await resolveAdapter('commit0').evaluate(task, myAgentsDiff)
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Every adapter is an agent-eval `BenchmarkAdapter` (`RuntimeBenchmark`: its `runtime` hooks, and
|
|
11
|
+
* `loadAll`, which ignores agent-eval's splits). Each fails loud in `runtime.preflight()` when its
|
|
12
|
+
* harness/deps (Docker, a venv, a dataset) are absent, so importing the registry is cheap; running a
|
|
13
|
+
* specific benchmark pulls only its deps.
|
|
12
14
|
*/
|
|
13
15
|
export { ADAPTERS, resolveAdapter } from './adapters'
|
|
14
16
|
export { createCragAdapter } from './benchmarks/crag'
|
|
@@ -17,7 +19,7 @@ export { createOpenRagBenchAdapter } from './benchmarks/open-rag-bench'
|
|
|
17
19
|
export { createRagBenchAdapter } from './benchmarks/ragbench'
|
|
18
20
|
export {
|
|
19
21
|
FINAL_ANSWER_SENTINEL,
|
|
20
|
-
|
|
22
|
+
answerScoreToEvaluation,
|
|
21
23
|
contextBlock,
|
|
22
24
|
contextsFrom,
|
|
23
25
|
normalizeAnswer,
|
|
@@ -46,13 +48,17 @@ export {
|
|
|
46
48
|
type StagedRunCaptureSpec,
|
|
47
49
|
type StagedRunSpec,
|
|
48
50
|
} from './benchmarks/_harness'
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
export {
|
|
52
|
+
runtimeBenchmark,
|
|
53
|
+
type BenchEvaluation,
|
|
54
|
+
type BenchPayload,
|
|
55
|
+
type BenchRuntime,
|
|
56
|
+
type BenchTask,
|
|
57
|
+
type JudgeArtifactFileReceipt,
|
|
58
|
+
type JudgeArtifactReceipt,
|
|
59
|
+
type LoadOptions,
|
|
60
|
+
type RuntimeBenchmark,
|
|
61
|
+
type RuntimeBenchmarkSpec,
|
|
56
62
|
} from './benchmarks/types'
|
|
57
63
|
|
|
58
64
|
/**
|
|
@@ -76,6 +82,7 @@ export {
|
|
|
76
82
|
type RunBenchmarksReport,
|
|
77
83
|
} from './run-benchmarks'
|
|
78
84
|
export {
|
|
85
|
+
createPierCandidateExecutionOptions,
|
|
79
86
|
createPierCandidateRecoveryExecutor,
|
|
80
87
|
executePreparedPierCandidate,
|
|
81
88
|
type ExecutePreparedPierCandidateOptions,
|
|
@@ -89,6 +96,8 @@ export {
|
|
|
89
96
|
type StagedPierCandidateExecution,
|
|
90
97
|
} from './pier-agent'
|
|
91
98
|
export {
|
|
99
|
+
createPierTaskTrialController,
|
|
100
|
+
type CreatePierTaskTrialControllerOptions,
|
|
92
101
|
FilePierCandidateTrialController,
|
|
93
102
|
type FilePierCandidateTrialControllerOptions,
|
|
94
103
|
type PierCandidateProcessSpec,
|