@tangle-network/agent-bench 1.0.2 → 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.
- package/CHANGELOG.md +29 -0
- package/README.md +24 -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 +63 -50
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +55 -44
- 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 +3 -3
- package/dist/benchmarks/mcad-cq-bench.js +70 -58
- 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 +63 -52
- 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 +49 -43
- 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-DhAndllg.js → cadbench-htzAmMaI.js} +41 -36
- 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 +11 -10
- package/dist/index.js +64 -59
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +50 -0
- 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/src/adapters.ts +5 -7
- package/src/atom-mcp-e2e.mts +2 -2
- 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 +36 -36
- 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 +58 -48
- package/src/benchmarks/finsearchcomp.ts +73 -68
- 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 +79 -74
- 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 +61 -58
- 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 +19 -16
- package/src/examples/lean-proof-gate.mts +1 -1
- package/src/examples/math-demo.mts +2 -2
- package/src/examples/strategy-demo.mts +1 -1
- package/src/gate-cli.mts +6 -6
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/generate-eval/certify.ts +4 -4
- package/src/index.ts +17 -11
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +3 -3
- 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/swe-self-improve.mts +3 -3
- package/src/terminal-compare.ts +1 -1
- 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-DhAndllg.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
package/dist/cli.js
ADDED
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { homedir } from "node:os";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { RunRecordValidationError, UNKNOWN_MODEL, canonicalJson, validateRunRecord } from "@tangle-network/agent-eval";
|
|
10
|
+
// src/published.ts
|
|
11
|
+
/**
|
|
12
|
+
* Published benchmarks, run by their publishers' own runners, unmodified, at a pinned commit.
|
|
13
|
+
*
|
|
14
|
+
* One registry entry per benchmark: the publisher's repository and commit, its install and run commands, a parser from the
|
|
15
|
+
* publisher's result file to per-task scores (agent-eval's verdict names: `passed`, `score`, `notes`), the license, the data terms, and the judge the publisher names. Nothing here loads
|
|
16
|
+
* tasks, drives an agent loop, or grades: the publisher's runner does all three. A target becomes the OpenAI-compatible
|
|
17
|
+
* endpoint that runner calls:
|
|
18
|
+
*
|
|
19
|
+
* model:<router model> the Tangle Router with `TANGLE_API_KEY`; the target is a model driving the benchmark's tools.
|
|
20
|
+
* profile:<harness/model> a CLI Bridge (`AGENT_BENCH_BRIDGE_URL`, default http://127.0.0.1:3344/v1) running that harness with
|
|
21
|
+
* its own loop and tools; the benchmark's tools reach it as caller-executed MCP tools (cli-bridge#397).
|
|
22
|
+
* app:<agent app>@<harness/model>
|
|
23
|
+
* the AgentProfile the app serves in production (prompt, skills, subagents, resources), run by
|
|
24
|
+
* that subscription harness through the same CLI Bridge at `/profiles/<id>/v1` (cli-bridge#408).
|
|
25
|
+
* The app's production model and its own MCP servers are not part of it; the run record names both.
|
|
26
|
+
*
|
|
27
|
+
* Every run says what it measured: `model-shaped` (the target as a model calling the benchmark's tools, which the
|
|
28
|
+
* benchmark executes) or `own-loop` (the agent with its own loop and tools). The two are never compared as one.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Agent apps a benchmark can target, each by the executable AgentProfile it serves in production: the projection its own
|
|
32
|
+
* sandbox sends a harness (gtm-agent toExecutableAgentProfile, legal-agent slimSandboxProfile). `AGENT_BENCH_APPS`, a JSON
|
|
33
|
+
* object of app name to profile URL or absolute file path, adds an app or points one at another source: a staging deployment,
|
|
34
|
+
* a profile exported from a checkout, or a candidate profile an optimizer is scoring.
|
|
35
|
+
*/
|
|
36
|
+
const AGENT_APPS = {
|
|
37
|
+
"gtm-agent": { profileUrl: "https://gtm.tangle.tools/api/tools/profile?definition=executable" },
|
|
38
|
+
"legal-agent": { profileUrl: "https://legal.tangle.tools/api/tools/profile?definition=executable" }
|
|
39
|
+
};
|
|
40
|
+
function agentApps(env) {
|
|
41
|
+
if (!env.AGENT_BENCH_APPS) return { ...AGENT_APPS };
|
|
42
|
+
const extra = JSON.parse(env.AGENT_BENCH_APPS);
|
|
43
|
+
if (!extra || typeof extra !== "object" || Array.isArray(extra) || !Object.values(extra).every((url) => typeof url === "string")) throw new Error("AGENT_BENCH_APPS must be a JSON object of app name to profile URL or absolute file path");
|
|
44
|
+
return {
|
|
45
|
+
...AGENT_APPS,
|
|
46
|
+
...Object.fromEntries(Object.entries(extra).map(([name, profileUrl]) => [name, { profileUrl }]))
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const PUBLISHED_BENCHMARKS = {
|
|
50
|
+
automationbench: {
|
|
51
|
+
name: "automationbench",
|
|
52
|
+
repository: "https://github.com/zapier/AutomationBench.git",
|
|
53
|
+
ref: "4a8e1061254004d9dac807054eed33fad7d1ff14",
|
|
54
|
+
version: "1.0.6",
|
|
55
|
+
license: "MIT (Zapier, Inc.); third-party API schemas excluded",
|
|
56
|
+
terms: "MIT: tasks and code may be redistributed with attribution",
|
|
57
|
+
judge: null,
|
|
58
|
+
measured: "model-shaped",
|
|
59
|
+
install: [[
|
|
60
|
+
"uv",
|
|
61
|
+
"sync",
|
|
62
|
+
"--frozen"
|
|
63
|
+
]],
|
|
64
|
+
run: (endpoint, options, resultPath) => [
|
|
65
|
+
"uv",
|
|
66
|
+
"run",
|
|
67
|
+
"auto-bench",
|
|
68
|
+
"--model",
|
|
69
|
+
endpoint.model,
|
|
70
|
+
"--base-url",
|
|
71
|
+
endpoint.baseUrl,
|
|
72
|
+
"--api-key-var",
|
|
73
|
+
endpoint.apiKeyVar,
|
|
74
|
+
...options.taskIds?.length ? ["--tasks", options.taskIds.join(",")] : [],
|
|
75
|
+
...options.tasks === void 0 ? [] : ["--num-examples", String(options.tasks)],
|
|
76
|
+
"--max-concurrent",
|
|
77
|
+
String(Math.max(1, Math.min(options.tasks ?? options.taskIds?.length ?? 4, 4))),
|
|
78
|
+
"--export-json",
|
|
79
|
+
resultPath,
|
|
80
|
+
...options.args ?? []
|
|
81
|
+
],
|
|
82
|
+
parse: async (resultPath) => {
|
|
83
|
+
const tasks = JSON.parse(await readFile(resultPath, "utf8")).tasks;
|
|
84
|
+
if (!Array.isArray(tasks)) throw new Error("AutomationBench result has no tasks array");
|
|
85
|
+
return tasks.map((task) => {
|
|
86
|
+
if (typeof task.name !== "string" || typeof task.score !== "number" || typeof task.passed !== "boolean") throw new Error(`AutomationBench task result is malformed: ${JSON.stringify(task).slice(0, 200)}`);
|
|
87
|
+
return {
|
|
88
|
+
id: task.name,
|
|
89
|
+
passed: task.passed,
|
|
90
|
+
score: task.score
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"enterpriseops-gym": {
|
|
96
|
+
name: "enterpriseops-gym",
|
|
97
|
+
repository: "https://github.com/ServiceNow/EnterpriseOps-Gym.git",
|
|
98
|
+
ref: "271f2c357f763376997dfd16807fcde2474ae41b",
|
|
99
|
+
version: "271f2c3 (no release tag)",
|
|
100
|
+
license: "Apache-2.0 (ServiceNow; code and the ServiceNow-AI/EnterpriseOps-Gym dataset)",
|
|
101
|
+
terms: "Apache-2.0: tasks may be redistributed with attribution",
|
|
102
|
+
judge: null,
|
|
103
|
+
measured: "model-shaped",
|
|
104
|
+
resultIsFolder: true,
|
|
105
|
+
install: [[
|
|
106
|
+
"uv",
|
|
107
|
+
"sync",
|
|
108
|
+
"--extra",
|
|
109
|
+
"openai"
|
|
110
|
+
], [
|
|
111
|
+
"python3",
|
|
112
|
+
"-c",
|
|
113
|
+
"import zipfile; zipfile.ZipFile('gym_dbs.zip').extractall('.')"
|
|
114
|
+
]],
|
|
115
|
+
run: (endpoint, options, resultPath) => [
|
|
116
|
+
"sh",
|
|
117
|
+
fileURLToPath(new URL("../scripts/enterpriseops-gym-run.sh", import.meta.url)),
|
|
118
|
+
resultPath,
|
|
119
|
+
endpoint.baseUrl,
|
|
120
|
+
endpoint.model,
|
|
121
|
+
endpoint.apiKeyVar,
|
|
122
|
+
options.tasks === void 0 ? "all" : String(options.tasks),
|
|
123
|
+
(options.taskIds ?? []).join(","),
|
|
124
|
+
...options.args ?? []
|
|
125
|
+
],
|
|
126
|
+
parse: async (resultPath) => {
|
|
127
|
+
const folder = path.join(resultPath, "run_1");
|
|
128
|
+
const files = (await readdir(folder)).filter((file) => file.startsWith("results_") && file.endsWith(".json")).sort();
|
|
129
|
+
if (!files.length) throw new Error(`EnterpriseOps-Gym wrote no task results under ${folder}`);
|
|
130
|
+
return Promise.all(files.map(async (file) => {
|
|
131
|
+
const result = JSON.parse(await readFile(path.join(folder, file), "utf8"));
|
|
132
|
+
const success = result.statistics?.overall_success_rate;
|
|
133
|
+
const verifiers = result.statistics?.verifier_level_pass_rate;
|
|
134
|
+
if (typeof success !== "number") throw new Error(`EnterpriseOps-Gym result ${file} has no statistics.overall_success_rate`);
|
|
135
|
+
const error = result.runs?.find((run) => run.error)?.error;
|
|
136
|
+
return {
|
|
137
|
+
id: file.slice(8, -5).split("__").pop(),
|
|
138
|
+
passed: success === 1,
|
|
139
|
+
score: success,
|
|
140
|
+
notes: `verifier pass rate ${typeof verifiers === "number" ? verifiers : "unknown"}${error ? `; runner error: ${String(error).slice(0, 200)}` : ""}`
|
|
141
|
+
};
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"harvey-lab": {
|
|
146
|
+
name: "harvey-lab",
|
|
147
|
+
repository: "https://github.com/harveyai/harvey-labs.git",
|
|
148
|
+
ref: "81d6a31b22d7c9f661cda4770cffcc12a5735dc2",
|
|
149
|
+
version: "v1.3.0",
|
|
150
|
+
license: "MIT (Harvey AI)",
|
|
151
|
+
terms: "MIT: tasks and their synthetic documents ship in the repository; no training or redistribution restriction stated",
|
|
152
|
+
judge: "claude-sonnet-4-6 + gpt-5.5 (LAB standard dual judge, all-pass per criterion)",
|
|
153
|
+
judgeSubstitutable: true,
|
|
154
|
+
measured: "model-shaped",
|
|
155
|
+
resultIsFolder: true,
|
|
156
|
+
install: [
|
|
157
|
+
[
|
|
158
|
+
"uv",
|
|
159
|
+
"sync",
|
|
160
|
+
"--all-extras"
|
|
161
|
+
],
|
|
162
|
+
[
|
|
163
|
+
"sh",
|
|
164
|
+
"lab_core/sandbox/install_pandoc.sh",
|
|
165
|
+
".agent-bench"
|
|
166
|
+
],
|
|
167
|
+
["sh", fileURLToPath(new URL("../scripts/harvey-lab-sandbox.sh", import.meta.url))]
|
|
168
|
+
],
|
|
169
|
+
run: (endpoint, options, resultPath) => [
|
|
170
|
+
"sh",
|
|
171
|
+
fileURLToPath(new URL("../scripts/harvey-lab-run.sh", import.meta.url)),
|
|
172
|
+
resultPath,
|
|
173
|
+
endpoint.baseUrl,
|
|
174
|
+
endpoint.model,
|
|
175
|
+
endpoint.apiKeyVar,
|
|
176
|
+
options.tasks === void 0 ? "all" : String(options.tasks),
|
|
177
|
+
(options.taskIds ?? []).join(","),
|
|
178
|
+
options.judge ?? "publisher",
|
|
179
|
+
...options.args ?? []
|
|
180
|
+
],
|
|
181
|
+
parse: async (resultPath) => {
|
|
182
|
+
const runs = (await readFile(path.join(resultPath, "tasks.tsv"), "utf8")).trim().split("\n").map((line) => line.split(" "));
|
|
183
|
+
return Promise.all(runs.map(async ([run, task]) => {
|
|
184
|
+
const read = (file) => readFile(path.join(resultPath, run, file), "utf8").then((text) => JSON.parse(text), () => null);
|
|
185
|
+
const dual = await read("scores_dual.json");
|
|
186
|
+
if (dual) return {
|
|
187
|
+
id: task,
|
|
188
|
+
passed: dual.all_pass === true,
|
|
189
|
+
score: Number(dual.dual_all_pass_rate),
|
|
190
|
+
notes: `dual-judge criterion pass ${String(dual.dual_criterion_pass)}`
|
|
191
|
+
};
|
|
192
|
+
const single = await read("scores.json");
|
|
193
|
+
if (single) {
|
|
194
|
+
const criteria = Array.isArray(single.criteria_results) ? single.criteria_results : [];
|
|
195
|
+
return {
|
|
196
|
+
id: task,
|
|
197
|
+
passed: single.all_pass === true,
|
|
198
|
+
score: single.all_pass === true ? 1 : 0,
|
|
199
|
+
notes: `${String(single.n_passed)} of ${String(single.n_criteria)} criteria passed${single.n_grading_errors ? `; ${String(single.n_grading_errors)} grading errors` : ""}`,
|
|
200
|
+
raw: {
|
|
201
|
+
criteria_passed: Number(single.n_passed) || 0,
|
|
202
|
+
criteria_total: Number(single.n_criteria) || 0,
|
|
203
|
+
...Object.fromEntries(criteria.filter((c) => typeof c.id === "string").map((c) => [`crit.${String(c.id)}`, c.verdict === "pass" ? 1 : 0]))
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
id: task,
|
|
209
|
+
passed: false,
|
|
210
|
+
score: 0,
|
|
211
|
+
notes: "no scores: the harness or the grader failed (see the runner log)"
|
|
212
|
+
};
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
prbench: {
|
|
217
|
+
name: "prbench",
|
|
218
|
+
repository: "https://github.com/scaleapi/PRBench.git",
|
|
219
|
+
ref: "7b2df0a28bf99ec51263c41b90dd510a740a7711",
|
|
220
|
+
version: "7b2df0a (no release tag)",
|
|
221
|
+
license: "MIT (Scale AI); dataset ScaleAI/PRBench CC-BY-4.0",
|
|
222
|
+
terms: "CC-BY-4.0 dataset, not gated, loaded from Hugging Face at run time; attribution required, no training restriction stated",
|
|
223
|
+
judge: "openai/o4-mini (reasoning effort high), one call per rubric criterion",
|
|
224
|
+
judgeSubstitutable: true,
|
|
225
|
+
measured: "model-shaped",
|
|
226
|
+
resultIsFolder: true,
|
|
227
|
+
install: [[
|
|
228
|
+
"uv",
|
|
229
|
+
"venv",
|
|
230
|
+
"--quiet",
|
|
231
|
+
"--python",
|
|
232
|
+
"3.12"
|
|
233
|
+
], [
|
|
234
|
+
"uv",
|
|
235
|
+
"pip",
|
|
236
|
+
"install",
|
|
237
|
+
"--quiet",
|
|
238
|
+
"-r",
|
|
239
|
+
"requirements.txt"
|
|
240
|
+
]],
|
|
241
|
+
run: (endpoint, options, resultPath) => [
|
|
242
|
+
"sh",
|
|
243
|
+
fileURLToPath(new URL("../scripts/prbench-run.sh", import.meta.url)),
|
|
244
|
+
resultPath,
|
|
245
|
+
endpoint.baseUrl,
|
|
246
|
+
endpoint.model,
|
|
247
|
+
endpoint.apiKeyVar,
|
|
248
|
+
options.tasks === void 0 ? "all" : String(options.tasks),
|
|
249
|
+
(options.taskIds ?? []).join(","),
|
|
250
|
+
options.judge ?? "publisher",
|
|
251
|
+
...options.args ?? []
|
|
252
|
+
],
|
|
253
|
+
parse: async (resultPath) => {
|
|
254
|
+
const folder = path.join(resultPath, "results");
|
|
255
|
+
const files = (await readdir(folder)).filter((file) => file.endsWith(".json"));
|
|
256
|
+
if (files.length !== 1) throw new Error(`PRBench wrote ${files.length} result files under ${folder}, expected one`);
|
|
257
|
+
const result = JSON.parse(await readFile(path.join(folder, files[0]), "utf8"));
|
|
258
|
+
const tasks = Object.values(result.outputs ?? {})[0];
|
|
259
|
+
if (!tasks) throw new Error(`PRBench result ${files[0]} has no outputs`);
|
|
260
|
+
return Object.entries(tasks).map(([id, task]) => {
|
|
261
|
+
const best = (Array.isArray(task.weights) ? task.weights.filter((weight) => typeof weight === "number") : []).filter((weight) => weight > 0).reduce((sum, weight) => sum + weight, 0);
|
|
262
|
+
const points = typeof task.points === "number" ? task.points : NaN;
|
|
263
|
+
if (!best || Number.isNaN(points)) throw new Error(`PRBench task ${id} has no points or weights`);
|
|
264
|
+
return {
|
|
265
|
+
id,
|
|
266
|
+
passed: points >= best,
|
|
267
|
+
score: Math.min(1, Math.max(0, points / best)),
|
|
268
|
+
notes: `${points} of ${best} rubric points`
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"healthbench-professional": {
|
|
274
|
+
name: "healthbench-professional",
|
|
275
|
+
repository: "https://github.com/openai/simple-evals.git",
|
|
276
|
+
ref: "652c89d0ca9df547706735883097e9537d40dc47",
|
|
277
|
+
version: "652c89d (no release tag), data openai/healthbench-professional@349962fd",
|
|
278
|
+
license: "MIT (OpenAI simple-evals); dataset openai/healthbench-professional MIT",
|
|
279
|
+
terms: "MIT dataset, not gated, fetched from Hugging Face at the pinned revision at run time and never committed: the authors ask that examples not be revealed in plain text or images online. No training restriction stated.",
|
|
280
|
+
judge: "gpt-5.4-2026-03-05 (reasoning effort low), one call per rubric item; length-adjusted (center 2000 characters, 1.47 points per 500)",
|
|
281
|
+
judgeSubstitutable: true,
|
|
282
|
+
unofficial: "OpenAI reports HealthBench Professional from an internal implementation it does not release; simple-evals with its Professional settings is the reference implementation",
|
|
283
|
+
measured: "model-shaped",
|
|
284
|
+
resultIsFolder: true,
|
|
285
|
+
install: [[
|
|
286
|
+
"uv",
|
|
287
|
+
"venv",
|
|
288
|
+
"--quiet",
|
|
289
|
+
"--python",
|
|
290
|
+
"3.12"
|
|
291
|
+
], [
|
|
292
|
+
"uv",
|
|
293
|
+
"pip",
|
|
294
|
+
"install",
|
|
295
|
+
"--quiet",
|
|
296
|
+
"openai",
|
|
297
|
+
"blobfile",
|
|
298
|
+
"numpy",
|
|
299
|
+
"pandas",
|
|
300
|
+
"jinja2",
|
|
301
|
+
"requests",
|
|
302
|
+
"tqdm"
|
|
303
|
+
]],
|
|
304
|
+
run: (endpoint, options, resultPath) => [
|
|
305
|
+
"sh",
|
|
306
|
+
fileURLToPath(new URL("../scripts/healthbench-professional-run.sh", import.meta.url)),
|
|
307
|
+
resultPath,
|
|
308
|
+
endpoint.baseUrl,
|
|
309
|
+
endpoint.model,
|
|
310
|
+
endpoint.apiKeyVar,
|
|
311
|
+
options.tasks === void 0 ? "all" : String(options.tasks),
|
|
312
|
+
(options.taskIds ?? []).join(","),
|
|
313
|
+
options.judge ?? "publisher",
|
|
314
|
+
...options.args ?? []
|
|
315
|
+
],
|
|
316
|
+
parse: async (resultPath) => {
|
|
317
|
+
const result = JSON.parse(await readFile(path.join(resultPath, "result.json"), "utf8"));
|
|
318
|
+
if (!result.examples?.length) throw new Error(`HealthBench Professional wrote no examples under ${resultPath}`);
|
|
319
|
+
return result.examples.map((example) => ({
|
|
320
|
+
id: example.prompt_id,
|
|
321
|
+
passed: example.positive_met === example.positive_total && example.negative_met === 0,
|
|
322
|
+
score: Math.min(1, Math.max(0, example.length_adjusted)),
|
|
323
|
+
notes: `${example.positive_met} of ${example.positive_total} positive criteria met, ${example.negative_met} negative met; rubric score ${example.overall_score.toFixed(3)}, length-adjusted for ${example.response_chars} characters`,
|
|
324
|
+
raw: {
|
|
325
|
+
overall_score: example.overall_score,
|
|
326
|
+
length_adjusted: example.length_adjusted,
|
|
327
|
+
response_chars: example.response_chars,
|
|
328
|
+
positive_met: example.positive_met,
|
|
329
|
+
positive_total: example.positive_total,
|
|
330
|
+
negative_met: example.negative_met
|
|
331
|
+
}
|
|
332
|
+
}));
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
mlcr: {
|
|
336
|
+
name: "mlcr",
|
|
337
|
+
repository: "https://github.com/Wisedocs-AI/medical-long-context-reasoning.git",
|
|
338
|
+
ref: "ca822de2d274184bb0cd5bf280ff917922f3716f",
|
|
339
|
+
version: "v1.1 (ca822de, the release commit; no tag), data Wisedocs/mlcr-dataset@1198206e",
|
|
340
|
+
license: "none: neither the code nor the Wisedocs/mlcr-dataset release carries a license (the dataset card says \"other\")",
|
|
341
|
+
terms: "No license: run locally for evaluation only, never committed, redistributed, or used for training or prompt optimization. The dataset is not gated and is fetched from Hugging Face at the pinned revision at run time.",
|
|
342
|
+
judge: "jury of gemini-3.1-pro-preview, claude-opus-4-8-gcp and gpt-5.5 (majority vote, medium thinking) on the publisher's Vertex, Anthropic-on-GCP and Azure OpenAI providers, after a conciseness gate",
|
|
343
|
+
judgeSubstitutable: true,
|
|
344
|
+
measured: "model-shaped",
|
|
345
|
+
resultIsFolder: true,
|
|
346
|
+
install: [[
|
|
347
|
+
"uv",
|
|
348
|
+
"venv",
|
|
349
|
+
"--quiet",
|
|
350
|
+
"--python",
|
|
351
|
+
"3.12"
|
|
352
|
+
], [
|
|
353
|
+
"uv",
|
|
354
|
+
"pip",
|
|
355
|
+
"install",
|
|
356
|
+
"--quiet",
|
|
357
|
+
"-e",
|
|
358
|
+
".[all]"
|
|
359
|
+
]],
|
|
360
|
+
run: (endpoint, options, resultPath) => [
|
|
361
|
+
"sh",
|
|
362
|
+
fileURLToPath(new URL("../scripts/mlcr-run.sh", import.meta.url)),
|
|
363
|
+
resultPath,
|
|
364
|
+
endpoint.baseUrl,
|
|
365
|
+
endpoint.model,
|
|
366
|
+
endpoint.apiKeyVar,
|
|
367
|
+
options.tasks === void 0 ? "all" : String(options.tasks),
|
|
368
|
+
(options.taskIds ?? []).join(","),
|
|
369
|
+
options.judge ?? "publisher",
|
|
370
|
+
...options.args ?? []
|
|
371
|
+
],
|
|
372
|
+
parse: async (resultPath) => {
|
|
373
|
+
const result = JSON.parse(await readFile(path.join(resultPath, "result.json"), "utf8"));
|
|
374
|
+
if (!result.examples?.length) throw new Error(`MLCR wrote no scored rows under ${resultPath}`);
|
|
375
|
+
const verdict = (value) => value === "" ? void 0 : Number(value);
|
|
376
|
+
return result.examples.map((example) => {
|
|
377
|
+
if (example.correct === "") throw new Error(`MLCR row ${example.id} has no jury verdict${example.judge_error ? " (the judge failed)" : ""}`);
|
|
378
|
+
const raw = Object.fromEntries(Object.entries({
|
|
379
|
+
concise: verdict(example.concise),
|
|
380
|
+
complete: verdict(example.complete),
|
|
381
|
+
accurate: verdict(example.accurate),
|
|
382
|
+
correct: verdict(example.correct)
|
|
383
|
+
}).filter((entry) => entry[1] !== void 0));
|
|
384
|
+
return {
|
|
385
|
+
id: example.id,
|
|
386
|
+
passed: example.correct === "1",
|
|
387
|
+
score: example.correct === "1" ? 1 : 0,
|
|
388
|
+
notes: `concise ${example.concise || "-"}, complete ${example.complete || "-"}, accurate ${example.accurate || "-"}; ${example.response_chars} characters`,
|
|
389
|
+
raw: {
|
|
390
|
+
...raw,
|
|
391
|
+
response_chars: example.response_chars
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
/** Resolve a `model:`, `app:` or `profile:` target to the endpoint a publisher's runner calls. */
|
|
399
|
+
async function resolveEndpoint(target, benchmark, env = process.env) {
|
|
400
|
+
const match = /^(model|app|profile):(.+)$/.exec(target);
|
|
401
|
+
if (!match) throw new Error(`target must be model:<router model>, app:<agent app>@<harness/model> or profile:<harness/model>, not '${target}'`);
|
|
402
|
+
const [, kind, id] = match;
|
|
403
|
+
if (kind === "model") return {
|
|
404
|
+
target,
|
|
405
|
+
model: id,
|
|
406
|
+
baseUrl: env.AGENT_BENCH_ROUTER_URL ?? "https://router.tangle.tools/v1",
|
|
407
|
+
apiKeyVar: "TANGLE_API_KEY",
|
|
408
|
+
measured: benchmark.measured
|
|
409
|
+
};
|
|
410
|
+
const bridge = env.AGENT_BENCH_BRIDGE_URL ?? "http://127.0.0.1:3344/v1";
|
|
411
|
+
if (kind === "profile") return {
|
|
412
|
+
target,
|
|
413
|
+
model: id,
|
|
414
|
+
baseUrl: bridge,
|
|
415
|
+
apiKeyVar: "AGENT_BENCH_BRIDGE_KEY",
|
|
416
|
+
measured: "own-loop"
|
|
417
|
+
};
|
|
418
|
+
const at = id.indexOf("@");
|
|
419
|
+
const [name, harness] = at === -1 ? [id, ""] : [id.slice(0, at), id.slice(at + 1)];
|
|
420
|
+
const apps = agentApps(env);
|
|
421
|
+
const app = apps[name];
|
|
422
|
+
if (!app) throw new Error(`no agent app '${name}'; registered: ${Object.keys(apps).join(", ")} (add one with AGENT_BENCH_APPS)`);
|
|
423
|
+
if (!harness) throw new Error(`app:${name} needs @<harness/model>, the subscription harness that runs the app's profile, e.g. app:${name}@opencode/zai-coding-plan/glm-5.3`);
|
|
424
|
+
const catalog = env.AGENT_BENCH_BRIDGE_PROFILES_DIR;
|
|
425
|
+
if (!catalog) throw new Error(`AGENT_BENCH_BRIDGE_PROFILES_DIR is not set: point it at the CLI Bridge's SANDBOX_PROFILES_DIR, where app:${name} writes its profile`);
|
|
426
|
+
const { mcp, model, ...profile } = await readAppProfile(name, app.profileUrl);
|
|
427
|
+
const text = JSON.stringify(profile);
|
|
428
|
+
const digest = createHash("sha256").update(text).digest("hex");
|
|
429
|
+
const profileId = `${name}-${digest.slice(0, 12)}`;
|
|
430
|
+
await mkdir(catalog, { recursive: true });
|
|
431
|
+
await writeFile(path.join(catalog, `${profileId}.json`), text);
|
|
432
|
+
return {
|
|
433
|
+
target,
|
|
434
|
+
model: harness,
|
|
435
|
+
baseUrl: `${bridge.replace(/\/v1\/?$/, "")}/profiles/${profileId}/v1`,
|
|
436
|
+
apiKeyVar: "AGENT_BENCH_BRIDGE_KEY",
|
|
437
|
+
measured: "own-loop",
|
|
438
|
+
app: {
|
|
439
|
+
app: name,
|
|
440
|
+
profileUrl: app.profileUrl,
|
|
441
|
+
profileDigest: `sha256:${digest}`,
|
|
442
|
+
productionModel: model ?? null,
|
|
443
|
+
profileName: typeof profile.name === "string" ? profile.name : null,
|
|
444
|
+
profileVersion: typeof profile.version === "string" ? profile.version : null,
|
|
445
|
+
omittedMcp: mcp && typeof mcp === "object" ? Object.keys(mcp) : []
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
/** An app's profile from its URL, or from an absolute file path. */
|
|
450
|
+
async function readAppProfile(name, source) {
|
|
451
|
+
if (path.isAbsolute(source)) return JSON.parse(await readFile(source, "utf8"));
|
|
452
|
+
const response = await fetch(source);
|
|
453
|
+
if (!response.ok) throw new Error(`${source} answered ${response.status}; app:${name} needs the profile the app serves`);
|
|
454
|
+
return await response.json();
|
|
455
|
+
}
|
|
456
|
+
/** Run one published benchmark against one target with the publisher's runner and grader, and record the result. */
|
|
457
|
+
async function runPublished(name, target, options) {
|
|
458
|
+
const benchmark = PUBLISHED_BENCHMARKS[name];
|
|
459
|
+
if (!benchmark) throw new Error(`no published benchmark '${name}'; registered: ${Object.keys(PUBLISHED_BENCHMARKS).join(", ")}`);
|
|
460
|
+
const env = {
|
|
461
|
+
...process.env,
|
|
462
|
+
...options.env
|
|
463
|
+
};
|
|
464
|
+
if (options.judge !== void 0 && !benchmark.judgeSubstitutable) throw new Error(`${benchmark.name} grades ${benchmark.judge === null ? "deterministically" : `with ${benchmark.judge}`}; this registry cannot substitute its judge`);
|
|
465
|
+
if (options.judge !== void 0 && !options.judge.startsWith("bridge/")) throw new Error(`--judge must be bridge/<harness/model>, not '${options.judge}'`);
|
|
466
|
+
env.AGENT_BENCH_JUDGE_URL ??= env.AGENT_BENCH_BRIDGE_URL ?? "http://127.0.0.1:3344/v1";
|
|
467
|
+
const endpoint = await resolveEndpoint(target, benchmark, env);
|
|
468
|
+
if (!env[endpoint.apiKeyVar]) throw new Error(`${endpoint.apiKeyVar} is not set; the ${target} endpoint needs it`);
|
|
469
|
+
const checkout = await publisherCheckout(benchmark, options.cacheDir, env);
|
|
470
|
+
await mkdir(options.out, { recursive: true });
|
|
471
|
+
const resultPath = path.resolve(options.out, `${benchmark.name}-result${benchmark.resultIsFolder ? "" : ".json"}`);
|
|
472
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
473
|
+
const [command, ...args] = benchmark.run(endpoint, options, resultPath);
|
|
474
|
+
await execute(command, args, checkout, env);
|
|
475
|
+
const taskScores = await benchmark.parse(resultPath);
|
|
476
|
+
const run = {
|
|
477
|
+
benchmark: benchmark.name,
|
|
478
|
+
version: benchmark.version,
|
|
479
|
+
ref: benchmark.ref,
|
|
480
|
+
target,
|
|
481
|
+
model: endpoint.model,
|
|
482
|
+
measured: endpoint.measured,
|
|
483
|
+
judge: options.judge ?? benchmark.judge,
|
|
484
|
+
publisherJudge: benchmark.judge,
|
|
485
|
+
official: options.judge === void 0 && benchmark.unofficial === void 0,
|
|
486
|
+
...benchmark.unofficial ? { unofficial: benchmark.unofficial } : {},
|
|
487
|
+
...endpoint.app ? { app: endpoint.app } : {},
|
|
488
|
+
tasks: taskScores.length,
|
|
489
|
+
passed: taskScores.filter((task) => task.passed).length,
|
|
490
|
+
score: taskScores.length ? taskScores.reduce((sum, task) => sum + task.score, 0) / taskScores.length : 0,
|
|
491
|
+
taskScores,
|
|
492
|
+
resultPath,
|
|
493
|
+
runRecords: path.resolve(options.out, `${benchmark.name}-runrecords.jsonl`),
|
|
494
|
+
license: benchmark.license,
|
|
495
|
+
terms: benchmark.terms,
|
|
496
|
+
startedAt,
|
|
497
|
+
finishedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
498
|
+
};
|
|
499
|
+
await writeFile(run.runRecords, runRecords(run, options).map((record) => JSON.stringify(record)).join("\n") + "\n");
|
|
500
|
+
await writeFile(path.resolve(options.out, `${benchmark.name}-run.json`), `${JSON.stringify(run, null, 2)}\n`);
|
|
501
|
+
return run;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* One agent-eval RunRecord per task, validated by agent-eval's own validator. The publisher's runner makes the model calls,
|
|
505
|
+
* so cost and tokens are uncaptured, never zero. A RunRecord's model must name a served snapshot; a subscription harness
|
|
506
|
+
* reports none, and a snapshot invented from the date would be false, so such rows record `unknown` with terminal outcome
|
|
507
|
+
* `unknown` and keep the requested model in `candidateId`. A pinned model id (a Router snapshot) is recorded as served.
|
|
508
|
+
*/
|
|
509
|
+
function runRecords(run, options) {
|
|
510
|
+
const split = options.record?.splitTag ?? "holdout";
|
|
511
|
+
const sha = (value) => `sha256:${createHash("sha256").update(value).digest("hex")}`;
|
|
512
|
+
const configHash = sha(canonicalJson({
|
|
513
|
+
benchmark: run.benchmark,
|
|
514
|
+
ref: run.ref,
|
|
515
|
+
target: run.target,
|
|
516
|
+
judge: run.judge,
|
|
517
|
+
args: options.args ?? []
|
|
518
|
+
}));
|
|
519
|
+
return run.taskScores.map((task) => {
|
|
520
|
+
const row = {
|
|
521
|
+
runId: randomUUID(),
|
|
522
|
+
experimentId: options.record?.experimentId ?? `${run.benchmark}@${run.ref}`,
|
|
523
|
+
candidateId: options.record?.candidateId ?? run.target,
|
|
524
|
+
seed: 0,
|
|
525
|
+
model: run.model,
|
|
526
|
+
promptHash: run.app?.profileDigest ?? sha(run.target),
|
|
527
|
+
configHash,
|
|
528
|
+
commitSha: run.ref,
|
|
529
|
+
wallMs: Math.max(0, Date.parse(run.finishedAt) - Date.parse(run.startedAt)),
|
|
530
|
+
costUsd: null,
|
|
531
|
+
costProvenance: {
|
|
532
|
+
kind: "uncaptured",
|
|
533
|
+
usd: null
|
|
534
|
+
},
|
|
535
|
+
tokenUsage: {
|
|
536
|
+
input: 0,
|
|
537
|
+
output: 0,
|
|
538
|
+
tokensKnown: false
|
|
539
|
+
},
|
|
540
|
+
terminalOutcome: "succeeded",
|
|
541
|
+
outcome: {
|
|
542
|
+
[split === "holdout" ? "holdoutScore" : "searchScore"]: task.score,
|
|
543
|
+
raw: {
|
|
544
|
+
passed: task.passed ? 1 : 0,
|
|
545
|
+
...task.raw
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
splitTag: split,
|
|
549
|
+
scenarioId: `${run.benchmark}:${task.id}`
|
|
550
|
+
};
|
|
551
|
+
try {
|
|
552
|
+
return validateRunRecord(row);
|
|
553
|
+
} catch (error) {
|
|
554
|
+
if (!(error instanceof RunRecordValidationError) || error.path !== "model") throw error;
|
|
555
|
+
return validateRunRecord({
|
|
556
|
+
...row,
|
|
557
|
+
model: UNKNOWN_MODEL,
|
|
558
|
+
terminalOutcome: "unknown"
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
/** The publisher's repository at the pinned commit, installed once per cache. */
|
|
564
|
+
async function publisherCheckout(benchmark, cacheDir, env) {
|
|
565
|
+
const root = cacheDir ?? path.join(homedir(), ".cache", "agent-bench", "published");
|
|
566
|
+
const dir = path.join(root, `${benchmark.name}@${benchmark.ref}`);
|
|
567
|
+
const installed = path.join(dir, ".agent-bench-installed");
|
|
568
|
+
if (existsSync(installed)) return dir;
|
|
569
|
+
if (!existsSync(path.join(dir, ".git"))) {
|
|
570
|
+
await mkdir(root, { recursive: true });
|
|
571
|
+
await execute("git", [
|
|
572
|
+
"clone",
|
|
573
|
+
"--quiet",
|
|
574
|
+
"--filter=blob:none",
|
|
575
|
+
"--no-checkout",
|
|
576
|
+
benchmark.repository,
|
|
577
|
+
dir
|
|
578
|
+
], root, env);
|
|
579
|
+
}
|
|
580
|
+
await execute("git", [
|
|
581
|
+
"checkout",
|
|
582
|
+
"--quiet",
|
|
583
|
+
"--detach",
|
|
584
|
+
benchmark.ref
|
|
585
|
+
], dir, env);
|
|
586
|
+
for (const [command, ...args] of benchmark.install) await execute(command, args, dir, env);
|
|
587
|
+
await writeFile(installed, `${benchmark.ref}\n`);
|
|
588
|
+
return dir;
|
|
589
|
+
}
|
|
590
|
+
function execute(command, args, cwd, env) {
|
|
591
|
+
return new Promise((resolve, reject) => {
|
|
592
|
+
const child = spawn(command, args, {
|
|
593
|
+
cwd,
|
|
594
|
+
env,
|
|
595
|
+
stdio: "inherit"
|
|
596
|
+
});
|
|
597
|
+
child.once("error", (error) => reject(/* @__PURE__ */ new Error(`${command} could not start in ${cwd}: ${error.message}`)));
|
|
598
|
+
child.once("exit", (code, signal) => code === 0 ? resolve() : reject(/* @__PURE__ */ new Error(`${command} ${args.slice(0, 3).join(" ")} exited ${signal ?? code} in ${cwd}`)));
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
// src/cli.ts
|
|
602
|
+
/**
|
|
603
|
+
* agent-bench run <benchmark> --target <model:|app:|profile:> [--tasks N] [--task <publisher task id>]... [--out <dir>] [-- <runner args>]
|
|
604
|
+
* agent-bench list
|
|
605
|
+
*
|
|
606
|
+
* Runs a published benchmark with its publisher's own runner and grader (src/published.ts), prints the score with what it
|
|
607
|
+
* measured, and writes the run record to --out (default ./agent-bench-runs/<benchmark>-<time>).
|
|
608
|
+
*/
|
|
609
|
+
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";
|
|
610
|
+
async function main(argv) {
|
|
611
|
+
const [command, ...rest] = argv;
|
|
612
|
+
if (command === "list") {
|
|
613
|
+
for (const benchmark of Object.values(PUBLISHED_BENCHMARKS)) console.log(`${benchmark.name} ${benchmark.version} ${benchmark.repository}@${benchmark.ref.slice(0, 12)} ${benchmark.measured} judge=${benchmark.judge ?? "deterministic"} license=${benchmark.license}`);
|
|
614
|
+
return 0;
|
|
615
|
+
}
|
|
616
|
+
if (command !== "run" || !rest[0] || rest[0].startsWith("-")) {
|
|
617
|
+
console.error(usage);
|
|
618
|
+
return 2;
|
|
619
|
+
}
|
|
620
|
+
const name = rest[0];
|
|
621
|
+
const separator = rest.indexOf("--");
|
|
622
|
+
const own = separator === -1 ? rest.slice(1) : rest.slice(1, separator);
|
|
623
|
+
const runnerArgs = separator === -1 ? [] : rest.slice(separator + 1);
|
|
624
|
+
let target;
|
|
625
|
+
let tasks;
|
|
626
|
+
const taskIds = [];
|
|
627
|
+
let out;
|
|
628
|
+
let judge;
|
|
629
|
+
const record = {};
|
|
630
|
+
for (let i = 0; i < own.length; i++) {
|
|
631
|
+
const flag = own[i];
|
|
632
|
+
const value = own[i + 1];
|
|
633
|
+
if (value === void 0) throw new Error(`${flag} needs a value\n${usage}`);
|
|
634
|
+
if (flag === "--target") target = value;
|
|
635
|
+
else if (flag === "--tasks") tasks = Number.parseInt(value, 10);
|
|
636
|
+
else if (flag === "--task") taskIds.push(value);
|
|
637
|
+
else if (flag === "--out") out = value;
|
|
638
|
+
else if (flag === "--judge") judge = value;
|
|
639
|
+
else if (flag === "--experiment") record.experimentId = value;
|
|
640
|
+
else if (flag === "--candidate") record.candidateId = value;
|
|
641
|
+
else if (flag === "--split") record.splitTag = value;
|
|
642
|
+
else throw new Error(`unknown option ${flag}\n${usage}`);
|
|
643
|
+
i++;
|
|
644
|
+
}
|
|
645
|
+
if (!target) throw new Error(`--target is required\n${usage}`);
|
|
646
|
+
if (tasks !== void 0 && !(Number.isSafeInteger(tasks) && tasks > 0)) throw new Error("--tasks must be a positive integer");
|
|
647
|
+
const run = await runPublished(name, target, {
|
|
648
|
+
...tasks === void 0 ? {} : { tasks },
|
|
649
|
+
...taskIds.length ? { taskIds } : {},
|
|
650
|
+
...judge === void 0 ? {} : { judge },
|
|
651
|
+
...Object.keys(record).length ? { record } : {},
|
|
652
|
+
args: runnerArgs,
|
|
653
|
+
out: path.resolve(out ?? path.join("agent-bench-runs", `${name}-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`))
|
|
654
|
+
});
|
|
655
|
+
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}` : void 0, run.unofficial].filter(Boolean).join("; ")}, not official`})`);
|
|
656
|
+
if (run.app) console.log(`app: ${run.app.app} profile ${run.app.profileName ?? "?"} ${run.app.profileVersion ?? ""} ${run.app.profileDigest.slice(0, 19)} from ${run.app.profileUrl}; its production model ${JSON.stringify(run.app.productionModel)} replaced by ${run.model}; its MCP servers not mounted: ${run.app.omittedMcp.join(", ") || "none"}`);
|
|
657
|
+
console.log(`record: ${path.join(path.dirname(run.resultPath), `${run.benchmark}-run.json`)}`);
|
|
658
|
+
console.log(`run records: ${run.runRecords}`);
|
|
659
|
+
return 0;
|
|
660
|
+
}
|
|
661
|
+
main(process.argv.slice(2)).then((code) => process.exit(code), (error) => {
|
|
662
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
663
|
+
process.exit(1);
|
|
664
|
+
});
|
|
665
|
+
export {};
|
|
666
|
+
|
|
667
|
+
//# sourceMappingURL=cli.js.map
|