@tangle-network/agent-bench 2.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +32 -2
  3. package/dist/adapters.d.ts +3 -3
  4. package/dist/adapters.js +3 -5
  5. package/dist/adapters.js.map +1 -1
  6. package/dist/benchmarks/_harness.d.ts +4 -4
  7. package/dist/benchmarks/_harness.js +5 -2
  8. package/dist/benchmarks/_harness.js.map +1 -1
  9. package/dist/benchmarks/aec-bench.d.ts +2 -2
  10. package/dist/benchmarks/aec-bench.js +49 -42
  11. package/dist/benchmarks/aec-bench.js.map +1 -1
  12. package/dist/benchmarks/agentbench.d.ts +2 -2
  13. package/dist/benchmarks/agentbench.js +41 -34
  14. package/dist/benchmarks/agentbench.js.map +1 -1
  15. package/dist/benchmarks/appworld.d.ts +4 -4
  16. package/dist/benchmarks/appworld.js +67 -53
  17. package/dist/benchmarks/appworld.js.map +1 -1
  18. package/dist/benchmarks/bfcl.d.ts +2 -2
  19. package/dist/benchmarks/bfcl.js +52 -44
  20. package/dist/benchmarks/bfcl.js.map +1 -1
  21. package/dist/benchmarks/cad-design.d.ts +2 -2
  22. package/dist/benchmarks/cad-design.js +53 -44
  23. package/dist/benchmarks/cad-design.js.map +1 -1
  24. package/dist/benchmarks/cadbench.d.ts +2 -2
  25. package/dist/benchmarks/cadbench.js +1 -1
  26. package/dist/benchmarks/cadgenbench.d.ts +2 -2
  27. package/dist/benchmarks/cadgenbench.js +1 -1
  28. package/dist/benchmarks/commit0.d.ts +2 -2
  29. package/dist/benchmarks/commit0.js +38 -31
  30. package/dist/benchmarks/commit0.js.map +1 -1
  31. package/dist/benchmarks/crag.d.ts +2 -2
  32. package/dist/benchmarks/crag.js +37 -32
  33. package/dist/benchmarks/crag.js.map +1 -1
  34. package/dist/benchmarks/dabstep.d.ts +2 -2
  35. package/dist/benchmarks/dabstep.js +41 -34
  36. package/dist/benchmarks/dabstep.js.map +1 -1
  37. package/dist/benchmarks/finresearchbench.d.ts +4 -4
  38. package/dist/benchmarks/finresearchbench.js +61 -48
  39. package/dist/benchmarks/finresearchbench.js.map +1 -1
  40. package/dist/benchmarks/finsearchcomp.d.ts +3 -3
  41. package/dist/benchmarks/finsearchcomp.js +54 -43
  42. package/dist/benchmarks/finsearchcomp.js.map +1 -1
  43. package/dist/benchmarks/frames.d.ts +2 -2
  44. package/dist/benchmarks/frames.js +66 -51
  45. package/dist/benchmarks/frames.js.map +1 -1
  46. package/dist/benchmarks/hotpotqa.d.ts +2 -2
  47. package/dist/benchmarks/hotpotqa.js +59 -47
  48. package/dist/benchmarks/hotpotqa.js.map +1 -1
  49. package/dist/benchmarks/humaneval.d.ts +3 -3
  50. package/dist/benchmarks/humaneval.js +39 -35
  51. package/dist/benchmarks/humaneval.js.map +1 -1
  52. package/dist/benchmarks/mcad-bench.d.ts +2 -2
  53. package/dist/benchmarks/mcad-bench.js +68 -56
  54. package/dist/benchmarks/mcad-bench.js.map +1 -1
  55. package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
  56. package/dist/benchmarks/mcad-cq-bench.js +69 -57
  57. package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
  58. package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
  59. package/dist/benchmarks/mcad-cq-golds.js +1 -1
  60. package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
  61. package/dist/benchmarks/mcad-golds.d.ts +1 -1
  62. package/dist/benchmarks/mcad-golds.js.map +1 -1
  63. package/dist/benchmarks/mind2web.d.ts +3 -3
  64. package/dist/benchmarks/mind2web.js +62 -49
  65. package/dist/benchmarks/mind2web.js.map +1 -1
  66. package/dist/benchmarks/nomiracl.d.ts +2 -2
  67. package/dist/benchmarks/nomiracl.js +43 -36
  68. package/dist/benchmarks/nomiracl.js.map +1 -1
  69. package/dist/benchmarks/open-rag-bench.d.ts +2 -2
  70. package/dist/benchmarks/open-rag-bench.js +37 -32
  71. package/dist/benchmarks/open-rag-bench.js.map +1 -1
  72. package/dist/benchmarks/programbench.d.ts +2 -2
  73. package/dist/benchmarks/programbench.js +28 -23
  74. package/dist/benchmarks/programbench.js.map +1 -1
  75. package/dist/benchmarks/rag-shared.d.ts +2 -2
  76. package/dist/benchmarks/rag-shared.js +15 -13
  77. package/dist/benchmarks/rag-shared.js.map +1 -1
  78. package/dist/benchmarks/ragbench.d.ts +2 -2
  79. package/dist/benchmarks/ragbench.js +34 -29
  80. package/dist/benchmarks/ragbench.js.map +1 -1
  81. package/dist/benchmarks/simpleqa.d.ts +2 -2
  82. package/dist/benchmarks/simpleqa.js +62 -51
  83. package/dist/benchmarks/simpleqa.js.map +1 -1
  84. package/dist/benchmarks/swe-bench.d.ts +4 -4
  85. package/dist/benchmarks/swe-bench.js +47 -41
  86. package/dist/benchmarks/swe-bench.js.map +1 -1
  87. package/dist/benchmarks/t2-ragbench.d.ts +2 -2
  88. package/dist/benchmarks/t2-ragbench.js +37 -32
  89. package/dist/benchmarks/t2-ragbench.js.map +1 -1
  90. package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
  91. package/dist/benchmarks/tau-bench-shared.js +43 -36
  92. package/dist/benchmarks/tau-bench-shared.js.map +1 -1
  93. package/dist/benchmarks/tau2-bench.d.ts +2 -2
  94. package/dist/benchmarks/tau2-bench.js.map +1 -1
  95. package/dist/benchmarks/tau3-banking.d.ts +2 -2
  96. package/dist/benchmarks/tau3-banking.js.map +1 -1
  97. package/dist/benchmarks/terminal-bench.d.ts +2 -2
  98. package/dist/benchmarks/terminal-bench.js +29 -23
  99. package/dist/benchmarks/terminal-bench.js.map +1 -1
  100. package/dist/benchmarks/toollm.d.ts +2 -2
  101. package/dist/benchmarks/toollm.js +40 -34
  102. package/dist/benchmarks/toollm.js.map +1 -1
  103. package/dist/benchmarks/trata-hedge.d.ts +2 -2
  104. package/dist/benchmarks/trata-hedge.js +46 -38
  105. package/dist/benchmarks/trata-hedge.js.map +1 -1
  106. package/dist/benchmarks/types.d.ts +33 -63
  107. package/dist/benchmarks/types.js +36 -1
  108. package/dist/benchmarks/types.js.map +1 -0
  109. package/dist/benchmarks/webarena-verified.d.ts +2 -2
  110. package/dist/benchmarks/webarena-verified.js +29 -24
  111. package/dist/benchmarks/webarena-verified.js.map +1 -1
  112. package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
  113. package/dist/cadbench-htzAmMaI.js.map +1 -0
  114. package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
  115. package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
  116. package/dist/cli.d.ts +1 -0
  117. package/dist/cli.js +667 -0
  118. package/dist/cli.js.map +1 -0
  119. package/dist/index.d.ts +43 -22
  120. package/dist/index.js +297 -144
  121. package/dist/index.js.map +1 -1
  122. package/package.json +7 -4
  123. package/pier_agents/candidate_contract.py +226 -74
  124. package/pier_agents/tangle_candidate.py +79 -1
  125. package/pier_agents/workspace_boundary.py +29 -1
  126. package/scripts/enterpriseops-gym-run.sh +82 -0
  127. package/scripts/grade-recorded-evidence.mjs +6 -6
  128. package/scripts/harvey-lab-judge.py +50 -0
  129. package/scripts/harvey-lab-run.sh +53 -0
  130. package/scripts/harvey-lab-sandbox.sh +21 -0
  131. package/scripts/healthbench-professional-run.sh +30 -0
  132. package/scripts/healthbench_professional_run.py +112 -0
  133. package/scripts/mlcr-run.sh +17 -0
  134. package/scripts/mlcr_run.py +133 -0
  135. package/scripts/prbench-run.sh +39 -0
  136. package/scripts/prbench_run.py +53 -0
  137. package/scripts/verify-packed-consumer.mjs +32 -27
  138. package/scripts/verify-pier-agent.mts +142 -25
  139. package/src/adapters.ts +5 -7
  140. package/src/benchmarks/_harness.test.mts +18 -1
  141. package/src/benchmarks/_harness.ts +12 -7
  142. package/src/benchmarks/aec-bench.test.mts +14 -14
  143. package/src/benchmarks/aec-bench.ts +62 -56
  144. package/src/benchmarks/agent-eval-contract.test.mts +38 -0
  145. package/src/benchmarks/agentbench.ts +44 -37
  146. package/src/benchmarks/appworld.test.mts +7 -7
  147. package/src/benchmarks/appworld.ts +88 -75
  148. package/src/benchmarks/bfcl.ts +60 -53
  149. package/src/benchmarks/cad-design.ts +34 -32
  150. package/src/benchmarks/cadbench.ts +34 -32
  151. package/src/benchmarks/cadgenbench.ts +30 -28
  152. package/src/benchmarks/commit0.test.mts +9 -9
  153. package/src/benchmarks/commit0.ts +50 -43
  154. package/src/benchmarks/crag.ts +45 -40
  155. package/src/benchmarks/dabstep-official.test.mts +8 -8
  156. package/src/benchmarks/dabstep.test.mts +11 -11
  157. package/src/benchmarks/dabstep.ts +47 -40
  158. package/src/benchmarks/external-adapters.test.mts +43 -44
  159. package/src/benchmarks/finresearchbench.ts +57 -47
  160. package/src/benchmarks/finsearchcomp.ts +72 -67
  161. package/src/benchmarks/frames.ts +76 -69
  162. package/src/benchmarks/hotpotqa.ts +69 -64
  163. package/src/benchmarks/humaneval.ts +37 -35
  164. package/src/benchmarks/mcad-bench.test.mts +30 -30
  165. package/src/benchmarks/mcad-bench.ts +66 -60
  166. package/src/benchmarks/mcad-cq-bench.ts +69 -63
  167. package/src/benchmarks/mcad-cq-golds.ts +1 -1
  168. package/src/benchmarks/mcad-cq.test.mts +40 -40
  169. package/src/benchmarks/mcad-golds.ts +1 -1
  170. package/src/benchmarks/mind2web.ts +66 -58
  171. package/src/benchmarks/nomiracl.ts +53 -46
  172. package/src/benchmarks/open-rag-bench.ts +47 -42
  173. package/src/benchmarks/programbench.test.mts +10 -10
  174. package/src/benchmarks/programbench.ts +38 -33
  175. package/src/benchmarks/rag-benchmarks.test.mts +31 -31
  176. package/src/benchmarks/rag-shared.ts +13 -16
  177. package/src/benchmarks/ragbench.ts +44 -39
  178. package/src/benchmarks/simpleqa.ts +78 -73
  179. package/src/benchmarks/swe-bench.test.mts +3 -3
  180. package/src/benchmarks/swe-bench.ts +66 -61
  181. package/src/benchmarks/t2-ragbench.ts +47 -42
  182. package/src/benchmarks/tau-bench-shared.ts +51 -44
  183. package/src/benchmarks/tau-pin.test.mts +1 -1
  184. package/src/benchmarks/tau2-bench.ts +2 -2
  185. package/src/benchmarks/tau3-banking.ts +2 -2
  186. package/src/benchmarks/terminal-bench.test.mts +3 -3
  187. package/src/benchmarks/terminal-bench.ts +41 -36
  188. package/src/benchmarks/toollm.ts +54 -47
  189. package/src/benchmarks/trata-hedge.ts +57 -52
  190. package/src/benchmarks/types.ts +70 -59
  191. package/src/benchmarks/webarena-verified.ts +49 -42
  192. package/src/cli.ts +74 -0
  193. package/src/corpus-replay.mts +9 -9
  194. package/src/examples/benchmark-matrix.mts +13 -10
  195. package/src/gate-cli.mts +5 -5
  196. package/src/gate.test.mts +14 -12
  197. package/src/gate.ts +23 -22
  198. package/src/index.ts +20 -11
  199. package/src/pier-agent.ts +108 -38
  200. package/src/pier-trial-controller.test.mts +48 -1
  201. package/src/pier-trial-controller.ts +121 -8
  202. package/src/published.test.mts +534 -0
  203. package/src/published.ts +524 -0
  204. package/src/run-benchmarks-cli.mts +2 -2
  205. package/src/run-benchmarks.test.mts +58 -48
  206. package/src/run-benchmarks.ts +64 -57
  207. package/src/swe-bench-env.ts +6 -6
  208. package/src/worker.ts +1 -1
  209. package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
  210. package/dist/benchmarks/enterpriseops-gym.js +0 -236
  211. package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
  212. package/dist/cadbench-Byr5gO1M.js.map +0 -1
  213. package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
  214. package/fixtures/enterpriseops-gym.json +0 -103
  215. package/scripts/enterpriseops_gym_judge.py +0 -281
  216. package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
  217. package/src/benchmarks/enterpriseops-gym.ts +0 -343
  218. package/src/eops-skills/address-every-subtask.md +0 -5
  219. package/src/eops-skills/exact-tools-and-args.md +0 -5
  220. package/src/eops-skills/full-sequence-to-goal.md +0 -5
  221. package/src/eops-skills/ground-every-value.md +0 -5
  222. package/src/eops-skills/honor-the-policies.md +0 -5
@@ -0,0 +1,82 @@
1
+ #!/bin/sh
2
+ # EnterpriseOps-Gym through its publisher's own runner (ServiceNow/EnterpriseOps-Gym evaluate.py), from the publisher checkout:
3
+ # enterpriseops-gym-run.sh <result folder> <base url> <model> <key env var> <task count|all> <task ids,> [--domain d] [--mode m] [--concurrency n]
4
+ # Writes the sampled task configs exactly as evaluate.py writes them for --hf_dataset, starts each gym's MCP server image on the
5
+ # port the configs name, writes an OpenAI-compatible (vllm provider) LLM config whose key comes from <key env var>, and runs
6
+ # evaluate.py --configs_folder. The image digests used are recorded beside the results. The publisher's pyproject does not declare
7
+ # aiohttp or nest_asyncio, which its code imports (every other third-party import is declared), so each run adds both.
8
+ set -eu
9
+ out=$1 base=$2 model=$3 keyvar=$4 tasks=$5 ids=$6
10
+ shift 6
11
+ domain=teams mode=oracle concurrency=2
12
+ while [ $# -gt 0 ]; do
13
+ case $1 in
14
+ --domain) domain=$2; shift 2 ;;
15
+ --mode) mode=$2; shift 2 ;;
16
+ --concurrency) concurrency=$2; shift 2 ;;
17
+ *) echo "enterpriseops-gym-run: unknown option $1" >&2; exit 2 ;;
18
+ esac
19
+ done
20
+ work=$(mktemp -d)
21
+ containers=''
22
+ cleanup() { for c in $containers; do docker rm -f "$c" >/dev/null 2>&1 || true; done; rm -rf "$work"; }
23
+ trap cleanup EXIT INT TERM
24
+ mkdir -p "$out"
25
+
26
+ uv run --extra openai --with aiohttp --with nest_asyncio python - "$work/configs" "$mode" "$domain" "$tasks" "$ids" > "$work/servers" <<'PY'
27
+ import json, os, sys
28
+ from datasets import load_dataset
29
+ folder, mode, domain, limit, ids = sys.argv[1:6]
30
+ os.makedirs(folder)
31
+ wanted = [task_id for task_id in ids.split(',') if task_id]
32
+ servers, count = set(), 0
33
+ for row in load_dataset('ServiceNow-AI/EnterpriseOps-Gym', mode, split=domain):
34
+ if wanted and row['task_id'] not in wanted:
35
+ continue
36
+ task = {key: json.loads(value) if key in ('gym_servers_config', 'verifiers') and isinstance(value, str) else value
37
+ for key, value in row.items() if key not in ('task_id', 'domain')}
38
+ with open(os.path.join(folder, f"{mode}__{domain}__{row['task_id']}.json"), 'w') as handle:
39
+ json.dump(task, handle)
40
+ servers.update((server['mcp_server_name'], server['mcp_server_url']) for server in task['gym_servers_config'])
41
+ count += 1
42
+ if not wanted and limit != 'all' and count >= int(limit):
43
+ break
44
+ if wanted and count != len(wanted):
45
+ sys.exit(f'only {count} of {len(wanted)} task ids exist in {mode}/{domain}')
46
+ for name, url in sorted(servers):
47
+ print(name, url)
48
+ PY
49
+
50
+ while read -r name url; do
51
+ case $name in
52
+ gym-teams-mcp) image=teams ;; sn-csm-server) image=csm ;; gym-email-mcp) image=email ;; gym-itsm-mcp) image=itsm ;;
53
+ gym-calendar) image=calendar ;; sn-hr-internal) image=hr ;; gym-google-drive-mcp) image=drive ;;
54
+ *) echo "enterpriseops-gym-run: no published image for gym $name" >&2; exit 2 ;;
55
+ esac
56
+ port=${url##*:}
57
+ port=${port%%/*}
58
+ inner=8005
59
+ [ "$image" = calendar ] && inner=8003
60
+ ref="shivakrishnareddyma225/enterpriseops-gym-mcp-$image:latest"
61
+ container="agent-bench-eog-$image-$$"
62
+ docker run -d --rm --name "$container" -p "127.0.0.1:$port:$inner" "$ref" >/dev/null
63
+ containers="$containers $container"
64
+ docker image inspect --format '{{index .RepoDigests 0}}' "$ref" >> "$out/images.txt"
65
+ tries=0
66
+ until curl -s -o /dev/null -X POST -H 'content-type: application/json' -d '{}' "http://127.0.0.1:$port/mcp"; do
67
+ tries=$((tries + 1))
68
+ [ "$tries" -lt 120 ] || { echo "enterpriseops-gym-run: gym $name did not answer on port $port" >&2; exit 1; }
69
+ sleep 1
70
+ done
71
+ done < "$work/servers"
72
+
73
+ umask 077
74
+ KEY_VAR=$keyvar python3 - "$work/llm.json" "$model" "$base" <<'PY'
75
+ import json, os, sys
76
+ path, model, base = sys.argv[1:4]
77
+ with open(path, 'w') as handle:
78
+ json.dump({'llm_provider': 'vllm', 'llm_model': model, 'llm_api_key': os.environ[os.environ['KEY_VAR']],
79
+ 'llm_api_endpoint': base, 'temperature': 0.0, 'max_tokens': 4096}, handle)
80
+ PY
81
+ uv run --extra openai --with aiohttp --with nest_asyncio python evaluate.py --configs_folder "$work/configs" --llm_config "$work/llm.json" --output_folder "$out" \
82
+ --orchestrator react --concurrency "$concurrency" --num_runs 1
@@ -38,13 +38,13 @@ for (const [benchmark, id, artifact, resolved, parserResults] of [
38
38
  terminal('hello-world'), terminal('fix-permissions'), swe('astropy__astropy-12907'),
39
39
  ]) {
40
40
  const adapter = resolveAdapter(benchmark)
41
- await adapter.preflight()
42
- const [task] = await adapter.loadTasks({ ids: [id] })
41
+ await adapter.runtime.preflight?.()
42
+ const [task] = await adapter.loadAll({ ids: [id] })
43
43
  assert.equal(task?.id, id, `${benchmark} did not load ${id}`)
44
- const score = await adapter.judge(task, artifact)
45
- const line = `official grade ${benchmark} ${id}: ${score.resolved ? 'resolved' : 'unresolved'} ${score.detail}`
44
+ const score = await adapter.evaluate(task, artifact)
45
+ const line = `official grade ${benchmark} ${id}: ${score.passed ? 'resolved' : 'unresolved'} ${score.notes}`
46
46
  console.log(line)
47
47
  if (process.env.GITHUB_STEP_SUMMARY) appendFileSync(process.env.GITHUB_STEP_SUMMARY, `- ${line}\n`)
48
- assert.equal(score.resolved, resolved, `${id} grade differs from its recorded official verdict`)
49
- if (parserResults) assert.deepEqual(JSON.parse(score.detail), parserResults, `${id} checks differ from the recorded run`)
48
+ assert.equal(score.passed, resolved, `${id} grade differs from its recorded official verdict`)
49
+ if (parserResults) assert.deepEqual(JSON.parse(score.notes), parserResults, `${id} checks differ from the recorded run`)
50
50
  }
@@ -0,0 +1,50 @@
1
+ """Harvey LAB's own `lab_core.evaluation.run_eval`, with one judge provider added: `bridge/<harness/model>`.
2
+
3
+ The publisher's Judge picks an SDK from the judge model's name (claude-, gpt-, gemini-, mistral-), and its standard pair
4
+ (claude-sonnet-4-6 + gpt-5.5) bills per token. A judge served on a subscription seat reaches the benchmark through a CLI
5
+ Bridge instead: a judge named `bridge/<harness/model>` sends the publisher's own prompt as one tool-less chat completion to
6
+ AGENT_BENCH_JUDGE_URL and reads the verdict with the publisher's own parser. Rubrics, prompts, scoring, the all-pass rule and
7
+ every other judge name stay the publisher's code. A run judged this way is not official, and agent-bench records it so.
8
+
9
+ Usage, from the Harvey LAB checkout: uv run python harvey-lab-judge.py <run_eval arguments>
10
+ """
11
+ import os
12
+ import runpy
13
+ import sys
14
+
15
+ import openai
16
+ from lab_core.evaluation import judge
17
+
18
+ PREFIX = 'bridge/'
19
+ publisher_detect, publisher_init, publisher_evaluate = judge._detect_provider, judge.Judge.__init__, judge.Judge.evaluate
20
+
21
+
22
+ def detect(model):
23
+ return 'bridge' if model.startswith(PREFIX) else publisher_detect(model)
24
+
25
+
26
+ def init(self, model='claude-sonnet-4-6'):
27
+ if not model.startswith(PREFIX):
28
+ return publisher_init(self, model)
29
+ self.model, self.provider = model, 'bridge'
30
+ self.client = openai.OpenAI(base_url=os.environ['AGENT_BENCH_JUDGE_URL'], api_key=os.environ.get('AGENT_BENCH_JUDGE_KEY') or 'loopback')
31
+
32
+
33
+ def evaluate(self, prompt_template, variables, temperature=0.0, _retries=2):
34
+ if self.provider != 'bridge':
35
+ return publisher_evaluate(self, prompt_template, variables, temperature, _retries)
36
+ prompt, last = prompt_template.format(**variables), None
37
+ for _ in range(_retries):
38
+ try:
39
+ # tool_choice none: the judge answers from the prompt alone, without the harness's own tools.
40
+ response = self.client.chat.completions.create(model=self.model[len(PREFIX):], tool_choice='none',
41
+ messages=[{'role': 'user', 'content': prompt}])
42
+ return judge.Judge._parse_json(response.choices[0].message.content or '')
43
+ except Exception as error: # the publisher's judges retry any failure the same way
44
+ last = error
45
+ raise ValueError(f'Judge returned unparseable response after {_retries} attempts: {last}')
46
+
47
+
48
+ judge._detect_provider, judge.Judge.__init__, judge.Judge.evaluate = detect, init, evaluate
49
+ sys.argv[0] = 'lab_core.evaluation.run_eval'
50
+ runpy.run_module('lab_core.evaluation.run_eval', run_name='__main__', alter_sys=True)
@@ -0,0 +1,53 @@
1
+ #!/bin/sh
2
+ # Harvey LAB through its publisher's own harness and rubric grader (harveyai/harvey-labs lab_core), from the publisher checkout:
3
+ # harvey-lab-run.sh <result folder> <base url> <model> <key env var> <task count|all> <task ids,> <judge> [--area a] [--max-turns n] [--parallel n]
4
+ # Each task runs lab_core.harness.run with the publisher's baseten/ adapter (OpenAI-compatible chat completions with tools) at
5
+ # <base url>, in the sandbox image built from the pinned checkout's own Dockerfile, then lab_core.evaluation.run_eval.
6
+ # <judge> is `publisher` (the LAB standard pair, claude-sonnet-4-6 + gpt-5.5, which bills ANTHROPIC_API_KEY and OPENAI_API_KEY)
7
+ # or bridge/<harness/model>, a substituted judge on a CLI Bridge at AGENT_BENCH_JUDGE_URL (harvey-lab-judge.py).
8
+ # Tasks are the given ids, or the first <task count> task ids in sorted order (under tasks/<area> with --area).
9
+ # Each run's results/<run id> folder moves to <result folder>, and tasks.tsv maps run ids to task ids.
10
+ set -eu
11
+ out=$1 base=$2 model=$3 keyvar=$4 tasks=$5 ids=$6 judge=$7
12
+ shift 7
13
+ area='' max_turns=200 parallel=2
14
+ while [ $# -gt 0 ]; do
15
+ case $1 in
16
+ --area) area=$2; shift 2 ;;
17
+ --max-turns) max_turns=$2; shift 2 ;;
18
+ --parallel) parallel=$2; shift 2 ;;
19
+ *) echo "harvey-lab-run: unknown option $1" >&2; exit 2 ;;
20
+ esac
21
+ done
22
+ here=$(cd "$(dirname "$0")" && pwd)
23
+ PATH="$PWD/.agent-bench/bin:$PATH"
24
+ export PATH
25
+ if [ "$judge" = publisher ] && { [ -z "${ANTHROPIC_API_KEY:-}" ] || [ -z "${OPENAI_API_KEY:-}" ]; }; then
26
+ echo "harvey-lab-run: the publisher's judges need ANTHROPIC_API_KEY and OPENAI_API_KEY; pass --judge bridge/<harness/model> to substitute one" >&2
27
+ exit 2
28
+ fi
29
+ mkdir -p "$out"
30
+ if [ -n "$ids" ]; then
31
+ list=$(echo "$ids" | tr ',' '\n')
32
+ else
33
+ list=$(find "tasks${area:+/$area}" -name task.json | sed 's|^tasks/||; s|/task.json$||' | sort)
34
+ [ "$tasks" = all ] || list=$(echo "$list" | head -n "$tasks")
35
+ fi
36
+ [ -n "$list" ] || { echo "harvey-lab-run: no tasks under tasks${area:+/$area}" >&2; exit 2; }
37
+ image=$(cat .agent-bench/sandbox-image)
38
+ BASETEN_BASE_URL=$base
39
+ BASETEN_API_KEY=$(printenv "$keyvar")
40
+ export BASETEN_BASE_URL BASETEN_API_KEY
41
+ for task in $list; do
42
+ run="agent-bench-$$-$(echo "$task" | tr '/' '_')"
43
+ printf '%s\t%s\n' "$run" "$task" >> "$out/tasks.tsv"
44
+ # A harness or grading failure leaves the task without scores, which the parser counts as failed.
45
+ uv run python -m lab_core.harness.run --model "baseten/$model" --task "$task" --run-id "$run" --max-turns "$max_turns" \
46
+ --sandbox-image "$image" || echo "harvey-lab-run: the harness failed on $task" >&2
47
+ if [ "$judge" = publisher ]; then
48
+ uv run python -m lab_core.evaluation.run_eval --run-id "$run" --task "$task" --parallel "$parallel" || echo "harvey-lab-run: grading failed on $task" >&2
49
+ else
50
+ uv run python "$here/harvey-lab-judge.py" --run-id "$run" --task "$task" --judges "$judge" --parallel "$parallel" || echo "harvey-lab-run: grading failed on $task" >&2
51
+ fi
52
+ [ ! -d "results/$run" ] || mv "results/$run" "$out/$run"
53
+ done
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ # Harvey LAB's sandbox, from the publisher checkout: the image its own fallback builds (lab_core/sandbox/Dockerfile at the
3
+ # pinned commit, never the moving ghcr.io/harveyai/lab-sandbox:latest), tagged by commit and recorded in .agent-bench/sandbox-image.
4
+ # The harness drives podman. On a host with docker and no podman, .agent-bench/bin/podman runs the same subcommands through
5
+ # docker, adding --user <host uid:gid> to `run`: rootless podman maps the host user to the container's root, and without it
6
+ # docker's root, with every capability dropped, cannot write the host-owned workspace.
7
+ set -eu
8
+ mkdir -p .agent-bench/bin
9
+ if ! command -v podman >/dev/null 2>&1; then
10
+ command -v docker >/dev/null 2>&1 || { echo "harvey-lab-sandbox: Harvey LAB needs podman or docker" >&2; exit 1; }
11
+ cat > .agent-bench/bin/podman <<'SH'
12
+ #!/bin/sh
13
+ if [ "$1" = run ]; then shift; exec docker run --user "$(id -u):$(id -g)" "$@"; fi
14
+ exec docker "$@"
15
+ SH
16
+ chmod +x .agent-bench/bin/podman
17
+ fi
18
+ PATH="$PWD/.agent-bench/bin:$PATH"
19
+ tag="agent-bench/lab-sandbox:$(git rev-parse --short=12 HEAD)"
20
+ podman image inspect "$tag" >/dev/null 2>&1 || podman build -q -f lab_core/sandbox/Dockerfile -t "$tag" lab_core/sandbox
21
+ echo "$tag" > .agent-bench/sandbox-image
@@ -0,0 +1,30 @@
1
+ #!/bin/sh
2
+ # HealthBench Professional through openai/simple-evals' own HealthBenchEval (healthbench_professional_run.py), from the publisher checkout:
3
+ # healthbench-professional-run.sh <result folder> <base url> <model> <key env var> <task count|all> <task ids,> <judge>
4
+ # The data is the openai/healthbench-professional release at the pinned revision, fetched into the checkout on first use and
5
+ # checked against its sha256; it is never committed (the authors ask that examples not be revealed). <judge> is `publisher`
6
+ # (gpt-5.4-2026-03-05 at low reasoning effort, through the same endpoint) or bridge/<harness/model>, a substituted judge on
7
+ # its own client at AGENT_BENCH_JUDGE_URL. The result JSON lands in <result folder>.
8
+ set -eu
9
+ out=$1 base=$2 model=$3 keyvar=$4 tasks=$5 ids=$6 judge=$7
10
+ shift 7
11
+ if [ $# -gt 0 ]; then echo "healthbench-professional-run: unknown option $1" >&2; exit 2; fi
12
+ here=$(cd "$(dirname "$0")" && pwd)
13
+ checkout=$PWD
14
+ revision=349962fd46dd02343a0d8a606491baf59154ea1a
15
+ sha=d44b08e6e952e04c945e2c406f02533d9e7a989a84e35820ee7efdff20c9e4e2
16
+ data=$checkout/.agent-bench-data/healthbench_professional_eval.jsonl
17
+ if [ ! -f "$data" ]; then
18
+ mkdir -p "$(dirname "$data")"
19
+ url=https://huggingface.co/datasets/openai/healthbench-professional/resolve/$revision/healthbench_professional_eval.jsonl
20
+ curl -fsSL -o "$data.part" "$url" || { echo "healthbench-professional: could not fetch $url" >&2; exit 1; }
21
+ mv "$data.part" "$data"
22
+ fi
23
+ got=$(sha256sum "$data" | cut -d' ' -f1)
24
+ if [ "$got" != "$sha" ]; then
25
+ echo "healthbench-professional: $data has sha256 $got, expected $sha (openai/healthbench-professional@$revision); remove it to fetch again" >&2
26
+ exit 1
27
+ fi
28
+ if [ "$judge" = publisher ]; then judge_model=gpt-5.4-2026-03-05 judge_url=-; else judge_model=${judge#bridge/} judge_url=$AGENT_BENCH_JUDGE_URL; fi
29
+ mkdir -p "$out"
30
+ "$checkout/.venv/bin/python" "$here/healthbench_professional_run.py" "$checkout" "$data" "$base" "$model" "$keyvar" "$tasks" "$ids" "$judge_model" "$judge_url" "$out/result.json"
@@ -0,0 +1,112 @@
1
+ """HealthBench Professional through openai/simple-evals' own HealthBenchEval, with the settings its
2
+ --healthbench-professional-mode requires: the Professional data, GPT-5.4 at low reasoning effort as the rubric grader,
3
+ and length adjustment (center 2000 characters, 1.47 points per 500 on the 0-100 scale, the paper's values).
4
+
5
+ The Professional release ships conversations and rubric items in its own fields; HealthBenchEval reads HealthBench rows.
6
+ Each row is mapped field for field (messages -> prompt, criterion_text -> criterion, id -> prompt_id; use_case, type and
7
+ difficulty become example tags) into a temporary file that is never kept. Sampling (the publisher's seeded sample for a
8
+ task count), the grader prompt, rubric scoring, length adjustment and aggregation are the publisher's code.
9
+
10
+ The target answers through the publisher's ChatCompletionSampler on the target endpoint. The publisher's grader runs on the
11
+ same endpoint; a substituted judge runs as a ChatCompletionSampler on its own endpoint. Only ids, scores and counts are
12
+ written: the authors ask that examples not be revealed.
13
+
14
+ Usage: python healthbench_professional_run.py <checkout> <data.jsonl> <base url> <model> <key env var> <task count|all>
15
+ <task ids,> <judge model> <judge url|-> <out.json>
16
+ """
17
+ import json
18
+ import os
19
+ import sys
20
+ import tempfile
21
+
22
+ checkout, data, base, model, keyvar, limit, ids, judge_model, judge_url, out = sys.argv[1:11]
23
+
24
+ # simple-evals is a package of relative imports named for its directory: expose the checkout as `simple_evals`.
25
+ package_root = tempfile.mkdtemp()
26
+ os.symlink(checkout, os.path.join(package_root, 'simple_evals'))
27
+ sys.path.insert(0, package_root)
28
+
29
+ from openai import OpenAI # noqa: E402
30
+ from openai.types.completion_usage import CompletionTokensDetails, PromptTokensDetails # noqa: E402
31
+ from simple_evals.healthbench_eval import HealthBenchEval, calculate_length_adjusted_score # noqa: E402
32
+ from simple_evals.sampler.chat_completion_sampler import OPENAI_SYSTEM_MESSAGE_API, ChatCompletionSampler # noqa: E402
33
+ from simple_evals.sampler.responses_sampler import ResponsesSampler # noqa: E402
34
+
35
+ CENTER, PENALTY_PER_500 = 2000.0, 0.0147
36
+
37
+
38
+ class EndpointSampler(ChatCompletionSampler):
39
+ """The publisher's sampler. HealthBench's usage reader requires the cached and reasoning token details OpenAI returns;
40
+ an endpoint that omits them (a CLI Bridge does) gets them as unknown, never as zero."""
41
+
42
+ def __call__(self, message_list):
43
+ response = super().__call__(message_list)
44
+ usage = response.response_metadata.get('usage')
45
+ if usage is not None:
46
+ if getattr(usage, 'prompt_tokens_details', None) is None:
47
+ usage.prompt_tokens_details = PromptTokensDetails(cached_tokens=None)
48
+ if getattr(usage, 'completion_tokens_details', None) is None:
49
+ usage.completion_tokens_details = CompletionTokensDetails(reasoning_tokens=None)
50
+ return response
51
+
52
+ rows = [json.loads(line) for line in open(data, encoding='utf-8') if line.strip()]
53
+ wanted = [task for task in ids.split(',') if task]
54
+ if wanted:
55
+ by_id = {row['id']: row for row in rows}
56
+ missing = [task for task in wanted if task not in by_id]
57
+ if missing:
58
+ sys.exit(f'{len(missing)} of {len(wanted)} task ids are not in HealthBench Professional')
59
+ rows = [by_id[task] for task in wanted]
60
+
61
+
62
+ def healthbench_row(row):
63
+ return {
64
+ 'prompt': row['conversation']['messages'],
65
+ 'rubrics': [{'criterion': item['criterion_text'], 'points': item['points'], 'tags': []} for item in row['rubric_items']],
66
+ 'example_tags': [f"use_case:{row['use_case']}", f"type:{row['type']}", f"difficulty:{row['difficulty']}"],
67
+ 'prompt_id': row['id'],
68
+ }
69
+
70
+
71
+ converted = os.path.join(package_root, 'healthbench_professional.jsonl')
72
+ with open(converted, 'w', encoding='utf-8') as handle:
73
+ for row in rows:
74
+ handle.write(json.dumps(healthbench_row(row)) + '\n')
75
+
76
+ # The publisher's samplers build a default OpenAI client on construction; each is replaced with its endpoint's client below.
77
+ os.environ.setdefault('OPENAI_API_KEY', 'replaced-per-sampler')
78
+ target = EndpointSampler(model=model, system_message=OPENAI_SYSTEM_MESSAGE_API, max_tokens=2048)
79
+ target.client = OpenAI(base_url=base, api_key=os.environ[keyvar])
80
+ if judge_url == '-':
81
+ grader = ResponsesSampler(model=judge_model, reasoning_model=True, reasoning_effort='low')
82
+ grader.client = OpenAI(base_url=base, api_key=os.environ[keyvar])
83
+ else:
84
+ grader = ChatCompletionSampler(model=judge_model, max_tokens=2048)
85
+ grader.client = OpenAI(base_url=judge_url, api_key=os.environ.get('AGENT_BENCH_JUDGE_KEY') or 'loopback')
86
+
87
+ threads = max(1, int(os.environ.get('AGENT_BENCH_MAX_CONCURRENCY') or 2))
88
+ evaluation = HealthBenchEval(
89
+ grader_model=grader,
90
+ num_examples=None if wanted or limit == 'all' else int(limit),
91
+ n_threads=threads,
92
+ input_path=converted,
93
+ length_adjustment_center=CENTER,
94
+ length_adjustment_penalty_per_500_chars=PENALTY_PER_500,
95
+ )
96
+ result = evaluation(target)
97
+
98
+ examples = []
99
+ for example in result.metadata['example_level_metadata']:
100
+ response = example['completion'][0]['content']
101
+ items = example['rubric_items']
102
+ examples.append({
103
+ 'prompt_id': example['prompt_id'],
104
+ 'overall_score': example['score'],
105
+ 'length_adjusted': calculate_length_adjusted_score(example['score'], response, center=CENTER, penalty_per_500_chars=PENALTY_PER_500),
106
+ 'response_chars': len(response),
107
+ 'positive_met': sum(1 for item in items if item['points'] > 0 and item['criteria_met']),
108
+ 'positive_total': sum(1 for item in items if item['points'] > 0),
109
+ 'negative_met': sum(1 for item in items if item['points'] < 0 and item['criteria_met']),
110
+ })
111
+ with open(out, 'w', encoding='utf-8') as handle:
112
+ json.dump({'score': result.score, 'metrics': result.metrics, 'examples': examples}, handle, indent=2)
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ # MLCR v1.1 through its publisher's own runner and scorer (mlcr_run.py), from the publisher checkout:
3
+ # mlcr-run.sh <result folder> <base url> <model> <key env var> <task count|all> <task ids,> <judge>
4
+ # <task count> keeps the runner's first N rows of the publisher's smoke experiment (--limit); task ids are not supported.
5
+ # <judge> is `publisher` (the three-model jury on the publisher's own providers and their credentials) or bridge/<harness/model>,
6
+ # a substituted judge on its own client at AGENT_BENCH_JUDGE_URL. The data is fetched into the checkout's git-ignored cases/ and
7
+ # filler_files/ on first use and never committed (no license). The result JSON lands in <result folder>.
8
+ set -eu
9
+ out=$1 base=$2 model=$3 keyvar=$4 tasks=$5 ids=$6 judge=$7
10
+ shift 7
11
+ if [ $# -gt 0 ]; then echo "mlcr-run: unknown option $1" >&2; exit 2; fi
12
+ if [ -n "$ids" ]; then echo "mlcr-run: task ids are not supported; use --tasks N, the runner's first N matrix rows" >&2; exit 2; fi
13
+ here=$(cd "$(dirname "$0")" && pwd)
14
+ checkout=$PWD
15
+ if [ "$judge" = publisher ]; then judge_model=publisher judge_url=-; else judge_model=${judge#bridge/} judge_url=$AGENT_BENCH_JUDGE_URL; fi
16
+ mkdir -p "$out"
17
+ "$checkout/.venv/bin/python" "$here/mlcr_run.py" "$checkout" "$base" "$model" "$keyvar" "$tasks" "$judge_model" "$judge_url" "$out/result.json"
@@ -0,0 +1,133 @@
1
+ """MLCR v1.1 through its publisher's own runner and scorer (Wisedocs-AI/medical-long-context-reasoning `mlcr`).
2
+
3
+ The runner reaches models through providers registered by name (Vertex, Anthropic on GCP, Azure OpenAI). As its README's
4
+ "Adding a new provider" describes, this registers one more for an OpenAI-compatible endpoint: `agent_bench_endpoint` for the
5
+ target and `agent_bench_judge` for a substituted judge, each referenced from model configs written beside the publisher's in
6
+ configs/models (agent-bench-*.yaml, rewritten every run). No publisher file changes.
7
+
8
+ The experiment is the publisher's configs/experiments/smoke.yaml, its committed experiment, with `models` set to the target and
9
+ the worker count set for the endpoint; `--limit N` keeps the first N matrix rows, the runner's own sample. The data is the
10
+ Wisedocs/mlcr-dataset release at a pinned revision, written into the git-ignored cases/ and filler_files/ trees by the
11
+ publisher's own download code, in this checkout only: it carries no license, so it is never committed or redistributed.
12
+
13
+ Scoring is the publisher's score_run: the conciseness gate, then the jury, which needs two of at least two valid votes. The
14
+ publisher's jury is its three judges on their own providers and credentials. A substituted jury is three members on the
15
+ substituted judge's endpoint, each its own model config (the jury keys votes by config id) and sampling independently at the
16
+ publisher's judge temperature, 1.0, so the publisher's majority rule applies unchanged. Thinking levels are not sent to an
17
+ OpenAI-compatible endpoint. Only ids, verdicts and counts are written.
18
+
19
+ Usage: python mlcr_run.py <checkout> <base url> <model> <key env var> <task count|all> <judge model|publisher> <judge url|-> <out.json>
20
+ """
21
+ import csv
22
+ import io
23
+ import json
24
+ import os
25
+ import sys
26
+ import time
27
+ from pathlib import Path
28
+
29
+ import yaml
30
+
31
+ checkout, base, model, keyvar, limit, judge_model, judge_url, out = sys.argv[1:9]
32
+ checkout = Path(checkout)
33
+ sys.path.insert(0, str(checkout / 'src'))
34
+
35
+ from openai import OpenAI # noqa: E402
36
+ from mlcr import download # noqa: E402
37
+ from mlcr.cli import main as mlcr # noqa: E402
38
+ from mlcr.providers.base import ChatResponse, PermanentProviderError, Provider, map_provider_error # noqa: E402
39
+ from mlcr.providers.registry import register # noqa: E402
40
+ from mlcr.scoring import _DEFAULT_JUDGE_MODELS, score_run # noqa: E402
41
+
42
+ DATA_REVISION = '1198206e2df96febf9fd13c110981e5b40515285'
43
+
44
+
45
+ class EndpointProvider(Provider):
46
+ """Chat Completions against an OpenAI-compatible endpoint, with the message layout of the publisher's Azure provider."""
47
+
48
+ def __init__(self, name, url, key):
49
+ self.name = name
50
+ self.client = OpenAI(base_url=url, api_key=key)
51
+
52
+ def call(self, req):
53
+ if req.images:
54
+ raise PermanentProviderError('the agent-bench endpoint provider runs the text modality only')
55
+ content = [{'type': 'text', 'text': text} for text in (req.prefix_text, req.user_text) if text]
56
+ messages = ([{'role': 'system', 'content': req.system}] if req.system else []) + [{'role': 'user', 'content': content}]
57
+ started = time.monotonic()
58
+ try:
59
+ response = self.client.chat.completions.create(
60
+ model=req.model_cfg.model, messages=messages,
61
+ max_tokens=req.model_cfg.max_output_tokens, temperature=req.model_cfg.temperature,
62
+ )
63
+ except Exception as error:
64
+ raise map_provider_error(error) from error
65
+ usage = response.usage
66
+ return ChatResponse(
67
+ text=response.choices[0].message.content or '',
68
+ usage={'prompt_tokens': usage.prompt_tokens, 'completion_tokens': usage.completion_tokens} if usage else {},
69
+ latency_ms=int((time.monotonic() - started) * 1000),
70
+ )
71
+
72
+
73
+ register('agent_bench_endpoint', lambda: EndpointProvider('agent_bench_endpoint', base, os.environ[keyvar]))
74
+ if judge_url != '-':
75
+ register('agent_bench_judge', lambda: EndpointProvider('agent_bench_judge', judge_url, os.environ.get('AGENT_BENCH_JUDGE_KEY') or 'loopback'))
76
+
77
+ # The release at the pinned revision, through the publisher's own writers for the harness tree.
78
+ marker = checkout / 'cases' / f'.agent-bench-{DATA_REVISION}'
79
+ if not marker.exists():
80
+ from datasets import load_dataset
81
+ rows = {name: load_dataset(download.REPO_ID, name, split='train', revision=DATA_REVISION) for name in ('questions', 'cases_summaries', 'filler_files')}
82
+ download._write_cases(checkout, rows['questions'], rows['cases_summaries'])
83
+ download._write_fillers(checkout, rows['filler_files'])
84
+ marker.write_text(DATA_REVISION + '\n')
85
+
86
+ models = checkout / 'configs' / 'models'
87
+ # The publisher's GPT configs: 16384 output tokens at temperature 1.0.
88
+ (models / 'agent-bench-target.yaml').write_text(yaml.safe_dump({'id': 'agent-bench-target', 'provider': 'agent_bench_endpoint', 'model': model, 'max_output_tokens': 16384, 'temperature': 1.0}))
89
+ JURY = [f'agent-bench-judge-{seat}' for seat in (1, 2, 3)]
90
+ if judge_url != '-':
91
+ for seat in JURY:
92
+ (models / f'{seat}.yaml').write_text(yaml.safe_dump({'id': seat, 'provider': 'agent_bench_judge', 'model': judge_model, 'max_output_tokens': 16384, 'temperature': 1.0}))
93
+
94
+ experiment = yaml.safe_load((checkout / 'configs' / 'experiments' / 'smoke.yaml').read_text())
95
+ workers = max(1, int(os.environ.get('AGENT_BENCH_MAX_CONCURRENCY') or 2))
96
+ experiment.update(name='agent-bench', models=['agent-bench-target'], output_dir='agent-bench-runs', concurrency={'max_workers': workers})
97
+ config = checkout / 'configs' / 'experiments' / 'agent-bench.yaml'
98
+ config.write_text(yaml.safe_dump(experiment, sort_keys=False))
99
+
100
+ runs = checkout / 'agent-bench-runs'
101
+ before = set(runs.iterdir()) if runs.is_dir() else set()
102
+ # The runner asks for confirmation on stdin before it calls a model; this run is unattended, so it confirms.
103
+ sys.stdin = io.StringIO('y\n')
104
+ code = mlcr(['run', str(config), '--repo-root', str(checkout), '--no-previous-runs', *([] if limit == 'all' else ['--limit', limit])])
105
+ if code:
106
+ sys.exit(f'mlcr run exited {code}')
107
+ [run_dir] = [path for path in runs.iterdir() if path not in before]
108
+
109
+ judges = [models / f'{name}.yaml' for name in (_DEFAULT_JUDGE_MODELS if judge_url == '-' else JURY)]
110
+ score_run(run_dir, judge_model_configs=judges, max_workers=workers)
111
+
112
+ # results_scoring.csv follows responses.csv, one row per results/<row_id>/result.json in sorted order.
113
+ with (run_dir / 'results_scoring.csv').open(newline='') as handle:
114
+ scored = list(csv.DictReader(handle))
115
+ metas = [json.loads(path.read_text()).get('metadata', {}) for path in sorted((run_dir / 'results').glob('*/result.json'))]
116
+ if len(metas) != len(scored):
117
+ sys.exit(f'{len(scored)} scored rows for {len(metas)} results')
118
+ examples = []
119
+ for meta, row in zip(metas, scored):
120
+ if meta.get('case_uuid') != row.get('case_uuid'):
121
+ sys.exit('scored rows and results are not in the same order')
122
+ examples.append({
123
+ 'id': f"{meta['case_uuid']}/{Path(meta['prompt_path']).stem}",
124
+ 'difficulty': row.get('difficulty', ''),
125
+ 'concise': row.get('judge_concise', ''),
126
+ 'complete': row.get('judge_complete', ''),
127
+ 'accurate': row.get('judge_accurate', ''),
128
+ 'correct': row.get('judge_correct', ''),
129
+ 'judge_error': bool(row.get('judge_error')),
130
+ 'response_chars': len(row.get('response', '')),
131
+ })
132
+ with open(out, 'w', encoding='utf-8') as handle:
133
+ json.dump({'judges': [path.stem for path in judges], 'examples': examples}, handle, indent=2)
@@ -0,0 +1,39 @@
1
+ #!/bin/sh
2
+ # PRBench through its publisher's own runner and rubric grader (scaleapi/PRBench evals.py), from the publisher checkout:
3
+ # prbench-run.sh <result folder> <base url> <model> <key env var> <task count|all> <task ids,> <judge> [--split legal|finance|legal_hard|finance_hard] [--concurrency n]
4
+ # Writes the publisher's config (target <model> at <base url>, the Responses API in the foreground, no cache, no web search)
5
+ # with its key file from <key env var> (mode 600, removed after), and runs evals.run_evals_off_platform through prbench_run.py.
6
+ # <judge> is `publisher` (openai/o4-mini through the same endpoint, as the publisher configures it) or bridge/<harness/model>,
7
+ # a substituted judge on its own client at AGENT_BENCH_JUDGE_URL. The result JSON and caches land in <result folder>.
8
+ set -eu
9
+ out=$1 base=$2 model=$3 keyvar=$4 tasks=$5 ids=$6 judge=$7
10
+ shift 7
11
+ split=legal
12
+ while [ $# -gt 0 ]; do
13
+ case $1 in
14
+ --split) split=$2; shift 2 ;;
15
+ --concurrency) AGENT_BENCH_MAX_CONCURRENCY=$2; export AGENT_BENCH_MAX_CONCURRENCY; shift 2 ;;
16
+ *) echo "prbench-run: unknown option $1" >&2; exit 2 ;;
17
+ esac
18
+ done
19
+ here=$(cd "$(dirname "$0")" && pwd)
20
+ checkout=$PWD
21
+ mkdir -p "$out"
22
+ work=$(mktemp -d)
23
+ trap 'rm -rf "$work"' EXIT INT TERM
24
+ umask 077
25
+ printenv "$keyvar" > "$work/key"
26
+ if [ "$judge" = publisher ]; then judge_model=openai/o4-mini judge_url=-; else judge_model=${judge#bridge/} judge_url=$AGENT_BENCH_JUDGE_URL; fi
27
+ python3 - "$work/config.yaml" "$base" "$model" "$work/key" "$split" "$judge_model" <<'PY'
28
+ import json, sys
29
+ path, base, model, key, split, judge = sys.argv[1:7]
30
+ config = {'judge_model_name': judge, 'base_url': base, 'litellm_key_path': key, 'filename': 'result', 'split_name': split,
31
+ 'debug': False, 'trial_number': 0, 'web_search': False, 'background': False, 'final_response_source': 'sampled',
32
+ 'timeout_seconds': 3600, 'cache': False, 'response_api': 'responses', 'response_model_names': [model],
33
+ # The publisher's reasoning effort for its own judge; a substituted judge runs at its harness default.
34
+ 'reasoning_effort_by_model': {'openai/o4-mini': 'high'}}
35
+ with open(path, 'w') as handle:
36
+ json.dump(config, handle) # JSON is YAML
37
+ PY
38
+ cd "$out"
39
+ PYTHONPATH=$checkout "$checkout/.venv/bin/python" "$here/prbench_run.py" "$work/config.yaml" "$tasks" "$ids" "$judge_url"
@@ -0,0 +1,53 @@
1
+ """PRBench's own runner (evals.run_evals_off_platform), with a task sample and, when substituted, a judge on its own endpoint.
2
+
3
+ The publisher's runner grades every row of a split (its only limit, `debug`, keeps rows 10:12) and sends the target and the
4
+ judge through one client. Here a sample keeps the first N rows, or the given task ids, of the publisher's own dataset; and a
5
+ substituted judge gets its own client at <judge url>, so the target endpoint never answers as the judge. With
6
+ AGENT_BENCH_MAX_CONCURRENCY the publisher's 64 concurrent requests are capped: its client retries a refused request five
7
+ times within about 20 s and then grades the answer as "N/A", criterion not met, so an endpoint with fewer slots would
8
+ lower the score silently. Loading, prompts, rubric grading and scoring are the publisher's code. Results and caches land in
9
+ the working directory.
10
+
11
+ Usage, with the PRBench checkout on PYTHONPATH: python prbench_run.py <config.yaml> <task count|all> <task ids,> <judge url|->
12
+ """
13
+ import asyncio
14
+ import os
15
+ import sys
16
+
17
+ import evals
18
+ from config import Config
19
+ from openai import AsyncOpenAI
20
+
21
+ config_path, limit, ids, judge_url = sys.argv[1:5]
22
+ cap = int(os.environ.get('AGENT_BENCH_MAX_CONCURRENCY') or 0)
23
+ if cap > 0:
24
+ publisher_semaphore = asyncio.Semaphore
25
+
26
+ class CappedSemaphore(publisher_semaphore):
27
+ def __init__(self, value=1):
28
+ super().__init__(min(value, cap))
29
+
30
+ asyncio.Semaphore = CappedSemaphore
31
+ wanted = {task for task in ids.split(',') if task}
32
+ publisher_load, publisher_points = evals.load_dataset, evals.get_total_points
33
+
34
+
35
+ def load_dataset(*args, **kwargs):
36
+ rows = publisher_load(*args, **kwargs)
37
+ if wanted:
38
+ rows = rows.filter(lambda row: row['task'] in wanted)
39
+ if len(rows) != len(wanted):
40
+ sys.exit(f'only {len(rows)} of {len(wanted)} task ids exist in this split')
41
+ return rows
42
+ return rows if limit == 'all' else rows.select(range(min(int(limit), len(rows))))
43
+
44
+
45
+ judge_client = None if judge_url == '-' else AsyncOpenAI(base_url=judge_url, api_key=os.environ.get('AGENT_BENCH_JUDGE_KEY') or 'loopback')
46
+
47
+
48
+ async def get_total_points(client, *args, **kwargs):
49
+ return await publisher_points(judge_client or client, *args, **kwargs)
50
+
51
+
52
+ evals.load_dataset, evals.get_total_points = load_dataset, get_total_points
53
+ asyncio.run(evals.run_evals_off_platform(Config.from_yaml(config_path)))