@tangle-network/agent-bench 0.1.0 → 0.3.5
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 +17 -0
- package/HARNESS.md +302 -0
- package/README.md +26 -1
- package/fixtures/aec-bench.json +18 -0
- package/fixtures/agentbench-dbbench.json +22 -0
- package/fixtures/bfcl.json +45 -0
- package/fixtures/commit0.json +72 -0
- package/fixtures/crag.json +10 -0
- package/fixtures/dabstep.json +22 -0
- package/fixtures/enterpriseops-gym.json +103 -0
- package/fixtures/finresearchbench.json +21 -0
- package/fixtures/finsearchcomp.json +66 -0
- package/fixtures/frames.json +26 -0
- package/fixtures/hotpotqa.json +182 -0
- package/fixtures/nomiracl.json +26 -0
- package/fixtures/open-rag-bench.json +16 -0
- package/fixtures/pier-agent/no-model-task/environment/Dockerfile +16 -0
- package/fixtures/pier-agent/no-model-task/environment/seed/src/status.txt +1 -0
- package/fixtures/pier-agent/no-model-task/instruction.md +6 -0
- package/fixtures/pier-agent/no-model-task/pre_artifacts.sh +6 -0
- package/fixtures/pier-agent/no-model-task/task.toml +35 -0
- package/fixtures/pier-agent/no-model-task/tests/Dockerfile +17 -0
- package/fixtures/pier-agent/no-model-task/tests/seed/src/status.txt +1 -0
- package/fixtures/pier-agent/no-model-task/tests/test.sh +19 -0
- package/fixtures/programbench.json +17 -0
- package/fixtures/ragbench.json +21 -0
- package/fixtures/simpleqa.json +121 -0
- package/fixtures/t2-ragbench.json +13 -0
- package/fixtures/tau2-bench.json +16 -0
- package/fixtures/tau3-banking.json +16 -0
- package/fixtures/toollm.json +28 -0
- package/fixtures/webarena-verified.json +20 -0
- package/package.json +39 -15
- package/pier_agents/__init__.py +18 -0
- package/pier_agents/candidate_contract.py +755 -0
- package/pier_agents/process_boundary.py +321 -0
- package/pier_agents/tangle_candidate.py +907 -0
- package/pier_agents/workspace_boundary.py +368 -0
- package/scripts/appworld_driver.py +359 -0
- package/scripts/cadbench_prepare.py +22 -0
- package/scripts/cadgenbench_hard_parts.py +48 -0
- package/scripts/clbench_codebase_judge.py +73 -0
- package/scripts/commit0_judge.py +170 -0
- package/scripts/dabstep_judge.py +42 -0
- package/scripts/enterpriseops_gym_judge.py +281 -0
- package/scripts/programbench_judge.py +120 -0
- package/scripts/render-gate-chart.mjs +176 -0
- package/scripts/run-package-tests.mjs +56 -0
- package/scripts/terminate-pier-trial.mts +66 -0
- package/scripts/trata-hedge/README.md +56 -0
- package/scripts/trata-hedge/run.sh +60 -0
- package/scripts/trata-hedge/solve.py +83 -0
- package/scripts/verify-packed-consumer.mjs +224 -0
- package/scripts/verify-pier-agent.mts +715 -0
- package/scripts/verify-pier-pair.mts +74 -0
- package/scripts/verify-pier-recovery.mts +139 -0
- package/src/adapters.ts +26 -0
- package/src/benchmarks/_harness.test.mts +178 -0
- package/src/benchmarks/_harness.ts +239 -16
- package/src/benchmarks/agentbench.ts +163 -0
- package/src/benchmarks/appworld.test.mts +15 -9
- package/src/benchmarks/bfcl.ts +346 -0
- package/src/benchmarks/crag.ts +137 -0
- package/src/benchmarks/dabstep.test.mts +70 -0
- package/src/benchmarks/dabstep.ts +212 -0
- package/src/benchmarks/external-adapters.test.mts +150 -0
- package/src/benchmarks/finresearchbench.ts +269 -0
- package/src/benchmarks/humaneval.ts +20 -8
- package/src/benchmarks/nomiracl.ts +180 -0
- package/src/benchmarks/open-rag-bench.ts +153 -0
- package/src/benchmarks/rag-benchmarks.test.mts +138 -0
- package/src/benchmarks/rag-shared.ts +327 -0
- package/src/benchmarks/ragbench.ts +171 -0
- package/src/benchmarks/swe-bench.test.mts +61 -0
- package/src/benchmarks/swe-bench.ts +201 -19
- package/src/benchmarks/t2-ragbench.ts +166 -0
- package/src/benchmarks/tau-bench-shared.ts +214 -0
- package/src/benchmarks/tau2-bench.ts +30 -0
- package/src/benchmarks/tau3-banking.ts +29 -0
- package/src/benchmarks/terminal-bench.test.mts +33 -0
- package/src/benchmarks/terminal-bench.ts +23 -8
- package/src/benchmarks/toollm.ts +254 -0
- package/src/benchmarks/types.ts +42 -0
- package/src/benchmarks/webarena-verified.ts +200 -0
- package/src/commit0-prereqs.sh +0 -0
- package/src/coordination-mcp-container-reach.mts +181 -0
- package/src/decoder-live.mts +1 -1
- package/src/examples/README.md +103 -39
- package/src/examples/benchmark-matrix.mts +101 -0
- package/src/examples/lean-proof-gate.README.md +77 -0
- package/src/examples/lean-proof-gate.mts +162 -0
- package/src/examples/lean-verify.ts +95 -0
- package/src/examples/lean.Dockerfile +12 -0
- package/src/examples/math-demo.mts +9 -7
- package/src/examples/strategy-demo.mts +10 -12
- package/src/gate.ts +3 -2
- package/src/hev-eval.mts +69 -0
- package/src/hev-improve.mts +169 -0
- package/src/hev-structural.mts +688 -0
- package/src/index.ts +73 -0
- package/src/mbpp-structural.mts +662 -0
- package/src/pier-agent.test-fixtures.mts +19 -0
- package/src/pier-agent.test.mts +363 -0
- package/src/pier-agent.ts +657 -0
- package/src/pier-result-grader.mjs +30 -0
- package/src/pier-result-grader.test.mts +62 -0
- package/src/pier-result-grader.ts +108 -0
- package/src/pier-task-outcome.test.mts +117 -0
- package/src/pier-task-outcome.ts +240 -0
- package/src/pier-trial-controller.test.mts +412 -0
- package/src/pier-trial-controller.ts +858 -0
- package/src/pier-trial-supervisor.mjs +352 -0
- package/src/resolve-client.ts +25 -2
- package/src/run-benchmarks-cli.mts +72 -0
- package/src/run-benchmarks-report.ts +66 -0
- package/src/run-benchmarks.test.mts +231 -0
- package/src/run-benchmarks.ts +589 -0
- package/src/smoke-structural-rollout.mts +393 -0
- package/src/swe-bench-env.test.ts +207 -0
- package/src/swe-bench-env.ts +554 -0
- package/src/swe-jail.ts +293 -0
- package/src/swe-self-improve.mts +84 -0
- package/src/swe-structural-judge-policy.test.ts +117 -0
- package/src/swe-structural-judge-policy.ts +133 -0
- package/src/swe-structural-policy.test.ts +124 -0
- package/src/swe-structural-policy.ts +132 -0
- package/src/swe-structural-provenance.test.ts +93 -0
- package/src/swe-structural-provenance.ts +138 -0
- package/src/swe-structural.mts +1260 -0
- package/src/swe-temp.ts +14 -0
- package/src/tb-container-executor.mts +234 -0
- package/src/tb-container-executor.test.mts +99 -0
- package/src/tb-supervisor-sidecar.mts +222 -0
- package/src/trata-gepa.mts +1 -1
- package/steerers/eops-itsm-population.json +1 -0
- package/tb_agents/opencode_refine_agent.py +117 -0
- package/tb_agents/opencode_router_agent.py +406 -0
- package/tb_agents/opencode_supervisor_agent.py +239 -0
- package/tb_agents/script_agent.py +66 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.5
|
|
4
|
+
|
|
5
|
+
- Build the workspace runtime before source type checks so the published-package verification command works from a clean checkout; the packed consumer still installs `@tangle-network/agent-runtime@0.97.0` from npm.
|
|
6
|
+
|
|
7
|
+
## 0.3.4
|
|
8
|
+
|
|
9
|
+
- Publish the current benchmark suite against `@tangle-network/agent-runtime@0.97.0` and align its evaluation dependency with runtime and knowledge at `@tangle-network/agent-eval@0.122.8`.
|
|
10
|
+
|
|
11
|
+
## 0.3.3
|
|
12
|
+
|
|
13
|
+
- Consume `@tangle-network/agent-runtime@0.94.9` so large candidate task-outcome and isolated-memory archives are validated before persistence, then recorded as artifact references instead of oversized embedded payloads.
|
|
14
|
+
|
|
15
|
+
## 0.3.2
|
|
16
|
+
|
|
17
|
+
- Run large Pier workspace identity checks from a hash-verified evaluator file, avoiding Linux command-size limits while preserving exact path, type, mode, length, hardlink, and content checks.
|
package/HARNESS.md
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# bench harness — START HERE (the map, so you don't re-read 15 files)
|
|
2
|
+
|
|
3
|
+
If you're an agent picking this up: read this page, then run `pnpm help` + `pnpm gate` —
|
|
4
|
+
do NOT re-derive the harness from source. This map is SHORT on purpose; if it disagrees
|
|
5
|
+
with the code, the code wins — fix this page in the same turn (the anti-rediscovery law).
|
|
6
|
+
Verified against source 2026-07-18 · agent-eval pinned `0.122.8`. The CANONICAL surface is now
|
|
7
|
+
the published optimization suite (`@tangle-network/agent-runtime/loops`): `Environment` +
|
|
8
|
+
`Strategy`/`defineStrategy` + `runBenchmark` — see the section below FIRST. The recursive
|
|
9
|
+
diverse-vs-blind gate runs through the keystone (`gate-cli.mts` → `runGate`);
|
|
10
|
+
the offline selector replay (`corpus-replay.mts` / `corpus-report.mts`) gates the legacy corpora.
|
|
11
|
+
|
|
12
|
+
## What this harness answers
|
|
13
|
+
**The success criterion is Gate B** (docs/learning-flywheel.md, docs/architecture.md §2): across
|
|
14
|
+
repeated runs on a persistent, checkable task family, the deployed policy's verifier-graded
|
|
15
|
+
**multi-objective** score (correct · fast · secure · cheap, each its own deployable checker)
|
|
16
|
+
improves **run-over-run** at matched per-run compute, surviving a frozen-policy control, significant
|
|
17
|
+
at adequate n. That across-run slope is RSI. **The harness has NOT yet run Gate B** — see the durable
|
|
18
|
+
gap below.
|
|
19
|
+
|
|
20
|
+
What the harness measures **today is Gate A** (docs/roadmap-rsi.md — the inner GO/NO-GO for the
|
|
21
|
+
within-run adaptive-driver layer): **does any non-blind topology beat blind compute at EQUAL COMPUTE
|
|
22
|
+
(Σ rollouts × turns — `k` counts rollouts, each may be multi-turn/stateful), under a DEPLOYABLE
|
|
23
|
+
(non-oracle) selector, at significant n?** Gate A is a **narrow diagnostic** — the cost-justification
|
|
24
|
+
for parallel/adaptive topology, **NOT** the product verdict. A failed Gate A deletes within-run
|
|
25
|
+
steering only; it never touches the corpus+policy product (Gate B). The invariant is equal-COMPUTE,
|
|
26
|
+
not equal-k-on-stateless-samples.
|
|
27
|
+
|
|
28
|
+
**Terminology (one word, used consistently).** A **rollout** (≡ a "shot") is ONE agent running an
|
|
29
|
+
`AgentProfile` to completion — a full, possibly **multi-turn / stateful** trajectory. `k` counts
|
|
30
|
+
*rollouts*; **turns live *inside* a rollout**, never as separate shots. A single **stateless
|
|
31
|
+
completion** (`maxTurns=0`, `harness: null`, one model call, no persistent workspace) is the
|
|
32
|
+
*degenerate* rollout — fine as a selector **lower bound**, never the canonical unit. The HumanEval
|
|
33
|
+
probe (`bench/src/humaneval-gate.mts`) uses exactly that degenerate shape — it calls the router
|
|
34
|
+
directly and does **not** route through `AgentProfile` / the sandbox / the keystone — so its numbers
|
|
35
|
+
are the **no-self-correction lower bound** on the selector, distinct from the rollout-based keystone
|
|
36
|
+
gate above. Bridge it to the product by running the same arms with real rollouts (an `AgentProfile`
|
|
37
|
+
through `runLoop`), dialing `maxTurns`.
|
|
38
|
+
|
|
39
|
+
Two things to keep straight: today's judges grade a single
|
|
40
|
+
*correctness* scalar (the multi-objective vector is the open contract, architecture.md §6), and every
|
|
41
|
+
number below is single-objective + within-run — read them as Gate-A diagnostics, not Gate-B results.
|
|
42
|
+
- Within-run STEER (verify-and-revise family) **LOSES** (rung-0, n=40: blind 37.5% →
|
|
43
|
+
random@3 60.0% → refineGepa@3 45.0%; the earlier +20pp was confounded compute).
|
|
44
|
+
- On the COMMITTED finsearch corpus, the self-consistency selector also **loses**:
|
|
45
|
+
selector@k − random@k = **−8.2pp** (n=51). So "pick the consensus among k identical-ish
|
|
46
|
+
attempts" does not beat a random draw here.
|
|
47
|
+
- **VERIFIER-GROUNDED selection is the one selector that wins** — but ONLY where a domain has
|
|
48
|
+
WITHIN-TASK graded variance. Proven POSITIVE on HumanEval (deployable-checker, binary, n=50:
|
|
49
|
+
verifier−sc = +12.0pp CI[+4,+22]). The continuous-reward generalization (`selector.ts`
|
|
50
|
+
`summarizeVerifierSelector`, `corpus-replay --selector=verifier`) ranks k attempts by their
|
|
51
|
+
stored deployable-checker `score` and reports selector(=best-of-k) vs random(=mean-of-k) with a
|
|
52
|
+
paired bootstrap CI. **aec-bench is structurally DEAD for it** (n=12 gpt-4.1, **0/12 random +
|
|
53
|
+
1/12 diverse tasks have any within-task score spread**): closed-form engineering calcs score
|
|
54
|
+
deterministically w.r.t. sampling — across-task difficulty (33% resolve) but ~0 within-task
|
|
55
|
+
selection headroom. The gpt-5 null (oracle 2.5%) was a worker artifact (no JSON emission);
|
|
56
|
+
gpt-4.1 fixes the band (mean 36.1%) but the selector gate stays flat. **commit0 is the right
|
|
57
|
+
Layer-1 domain** (different impls pass different test subsets → real within-task spread).
|
|
58
|
+
- **UNTESTED (still Gate A):** parallel **DIVERSE strategies** (different reasoning paths,
|
|
59
|
+
`directives.ts` → `DIVERSE_STRATEGY_LENSES` / `composeStrategies`) @k vs blind sample(n=k). A
|
|
60
|
+
distinct family from what rung-0 falsified — the open *within-run* question, and what runProgram's
|
|
61
|
+
`parallel` is built to deploy.
|
|
62
|
+
- **UNBUILT (Gate B):** the across-run policy-improvement curve on a multi-objective task stream.
|
|
63
|
+
No harness runs it yet; it is the durable next step, not a corpus-replay over the existing
|
|
64
|
+
single-objective records.
|
|
65
|
+
|
|
66
|
+
## The run archive (where results LIVE)
|
|
67
|
+
|
|
68
|
+
Every run's full artifact is committed under `agent-lab/runs/<date>/` — self-describing JSON
|
|
69
|
+
(models + config + per-task cells + gate verdicts with CIs), portable to any repo without
|
|
70
|
+
this codebase. `agent-lab/runs/RUNS.md` is the index mapping artifacts → verdicts → the
|
|
71
|
+
findings gist. **Set `OUT=runs/<date>/<name>.json` (in agent-lab) on every run — never `/tmp`**
|
|
72
|
+
(a reboot erases ramdisk; ~20 runs nearly died there once).
|
|
73
|
+
|
|
74
|
+
## Data flow (the whole experiment in one line)
|
|
75
|
+
`rollout (worker → answer) → adapter.judge (valid?) → CORPUS RunRecord (k attempts, output+valid each) → corpus-replay --selector (pick WITHOUT the judge) → corpus-report CI → gate verdict`
|
|
76
|
+
The expensive part (rollouts) produces a **reusable corpus**; selection + stats are free
|
|
77
|
+
and offline (zero new rollouts, zero judge calls).
|
|
78
|
+
|
|
79
|
+
## THE CANONICAL SUITE (2026-06-10) — the published path; start here
|
|
80
|
+
|
|
81
|
+
The optimization layer ships from the package; bench scripts compose it. A domain = an
|
|
82
|
+
`Environment` (5 hooks); a strategy = how budget is spent to beat its check; `runBenchmark`
|
|
83
|
+
returns per-strategy means + the per-task LOSSES table + the (score,$) Pareto frontier.
|
|
84
|
+
Promotion is the package gate (`promotionGate` — seeded paired bootstrap, evidence floor,
|
|
85
|
+
two modes: **superiority** and **non-inferiority** = score CI low > −tolerance AND cost
|
|
86
|
+
savings CI low > 0, the "same quality, cheaper" gate; verdicts carry paired Δlatency).
|
|
87
|
+
Authoring is `authorStrategy` (named `fallbackModel` retry). **Funnel-alignment law**: the
|
|
88
|
+
search-side champion tie-band must be no stricter than the gate's tolerance (under
|
|
89
|
+
`OBJECTIVE=cost` it defaults to it). Endurance envs on the evolve runner: `CHECKPOINT=path`
|
|
90
|
+
(phase ledger + resume — a killed run re-pays ONE phase), `GYM_RECREATE='docker …'`
|
|
91
|
+
(recreate the container at phase boundaries — the wedge killer). Observability:
|
|
92
|
+
`createWaterfallCollector` (every spawn billed+timed) + `anytimeReport` (TTT / shots-to-
|
|
93
|
+
target / COCO ERT / hill-climb AUC per satisficing target). Models policy: cheap router
|
|
94
|
+
models only (defaults `deepseek-v4-pro`/`deepseek-v4-flash`; compressor = flash with
|
|
95
|
+
`gpt-4o-mini` fallback) — never CC models; every verdict banner + artifact is
|
|
96
|
+
self-describing (models + config).
|
|
97
|
+
|
|
98
|
+
| entry point | what it answers | one-liner |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| **the research lines** | the flywheel/evolution runs, σ×κ factor grid, steering hypercube, model matrix, E3 certified memory, depth-vs-breadth, corpus A/Bs — **moved to [tangle-network/agent-lab](https://github.com/tangle-network/agent-lab) (private)** with the EOPS/math domains and the run archive | `~/code/agent-lab` — map in its README |
|
|
101
|
+
| `src/commit0-env-run.mts` | the HARD domain (implement whole libraries vs their test suites) through `runBenchmark` | `IDS=commit-0/wcwidth BUDGET=3 INNER_TURNS=10 tsx src/commit0-env-run.mts` |
|
|
102
|
+
| `src/examples/strategy-demo.mts` | the 3-layer API demo (gym-free) | `WORKER_MODEL=gpt-4o-mini tsx src/examples/strategy-demo.mts` |
|
|
103
|
+
| `src/examples/math-demo.mts` | any-domain proof: math via `createVerifierEnvironment` (the tax/legal/gtm answer-shape) | `BUDGET=3 tsx src/examples/math-demo.mts` |
|
|
104
|
+
|
|
105
|
+
`run-benchmarks-cli.mts` can run a bounded per-task refinement loop with
|
|
106
|
+
`LOOP_ATTEMPTS=N`: attempt 1 answers the original task; later attempts receive previous artifacts
|
|
107
|
+
plus redacted checker feedback; the loop stops early on pass. This is for testing whether agents can
|
|
108
|
+
use the benchmark's own feedback to solve the task, not for leaking gold answers into prompts.
|
|
109
|
+
For local subscription-backed workers, set `BACKEND=bridge`, `BRIDGE_URL`, `BRIDGE_BEARER`, and pass
|
|
110
|
+
the full bridge model id in `CELLS`, e.g. `CELLS=opencode/deepseek/deepseek-v4-pro`.
|
|
111
|
+
|
|
112
|
+
EOPS standup (one container): `docker run -d --rm --name eops -p 8006:8005
|
|
113
|
+
shivakrishnareddyma225/enterpriseops-gym-mcp-itsm:latest` + `EOPS_GYM_DBS_DIR=<unzipped
|
|
114
|
+
gym_dbs.zip from github.com/ServiceNow/EnterpriseOps-Gym>`; restart it FRESH per big run
|
|
115
|
+
(it wedges under load); `EOPS_SPLIT=csm|hr|…` selects other domains (their gym containers
|
|
116
|
+
not yet sourced). **Parallel lanes:** tasks carry the dataset's literal gym URL
|
|
117
|
+
(`http://localhost:8006`); `EOPS_GYM_URL=http://localhost:8007` rebases every server URL,
|
|
118
|
+
so N concurrent runs use N containers (`-p 8007:8005`, `-p 8008:8005`, …) instead of
|
|
119
|
+
serializing on one wedge-prone gym. Bring-up check: `agent-lab/domains/lane-probe.mts`. Cross-cutting laws baked into the suite: keep-best checkpoint scoring
|
|
120
|
+
(final-state scoring is biased −6–8pp), equal compute via the conserved pool, the analyst
|
|
121
|
+
is firewalled (trace-only), costs are real (router usage → `{usd, ms, tokens}`).
|
|
122
|
+
|
|
123
|
+
### The QUEUED runs for the test fleet (wired, one command each, unrun)
|
|
124
|
+
1. **Relevance-primed corpus A/B** — `PRIME_MODE=relevance K_FACTS=2 N=16 HOLDOUT=4` (the read-side design that survived the naive-priming negative).
|
|
125
|
+
2. ~~Strategy tournament at power~~ — RAN (n=24, budget 4, ×3 configs): HOLD verdicts; the cost-frontier finding ×3 + the funnel-alignment law came out of these. Live ledger: `.evolve/current.json` + the findings gist.
|
|
126
|
+
3. **Commit0 at real budget** — `BUDGET=3 INNER_TURNS=12 N=3` sample-vs-refine on the hard domain.
|
|
127
|
+
4. **Cross-domain replication** — blocked on sourcing the csm/hr gym containers (`EOPS_SPLIT` is wired).
|
|
128
|
+
|
|
129
|
+
## Commands (the standalone tools — each its own `main`)
|
|
130
|
+
the gate + measurement tools:
|
|
131
|
+
corpus-replay.mts --selector: selector@k vs random@k vs oracle@k over a corpus (THE offline gate)
|
|
132
|
+
corpus-report.mts paired-bootstrap CI + Benjamini-Hochberg over corpora
|
|
133
|
+
gate-cli.mts the recursive diverse-vs-blind gate through `runGate` (Supervisor)
|
|
134
|
+
run-benchmarks-cli.mts runBenchmarks: any subset of the ADAPTERS registry × model/harness cells, one combined ranked report (#420)
|
|
135
|
+
commit0-env-run.mts the HARD domain through `runBenchmark` (the optimization suite)
|
|
136
|
+
terminal-compare.ts Terminal-Bench compare (own main)
|
|
137
|
+
pnpm verify:pier zero-model failure/pass Pier controls through a separate verifier
|
|
138
|
+
unit tests (the only fully-green, cred-free runnable surface besides offline replay):
|
|
139
|
+
node --test --import tsx src/{selector,refine-loop}.test.mts
|
|
140
|
+
tsx src/gate.test.mts # offline plumbing test (no creds)
|
|
141
|
+
|
|
142
|
+
## Run the GATE — today, zero creds (it already runs)
|
|
143
|
+
```
|
|
144
|
+
cd bench
|
|
145
|
+
pnpm gate # = corpus-replay.mts corpus/finsearch.jsonl --selector
|
|
146
|
+
tsx src/corpus-replay.mts corpus/finsearch.jsonl --selector --condition=refine # other arms
|
|
147
|
+
tsx src/corpus-replay.mts <corpus.jsonl> --selector=verifier # GRADED domains: rank k by deployable-checker score
|
|
148
|
+
pnpm gate-report # paired-bootstrap CI + BH-FDR
|
|
149
|
+
```
|
|
150
|
+
`--selector=verifier` is for corpora whose attempts carry a continuous `score` (commit0
|
|
151
|
+
pytest pass-rate / aec verify.py partial credit) and where text doesn't cluster: it ranks by
|
|
152
|
+
the deployable checker (argmax score) and reports selector vs random with a paired bootstrap CI.
|
|
153
|
+
It needs WITHIN-TASK score spread to move — flat on aec (closed-form), live on commit0 (code).
|
|
154
|
+
The committed `corpus/finsearch.jsonl` (152 records: random@3 / refineHand@3 / refineGepa@3)
|
|
155
|
+
makes the gate replayable with no rollouts. To gate the DIVERSE arm you generate a
|
|
156
|
+
diverse-strategy corpus (k different `composeStrategies` prefixes per instance) by running
|
|
157
|
+
`gate-cli.mts` with the distinct-directive arms — the blind (identical-children) arm is the
|
|
158
|
+
control on the same run.
|
|
159
|
+
|
|
160
|
+
## Run the DIVERSE-vs-blind gate THROUGH the keystone (the recursive runtime, live)
|
|
161
|
+
```
|
|
162
|
+
cd bench
|
|
163
|
+
export TANGLE_API_KEY=… # router + the deployable judge
|
|
164
|
+
BENCH=enterpriseops-gym EOPS_FIXTURES=1 N=20 K=4 pnpm gate-cli
|
|
165
|
+
```
|
|
166
|
+
`gate-cli.mts` → `runGate` (`src/gate.ts`): a `Persona` + the generic
|
|
167
|
+
`fanout` combinator over the budget-conserving `Supervisor`. Blind = K identical children, diverse
|
|
168
|
+
= K distinct strategy directives — equal-k by construction (conserved pool), proven by
|
|
169
|
+
`equalKOnCost`. The DEPLOYABLE selector is the benchmark's OWN `adapter.judge` (each child solves
|
|
170
|
+
via the router, is graded by the runnable checker, and that `BenchScore` is the child's verdict
|
|
171
|
+
`defaultSelectWinner` ranks on — selector ≠ oracle/LLM-judge). Pick a deployable-checker bench
|
|
172
|
+
(enterpriseops-gym / swe-bench / terminal-bench), NOT finsearchcomp (LLM-judge → not deployable).
|
|
173
|
+
Offline plumbing test (no creds): `tsx src/gate.test.mts`. The gate runs through the SAME recursive
|
|
174
|
+
atom every personified loop uses.
|
|
175
|
+
|
|
176
|
+
## "Supervisor" (iterate/decompose) vs blind — through the PUBLISHED suite
|
|
177
|
+
The supervisor-vs-blind gate is NOT a bespoke harness: it is `runBenchmark([sample, refine, …])`
|
|
178
|
+
over an Environment. blind = `sample` (best-of-k); "supervisor" = `refine`/`sampleThenRefine`
|
|
179
|
+
(depth: attempt→firewalled-analyst-steer→retry — *"a multi-agent team is just a Strategy whose driver
|
|
180
|
+
spawns several agents"*). Equal compute by the substrate's CONSERVED budget; the deployable check is
|
|
181
|
+
the Environment's `score`; the can't-fake-the-check firewall is built in. Run it on the HARD real
|
|
182
|
+
domain via `commit0-env-run.mts` (above) or the toy `strategy-demo.mts` (offline). The LLM
|
|
183
|
+
agent-driver (an LLM that itself decides spawns via the coordination MCP) is the SEPARATE product
|
|
184
|
+
path — `atom-mcp-e2e.mts` / `atom-commit0.mts` — not a strategy. Evolve any strategy on a frozen
|
|
185
|
+
holdout with `runStrategyEvolution`.
|
|
186
|
+
|
|
187
|
+
## Generate a fresh corpus + gate it
|
|
188
|
+
The rollout generators now live with their domains: the recursive gate
|
|
189
|
+
(`gate-cli.mts`) and the optimization-suite env runs (`commit0-env-run.mts`,
|
|
190
|
+
`research-gate.mts` for the off-sandbox RAG baseline) each append corpus `RunRecord`s. Gate any
|
|
191
|
+
written corpus offline with the selector:
|
|
192
|
+
```
|
|
193
|
+
tsx src/corpus-replay.mts <corpus.jsonl> --selector
|
|
194
|
+
```
|
|
195
|
+
(hotpotqa is cheap + deterministic-judge but near-ceiling/weak-signal; simpleqa similar;
|
|
196
|
+
finsearchcomp is the strong-signal domain but needs the sandbox/local-web worker.)
|
|
197
|
+
|
|
198
|
+
## Optimize the strategy/prompt (so the gate tests BEST-effort, not strawman)
|
|
199
|
+
Strategy-space search is the package's `runStrategyEvolution` (the optimization suite); the diverse
|
|
200
|
+
lenses (`directives.ts`) layer on top of the shared base directive consumed by the gate arms.
|
|
201
|
+
|
|
202
|
+
## Workers (the rollout substrate)
|
|
203
|
+
The gate solves each child via the router and grades it with the benchmark's own
|
|
204
|
+
deployable `adapter.judge`; `research-gate.mts` is the off-sandbox retrieve→answer baseline
|
|
205
|
+
(`SEARCH=<provider>` selects the web-search arm). The steer text lives in `directives.ts`, NOT in the
|
|
206
|
+
worker (the worker is substrate). A strategy is a prompt PREFIX; the judge is unchanged.
|
|
207
|
+
|
|
208
|
+
## Adapters (benchmarks/) — honest state (the code wins over this line; verified 2026-06-04)
|
|
209
|
+
The code-benches share `benchmarks/_harness.ts` (stage artifact → run the bench's OWN evaluator
|
|
210
|
+
in a `.venv`/Docker subprocess → parse its JSON report → `{resolved,score}`). No per-adapter
|
|
211
|
+
copy of the process/venv/Docker/temp/report plumbing; commit0+appworld also share its
|
|
212
|
+
stdin-piping runner (`runVenvScriptStdin`).
|
|
213
|
+
Published-package consumers set `AGENT_BENCH_PYTHON` to the absolute path of an interpreter containing the benchmark dependencies.
|
|
214
|
+
If unset, source checkouts keep using `bench/.venv/bin/python`.
|
|
215
|
+
SWE-bench callers that need a hard evaluation deadline construct `createSweBenchAdapter({ timeoutMs })`; evaluator errors and incomplete or ambiguous reports throw instead of scoring zero.
|
|
216
|
+
Callers that must inspect the exact per-task image after scoring pass `cacheLevel: 'instance'`; the default remains `'env'`.
|
|
217
|
+
Callers retain the complete official evaluator tree plus raw process output with `captureEvaluatorArtifacts: ({ taskId, attemptSequence }) => ({ destination })`; the returned score (or `StagedJudgeError`) carries a receipt with every file hash and a whole-tree hash.
|
|
218
|
+
- **Real, runnable with ZERO extra deps:** finsearchcomp (GitHub dataset + fixtures + LLM judge — the gate bench), hotpotqa + simpleqa + frames (HF/web QA + F1/LLM judge; `*_FIXTURES=1` offline), **ragbench**, **crag**, **nomiracl**, **open-rag-bench**, **t2-ragbench** (SOTA RAG/knowledge benchmarks with committed fixtures and deterministic answer/relevance judges; live mode reads explicit `*_DATA_FILE` JSON/JSONL exports), **aec-bench** (real GitHub task tree + fixtures; judge = the task's own `tests/verify.py` over python3 stdlib — **deterministic, graded per-field partial credit, no Docker, no LLM** → the candidate non-oracle correctable-middle-band bench for the open gate).
|
|
219
|
+
- **Real code, needs an external harness/tools to run (fail loud with the exact install/Docker fix; never a fabricated score):** swe-bench + terminal-bench (`bench/.venv` + Docker), **commit0** (ISOLATED `bench/.venv-commit0` via `python3 -m venv bench/.venv-commit0 && bench/.venv-commit0/bin/pip install commit0 datasets` — its deps conflict with the shared `.venv`; override dir with `COMMIT0_VENV` — plus Docker; judge = official pytest harness, graded (passed+xfail)/total; the rollout prompt stages in-box (clones `commit-0/<repo>` @ `base_commit`, emits `git diff`); `COMMIT0_FIXTURES=1` for offline listing), **programbench** (`pip install programbench` + Docker on linux/amd64 + HF blobs; judge = official cleanroom eval, graded passed/total; `PROGRAMBENCH_FIXTURES=1` offline), **appworld** (`pip install appworld` + `appworld install` + `appworld download data`; judge = AppWorld's own `world.evaluate()`, graded passes/num_tests — NO committed fixture: task data exists only after `download data`, so loadTasks fails loud rather than fabricate a task), **dabstep** (`DABSTEP_DIR=/path/to/EnvCommons/DABStep` with the released `dataset.csv`, `splits/*.txt`, `files/*`, and `grade.py`; judge delegates to official `grade.py`; `DABSTEP_FIXTURES=1` only tests adapter plumbing and does not fabricate benchmark scores), **webarena-verified** (`WEBARENA_VERIFIED_DIR=/path/to/webarena-verified`; judge delegates to official `eval-tasks` over a run output directory), **tau2-bench** (`TAU2_BENCH_DIR=/path/to/tau2-bench`; judge recomputes tau2 trajectory rewards), **tau3-banking** (`TAU3_BENCH_DIR=/path/to/tau2-bench`; default domain `banking_knowledge`; judge recomputes tau trajectory rewards through the upstream tau3 package), **agentbench** DBBench subset (`AGENTBENCH_DIR=/path/to/AgentBench`; exact-match deterministic label judge), **bfcl** deterministic function-call subset (`BFCL_DIR=/path/to/gorilla/berkeley-function-call-leaderboard`; loads official BFCL JSONL + `possible_answer`; score = structured call/argument match, not the full BFCL leaderboard evaluator), **toollm** API-selection subset (`TOOLBENCH_DIR=/path/to/ToolBench`; score = recall of ToolBench `relevant APIs` labels, resolved only when the worker emits the requested structured JSON call list; official ToolEval pass rate remains LLM-judged/stochastic), **finresearchbench** (`FINRESEARCHBENCH_DATA_FILE=/path/to/export.jsonl`; rows must carry official `judge_system_prompt` + `judge_prompt_template`; no self-authored live judge), mind2web, cad-design + cadbench + cadgenbench (openscad/blender/build123d).
|
|
220
|
+
- **goldArtifact:** aec-bench returns the task's real `golden_pass.md` (verify-judge works fully offline). commit0 / programbench / appworld return `undefined` — the oracle is a git ref / stripped source / engine-bundled solution, not a portable string; judge correctness is proven by a real solve through the harness, not a synthetic gold (documented + fail-loud, not a fake).
|
|
221
|
+
- **Absent (not built):** swe-gym, swe-bench-multimodal, and the rest of the survey set.
|
|
222
|
+
Every unbuilt/scaffold adapter fails LOUD (throws with the integration step) rather than faking a score — no silent zeros in any corpus. Offline fixture tests: `benchmarks/{aec-bench,commit0,programbench,appworld,rag-benchmarks}.test.mts` (`tsx --test`).
|
|
223
|
+
|
|
224
|
+
## Pier candidate bridge
|
|
225
|
+
|
|
226
|
+
`pier_agents.tangle_candidate:TangleCandidateAgent` is the reusable Pier custom-agent path for frozen Tangle candidates.
|
|
227
|
+
`executePreparedPierCandidate()` is the only public entry point; its private staging step writes the runtime's execution-plan and materialization-receipt bytes verbatim.
|
|
228
|
+
The Python bridge rechecks those bytes and their signed task, candidate, profile, repository, instruction, and workspace identities before launch.
|
|
229
|
+
It rejects a raw candidate bundle, never projects an `AgentProfile`, and leaves task isolation, patch transfer, verification, retries, and result storage to Pier.
|
|
230
|
+
|
|
231
|
+
The adapter fails the trial when any prepared identity drifts, when the task checkout or immutable OCI image differs from the signed identity, or when the candidate exits nonzero or exceeds its signed deadline.
|
|
232
|
+
Candidate code runs as an unprivileged numeric user, while evaluator inputs and timeout evidence remain root-owned.
|
|
233
|
+
It never accepts candidate-authored token, cost, or trace receipts; `executePreparedPierCandidate()` uses the runtime's atomic execution path and reconciles the protected `TraceStore` with the model-gateway ledger before returning a gradable receipt.
|
|
234
|
+
The prepared object contains no credentials.
|
|
235
|
+
The runtime passes model and trace bindings only to the trusted executor request.
|
|
236
|
+
The Pier launcher inherits their values through its protected process environment and passes only `${NAME}` references on the command line, so credentials never enter prepared bytes, CLI arguments, or job files.
|
|
237
|
+
The executor builds fresh task, candidate, and profile trees from the request's exact verified file bytes; prepared staging directories are never launch authority.
|
|
238
|
+
Isolated memory and knowledge-bearing candidates currently fail closed until Pier has executor-owned mount and after-state capture.
|
|
239
|
+
The signed wall deadline is a hard stop: the runtime aborts, Pier kills the process tree, and the executor acknowledges process and container death.
|
|
240
|
+
The signed tool-step count is a post-run validity check over protected traces, not a pre-tool stop; generic black-box Pier processes cannot honestly prevent step N+1.
|
|
241
|
+
The executable zero-model fixture is `fixtures/pier-agent/`; run it against the R360 Pier checkout with `PIER_REPO=/path/to/pier pnpm verify:pier`.
|
|
242
|
+
That command runs a no-change candidate that must score 0/1, proves a fresh evaluator process can kill a persisted child and remove its real Docker container, and runs a known-good candidate that must score 1/1.
|
|
243
|
+
It then checks that each official result and exact task patch is bound into its own runtime receipt with zero model usage.
|
|
244
|
+
|
|
245
|
+
For a real frozen candidate, use `FilePierCandidateTrialController`, append `agentArgs` and `attemptArgs`, and pass each executor-only `evaluatorEnv` entry through Pier's evaluator-owned environment mechanism.
|
|
246
|
+
The launch callback's second argument carries the signed runtime `request`, protected `traceStore`, cancellation `signal`, and absolute `deadlineAtMs`; production launchers must use that context rather than reconstructing it.
|
|
247
|
+
The controller sends secrets to its supervisor over a pipe, while its durable files contain only process and Docker-project identities:
|
|
248
|
+
The supervisor never inherits `process.env`; non-default Docker connections use a stable `dockerConnection.id` plus the exact environment injected into both Pier and cleanup.
|
|
249
|
+
Fresh recovery workers must reconstruct that same named connection; `terminate-pier-trial.mts` selects only the comma-delimited variables named by `PIER_DOCKER_ENV_NAMES` when `PIER_DOCKER_CONNECTION_ID` is set.
|
|
250
|
+
`jobName` must be unique per prepared execution; the controller atomically reserves that job directory so recovery can remove only containers owned by that execution.
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
const controller = new FilePierCandidateTrialController({
|
|
254
|
+
directory: '/var/lib/tangle/pier-control',
|
|
255
|
+
launch: (staged, { request }) => {
|
|
256
|
+
const jobName = request.executionId
|
|
257
|
+
return {
|
|
258
|
+
command: 'uv',
|
|
259
|
+
args: ['run', 'pier', 'run', ...staged.agentArgs, ...staged.attemptArgs],
|
|
260
|
+
cwd: pierCheckout,
|
|
261
|
+
env: { ...evaluatorEnvironment, ...staged.evaluatorEnv },
|
|
262
|
+
jobsDirectory,
|
|
263
|
+
jobName,
|
|
264
|
+
readResult: () => readOfficialPierResult(jobsDirectory, jobName),
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
const result = await executePreparedPierCandidate({
|
|
270
|
+
prepared,
|
|
271
|
+
directory: '/sealed/candidate',
|
|
272
|
+
pierVersion: '0.3.0',
|
|
273
|
+
traceStore,
|
|
274
|
+
claimStore,
|
|
275
|
+
outputArtifacts,
|
|
276
|
+
grader,
|
|
277
|
+
controller,
|
|
278
|
+
})
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The controller's result resolves only after normal process/container cleanup.
|
|
282
|
+
On a signed deadline, external abort, or recovery by another evaluator process, the adapter waits for `terminateAndWait()` to acknowledge both process exit and container removal before it returns control to the runtime.
|
|
283
|
+
|
|
284
|
+
One prepared execution always maps to one Pier attempt (`--n-attempts 1 --max-retries 0`).
|
|
285
|
+
Production callers pass a long-lived `FileAgentCandidateExecutionClaimStore`; an in-memory claim store is test-only and cannot prevent a second process from replaying the same attempt.
|
|
286
|
+
Any allowed pre-model infrastructure retry is a new prepared execution with its own counted attempt identity.
|
|
287
|
+
|
|
288
|
+
## Is it runnable RIGHT NOW? (verify the map, don't trust it blindly)
|
|
289
|
+
```
|
|
290
|
+
ls src/*.mts src/*.ts # the real tool list (each its own main — source of truth)
|
|
291
|
+
tsx src/gate.test.mts # offline plumbing test (no creds)
|
|
292
|
+
```
|
|
293
|
+
Creds: the router/sandbox paths read `ROUTER_KEY`/`SANDBOX_KEY` (+ `ROUTER_BASE`/`SANDBOX_BASE_URL`)
|
|
294
|
+
from the environment. Source them from the operator's private secret store (documented in the
|
|
295
|
+
global agent config, NOT here — this repo is public) into the run process; never print them.
|
|
296
|
+
NOT needed for the offline selector gate, the hotpotqa/swe-bench deterministic judges, or
|
|
297
|
+
RESEARCH=1 local-opencode rollouts — if unset, those paths are cred-blocked, not code-blocked.
|
|
298
|
+
|
|
299
|
+
## Durable next step (so this stops drifting)
|
|
300
|
+
The surviving tools are standalone `.mts` mains (no `run.ts` registry). Next: a manifest test that
|
|
301
|
+
asserts every committed tool + package.json script is named on this page, so the map can't silently
|
|
302
|
+
drift from the code again.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# agent-runtime-bench
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Published as `@tangle-network/agent-bench`, with independent CI and release checks for its TypeScript and Python surfaces.
|
|
4
4
|
|
|
5
5
|
**Read [`bench/HARNESS.md`](./HARNESS.md) FIRST.** It is the one maintained map: the commands, the `rollout → corpus → selector → CI → gate` data flow, the canonical-suite table, the wired/needs-creds/scaffolded matrix, and the gate one-liners — kept verified against source.
|
|
6
6
|
|
|
@@ -13,3 +13,28 @@ pnpm install # tsx + link parent
|
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
The judge needs only Docker; workers need a model key (Tangle router `TANGLE_API_KEY`, or a direct provider).
|
|
16
|
+
|
|
17
|
+
Retain every official per-test log and report before the temporary evaluator directory is removed:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
const adapter = createSweBenchAdapter({
|
|
21
|
+
captureEvaluatorArtifacts: ({ taskId, attemptSequence }) => ({
|
|
22
|
+
destination: path.join(runDirectory, taskId, String(attemptSequence)),
|
|
23
|
+
}),
|
|
24
|
+
})
|
|
25
|
+
const score = await adapter.judge(task, patch)
|
|
26
|
+
console.log(score.judgeArtifacts?.manifestPath)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Each destination contains the untouched evaluator tree under `evaluator/`, raw `stdout.bin` and `stderr.bin` under `process/`, and `receipt.json` with per-file SHA-256 values plus a whole-tree SHA-256.
|
|
30
|
+
The destination must be unique and absent; an existing path fails loud instead of overwriting evidence.
|
|
31
|
+
Failed evaluators throw `StagedJudgeError` with the same `judgeArtifacts` receipt after retaining partial logs.
|
|
32
|
+
|
|
33
|
+
## Pier custom candidates
|
|
34
|
+
|
|
35
|
+
The package executes a branded `PreparedAgentCandidateExecution` from `@tangle-network/agent-runtime` through one atomic API and ships `pier_agents.tangle_candidate:TangleCandidateAgent` as its thin Pier transport.
|
|
36
|
+
The executor recreates every input from runtime-verified file bytes and reveals model credentials only inside the claimed execution callback.
|
|
37
|
+
Pier owns the task container and verifier; protected model usage and traces stay in `@tangle-network/agent-eval` and are finalized by the shared runtime.
|
|
38
|
+
`FilePierCandidateTrialController` atomically reserves a unique Pier job, then persists the supervisor PID, process-session identity, and that job's exact Docker projects so a fresh evaluator process can stop and remove an abandoned trial.
|
|
39
|
+
Run `PIER_REPO=/path/to/pier pnpm verify:pier` for the zero-model failure/pass and fresh-process recovery proof, and see `HARNESS.md` for the exact invocation and failure contract.
|
|
40
|
+
From an installed npm package, expose the shipped Python module with `export PYTHONPATH="$(npm root)/@tangle-network/agent-bench${PYTHONPATH:+:$PYTHONPATH}"` before invoking Pier.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "electrical/catenary-sag",
|
|
4
|
+
"discipline": "electrical",
|
|
5
|
+
"instruction": "You are a senior electrical engineer specializing in overhead transmission lines.\n\n## Problem\n\nCalculate the conductor sag and total conductor length for a single level span\nusing catenary equations. The conductor hangs between two towers at equal height.\n\n## Given\n\n| Parameter | Value | Unit |\n|-----------|-------|------|\n| Span length | 250 | m |\n| Conductor unit weight | 7.58 | N/m |\n| Horizontal tension | 64500 | N |\n\n## Required\n\nCalculate the following:\n- Catenary constant (m)\n- Maximum sag at mid-span (m)\n- Total conductor length between attachment points (m)\n\n## Applicable Standards\n\n- IEC 60826 \u2014 Design criteria of overhead transmission lines (for reference)\n- AS/NZS 7000 \u2014 Overhead line design (for reference)\n\nExact clause citation is optional.\n\n## Constraints\n\n- No internet access is available. Work from engineering knowledge only.\n- Use catenary (not parabolic) equations for this calculation.\n\n## Output Format\n\nShow your step-by-step working in Markdown, including the formulas you use and\nintermediate calculations. At the end of your solution, include a JSON block\nwith your final answers in exactly this format:\n\n```json\n{\n \"catenary_constant_m\": <numeric_value>,\n \"sag_m\": <numeric_value>,\n \"conductor_length_m\": <numeric_value>\n}\n```\n\nWrite your complete solution to `/workspace/output.md`.\n",
|
|
6
|
+
"task_toml": "version = \"1.0\"\n\n[metadata]\ndifficulty = \"easy\"\ncategory = \"reasoning\"\ntags = [\"electrical\", \"transmission-lines\", \"deterministic\", \"IEC-60826\"]\n\n[agent]\ntimeout_sec = 600.0\n\n[verifier]\ntimeout_sec = 120.0\n\n[environment]\nextensions = []\nbuild_timeout_sec = 600.0\ncpus = 1\nmemory_mb = 2048\nstorage_mb = 5120\nallow_internet = true\n",
|
|
7
|
+
"verify_py": "# ABOUTME: Verifier for catenary-sag task.\n# ABOUTME: Computes ground truth from catenary formulas and scores agent output.\n\nimport argparse\nimport json\nimport math\nimport re\nfrom pathlib import Path\n\nDEFAULT_OUTPUT_FILE = Path(\"/workspace/output.md\")\nDEFAULT_REWARD_FILE = Path(\"/logs/verifier/reward.json\")\n\n\ndef write_reward(reward: float, details: dict[str, float], path: Path) -> None:\n \"\"\"Write reward JSON for Harbor, plus per-field details to a sibling file.\"\"\"\n path.parent.mkdir(parents=True, exist_ok=True)\n path.write_text(json.dumps({\"reward\": round(reward, 2)}))\n details_path = path.parent / \"details.json\"\n details_path.write_text(json.dumps(details))\n\n\ndef compute_ground_truth() -> dict[str, float]:\n \"\"\"Compute expected answers from catenary formulas.\"\"\"\n H = 64500.0 # horizontal tension (N)\n w = 7.58 # conductor unit weight (N/m)\n L = 250.0 # span length (m)\n\n c = H / w\n sag = c * (math.cosh(L / (2 * c)) - 1)\n length = 2 * c * math.sinh(L / (2 * c))\n\n return {\n \"catenary_constant_m\": c,\n \"sag_m\": sag,\n \"conductor_length_m\": length,\n }\n\n\ndef extract_json_block(text: str) -> dict | None:\n \"\"\"Extract the last fenced JSON block from Markdown text.\"\"\"\n pattern = r\"```json\\s*\\n(.*?)\\n\\s*```\"\n matches = re.findall(pattern, text, re.DOTALL)\n if not matches:\n return None\n try:\n return json.loads(matches[-1])\n except json.JSONDecodeError:\n return None\n\n\ndef score_field(expected: float, actual_val, rel_tol: float) -> float:\n \"\"\"Score a single field: 1.0 if within tolerance, 0.0 otherwise.\"\"\"\n if actual_val is None:\n return 0.0\n try:\n actual_float = float(actual_val)\n except (TypeError, ValueError):\n return 0.0\n if math.isclose(actual_float, expected, rel_tol=rel_tol):\n return 1.0\n return 0.0\n\n\ndef score_answers(\n expected: dict[str, float], actual: dict | None\n) -> tuple[float, dict[str, float]]:\n \"\"\"Score each field and return overall reward + per-field details.\"\"\"\n tolerances = {\n \"catenary_constant_m\": 0.02,\n \"sag_m\": 0.02,\n \"conductor_length_m\": 0.02,\n }\n\n if not actual:\n details = {k: 0.0 for k in expected}\n return 0.0, details\n\n details = {}\n for key, exp_val in expected.items():\n act_val = actual.get(key)\n tol = tolerances.get(key, 0.02)\n details[key] = score_field(exp_val, act_val, tol)\n\n total = len(expected)\n reward = sum(details.values()) / total if total > 0 else 0.0\n return round(reward, 2), details\n\n\ndef main() -> None:\n parser = argparse.ArgumentParser(description=\"Verify catenary-sag output\")\n parser.add_argument(\"--input\", type=Path, default=DEFAULT_OUTPUT_FILE)\n parser.add_argument(\"--output\", type=Path, default=DEFAULT_REWARD_FILE)\n args = parser.parse_args()\n\n try:\n if not args.input.exists() or args.input.stat().st_size == 0:\n details = {k: 0.0 for k in compute_ground_truth()}\n write_reward(0.0, details, args.output)\n return\n\n text = args.input.read_text()\n expected = compute_ground_truth()\n actual = extract_json_block(text)\n reward, details = score_answers(expected, actual)\n write_reward(reward, details, args.output)\n except Exception:\n details = {k: 0.0 for k in compute_ground_truth()}\n write_reward(0.0, details, args.output)\n\n\nif __name__ == \"__main__\":\n main()\n",
|
|
8
|
+
"golden_pass_md": "# Catenary Sag Calculation\n\n## Given\n- Span length: 250 m\n- Conductor unit weight: 7.58 N/m\n- Horizontal tension: 64500 N\n\n## Step 1: Catenary Constant\n\nThe catenary constant is defined as:\nc = H / w = 64500 / 7.58 = 8509.2348 m\n\n## Step 2: Maximum Sag\n\nUsing the catenary equation:\nsag = c * (cosh(L / (2c)) - 1)\nsag = 8509.2348 * (cosh(250 / 17018.4696) - 1)\nsag = 8509.2348 * (cosh(0.01469) - 1)\nsag = 8509.2348 * 0.000107895\nsag = 0.9181 m\n\n## Step 3: Conductor Length\n\nlength = 2c * sinh(L / (2c))\nlength = 2 * 8509.2348 * sinh(0.01469)\nlength = 17018.4696 * 0.014691\nlength = 250.0090 m\n\n```json\n{\n \"catenary_constant_m\": 8509.2348,\n \"sag_m\": 0.9181,\n \"conductor_length_m\": 250.009\n}\n```\n"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "electrical/voltage-drop",
|
|
12
|
+
"discipline": "electrical",
|
|
13
|
+
"instruction": "You are a senior electrical engineer specializing in building services.\n\n## Problem\n\nCalculate the voltage drop for a three-phase cable circuit using the impedance\nmethod, and determine whether it complies with the maximum allowable voltage\ndrop limit.\n\n## Given\n\n| Parameter | Value | Unit |\n|-----------|-------|------|\n| Circuit type | Three-phase | - |\n| Load current | 45 | A |\n| Cable length (one way) | 80 | m |\n| Cable resistance (R) | 0.524 | ohm/km |\n| Cable reactance (X) | 0.08 | ohm/km |\n| Power factor (cos phi) | 0.85 | - |\n| System voltage (line-to-line) | 400 | V |\n| Maximum allowable voltage drop | 5 | % |\n\n## Required\n\nCalculate the following:\n- Voltage drop (V)\n- Voltage drop as a percentage of system voltage (%)\n- Compliance with the 5% limit (1 if compliant, 0 if not)\n\n## Applicable Standards\n\n- AS/NZS 3008.1 \u2014 Electrical installations: selection of cables (for reference)\n- AS/NZS 3000 \u2014 Wiring rules (for reference)\n\nExact clause citation is optional.\n\n## Constraints\n\n- No internet access is available. Work from engineering knowledge only.\n- Use the impedance method (not simplified resistance-only method).\n\n## Output Format\n\nShow your step-by-step working in Markdown, including the formulas you use and\nintermediate calculations. At the end of your solution, include a JSON block\nwith your final answers in exactly this format:\n\n```json\n{\n \"voltage_drop_v\": <numeric_value>,\n \"voltage_drop_pct\": <numeric_value>,\n \"compliance\": <1_or_0>\n}\n```\n\nWrite your complete solution to `/workspace/output.md`.\n",
|
|
14
|
+
"task_toml": "version = \"1.0\"\n\n[metadata]\ndifficulty = \"easy\"\ncategory = \"reasoning\"\ntags = [\"electrical\", \"buildings-electrical\", \"deterministic\", \"AS-NZS-3008\"]\n\n[agent]\ntimeout_sec = 600.0\n\n[verifier]\ntimeout_sec = 120.0\n\n[environment]\nextensions = []\nbuild_timeout_sec = 600.0\ncpus = 1\nmemory_mb = 2048\nstorage_mb = 5120\nallow_internet = true\n",
|
|
15
|
+
"verify_py": "# ABOUTME: Verifier for voltage-drop task.\n# ABOUTME: Computes ground truth from impedance method and scores agent output.\n\nimport argparse\nimport json\nimport math\nimport re\nfrom pathlib import Path\n\nDEFAULT_OUTPUT_FILE = Path(\"/workspace/output.md\")\nDEFAULT_REWARD_FILE = Path(\"/logs/verifier/reward.json\")\n\n\ndef write_reward(reward: float, details: dict[str, float], path: Path) -> None:\n \"\"\"Write reward JSON for Harbor, plus per-field details to a sibling file.\"\"\"\n path.parent.mkdir(parents=True, exist_ok=True)\n path.write_text(json.dumps({\"reward\": round(reward, 2)}))\n details_path = path.parent / \"details.json\"\n details_path.write_text(json.dumps(details))\n\n\ndef compute_ground_truth() -> dict[str, float]:\n \"\"\"Compute expected answers from three-phase voltage drop formula.\"\"\"\n current = 45.0 # load current (A)\n L = 80.0 # cable length (m)\n R = 0.524 # cable resistance (ohm/km)\n X = 0.08 # cable reactance (ohm/km)\n pf = 0.85 # power factor\n V = 400.0 # system voltage (V)\n\n sin_phi = math.sin(math.acos(pf))\n Vd = math.sqrt(3) * current * L * (R * pf + X * sin_phi) / 1000\n Vd_pct = Vd / V * 100\n compliance = 1.0 if Vd_pct <= 5.0 else 0.0\n\n return {\n \"voltage_drop_v\": Vd,\n \"voltage_drop_pct\": Vd_pct,\n \"compliance\": compliance,\n }\n\n\ndef extract_json_block(text: str) -> dict | None:\n \"\"\"Extract the last fenced JSON block from Markdown text.\"\"\"\n pattern = r\"```json\\s*\\n(.*?)\\n\\s*```\"\n matches = re.findall(pattern, text, re.DOTALL)\n if not matches:\n return None\n try:\n return json.loads(matches[-1])\n except json.JSONDecodeError:\n return None\n\n\ndef score_field(\n expected: float, actual_val, rel_tol: float, exact: bool = False\n) -> float:\n \"\"\"Score a single field: 1.0 if within tolerance, 0.0 otherwise.\"\"\"\n if actual_val is None:\n return 0.0\n try:\n actual_float = float(actual_val)\n except (TypeError, ValueError):\n return 0.0\n if exact:\n return 1.0 if actual_float == expected else 0.0\n if math.isclose(actual_float, expected, rel_tol=rel_tol):\n return 1.0\n return 0.0\n\n\ndef score_answers(\n expected: dict[str, float], actual: dict | None\n) -> tuple[float, dict[str, float]]:\n \"\"\"Score each field and return overall reward + per-field details.\"\"\"\n tolerances = {\n \"voltage_drop_v\": {\"rel_tol\": 0.03, \"exact\": False},\n \"voltage_drop_pct\": {\"rel_tol\": 0.03, \"exact\": False},\n \"compliance\": {\"rel_tol\": 0.0, \"exact\": True},\n }\n\n if not actual:\n details = {k: 0.0 for k in expected}\n return 0.0, details\n\n details = {}\n for key, exp_val in expected.items():\n act_val = actual.get(key)\n cfg = tolerances.get(key, {\"rel_tol\": 0.03, \"exact\": False})\n details[key] = score_field(exp_val, act_val, cfg[\"rel_tol\"], cfg[\"exact\"])\n\n total = len(expected)\n reward = sum(details.values()) / total if total > 0 else 0.0\n return round(reward, 2), details\n\n\ndef main() -> None:\n parser = argparse.ArgumentParser(description=\"Verify voltage-drop output\")\n parser.add_argument(\"--input\", type=Path, default=DEFAULT_OUTPUT_FILE)\n parser.add_argument(\"--output\", type=Path, default=DEFAULT_REWARD_FILE)\n args = parser.parse_args()\n\n try:\n if not args.input.exists() or args.input.stat().st_size == 0:\n details = {k: 0.0 for k in compute_ground_truth()}\n write_reward(0.0, details, args.output)\n return\n\n text = args.input.read_text()\n expected = compute_ground_truth()\n actual = extract_json_block(text)\n reward, details = score_answers(expected, actual)\n write_reward(reward, details, args.output)\n except Exception:\n details = {k: 0.0 for k in compute_ground_truth()}\n write_reward(0.0, details, args.output)\n\n\nif __name__ == \"__main__\":\n main()\n",
|
|
16
|
+
"golden_pass_md": "# Voltage Drop Calculation\n\n## Given\n- Circuit type: Three-phase\n- Load current: 45 A\n- Cable length: 80 m (one way)\n- Cable resistance: 0.524 ohm/km\n- Cable reactance: 0.08 ohm/km\n- Power factor: 0.85\n- System voltage: 400 V\n\n## Step 1: Calculate sin(phi)\ncos(phi) = 0.85\nsin(phi) = sin(acos(0.85)) = 0.5268\n\n## Step 2: Voltage Drop\nUsing the three-phase impedance method:\nVd = sqrt(3) x I x L x (R x cos(phi) + X x sin(phi)) / 1000\nVd = 1.7321 x 45 x 80 x (0.524 x 0.85 + 0.08 x 0.5268) / 1000\nVd = 1.7321 x 45 x 80 x (0.4454 + 0.0421) / 1000\nVd = 1.7321 x 45 x 80 x 0.4876 / 1000\nVd = 3.0400 V\n\n## Step 3: Percentage\nVd% = 3.0400 / 400 x 100 = 0.7600%\n\n## Step 4: Compliance\n0.76% is less than 5% limit, so the cable complies.\n\n```json\n{\n \"voltage_drop_v\": 3.04,\n \"voltage_drop_pct\": 0.76,\n \"compliance\": 1\n}\n```\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"description": "What are the Notes when the Method is decision?",
|
|
4
|
+
"label": ["Women +60kg Bronze"],
|
|
5
|
+
"table": {
|
|
6
|
+
"table_name": "Jiu-Jitsu Championships Results",
|
|
7
|
+
"table_info": {
|
|
8
|
+
"columns": [
|
|
9
|
+
{ "name": "Result", "type": "TEXT" },
|
|
10
|
+
{ "name": "Opponent", "type": "TEXT" },
|
|
11
|
+
{ "name": "Method", "type": "TEXT" },
|
|
12
|
+
{ "name": "Event", "type": "TEXT" },
|
|
13
|
+
{ "name": "Notes", "type": "TEXT" }
|
|
14
|
+
],
|
|
15
|
+
"rows": [
|
|
16
|
+
["Win", "Rosangela Conceicao", "Decision", "2009 ADCC Submission Wrestling World Championships", "Women +60kg Bronze"],
|
|
17
|
+
["Loss", "Penny Thomas", "Points (-2 x -1)", "2009 ADCC Submission Wrestling World Championships", "Women +60kg Semifinal"]
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "BFCL_fixture_simple_python",
|
|
3
|
+
"rows": [
|
|
4
|
+
{
|
|
5
|
+
"id": "simple_python_fixture_0",
|
|
6
|
+
"question": [
|
|
7
|
+
[
|
|
8
|
+
{
|
|
9
|
+
"role": "user",
|
|
10
|
+
"content": "Find the area of a triangle with a base of 10 units and height of 5 units."
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
],
|
|
14
|
+
"function": [
|
|
15
|
+
{
|
|
16
|
+
"name": "calculate_triangle_area",
|
|
17
|
+
"description": "Calculate the area of a triangle given its base and height.",
|
|
18
|
+
"parameters": {
|
|
19
|
+
"type": "dict",
|
|
20
|
+
"properties": {
|
|
21
|
+
"base": { "type": "integer" },
|
|
22
|
+
"height": { "type": "integer" },
|
|
23
|
+
"unit": { "type": "string" }
|
|
24
|
+
},
|
|
25
|
+
"required": ["base", "height"]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"answers": [
|
|
32
|
+
{
|
|
33
|
+
"id": "simple_python_fixture_0",
|
|
34
|
+
"ground_truth": [
|
|
35
|
+
{
|
|
36
|
+
"calculate_triangle_area": {
|
|
37
|
+
"base": [10],
|
|
38
|
+
"height": [5],
|
|
39
|
+
"unit": ["units", ""]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"instance_id": "commit-0/wcwidth",
|
|
4
|
+
"repo": "commit-0/wcwidth",
|
|
5
|
+
"original_repo": "jquast/wcwidth",
|
|
6
|
+
"base_commit": "0d0054189bdb0fc7b9de0456fc3cee2b67a6ceba",
|
|
7
|
+
"reference_commit": "36a625179ed2675287fe6b61c2ad319406449e60",
|
|
8
|
+
"setup": {
|
|
9
|
+
"install": "pip install -e .",
|
|
10
|
+
"packages": null,
|
|
11
|
+
"pip_packages": null,
|
|
12
|
+
"pre_install": null,
|
|
13
|
+
"python": "3.10",
|
|
14
|
+
"specification": "https://wcwidth.readthedocs.io/en/stable/"
|
|
15
|
+
},
|
|
16
|
+
"test": {
|
|
17
|
+
"test_cmd": "pytest",
|
|
18
|
+
"test_dir": "tests/"
|
|
19
|
+
},
|
|
20
|
+
"src_dir": "wcwidth/"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"instance_id": "commit-0/deprecated",
|
|
24
|
+
"repo": "commit-0/deprecated",
|
|
25
|
+
"original_repo": "laurent-laporte-pro/deprecated",
|
|
26
|
+
"base_commit": "b7e2114c046abb489e4e23ab9f829778b076650d",
|
|
27
|
+
"reference_commit": "378636d8a1e3d62d5894329c57f44ba0030c2dbd",
|
|
28
|
+
"setup": {
|
|
29
|
+
"install": "pip install -e .[dev]",
|
|
30
|
+
"packages": null,
|
|
31
|
+
"pip_packages": null,
|
|
32
|
+
"pre_install": null,
|
|
33
|
+
"python": "3.10",
|
|
34
|
+
"specification": "https://deprecated.readthedocs.io/en/latest/"
|
|
35
|
+
},
|
|
36
|
+
"test": {
|
|
37
|
+
"test_cmd": "pytest",
|
|
38
|
+
"test_dir": "tests/"
|
|
39
|
+
},
|
|
40
|
+
"src_dir": "deprecated/"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"instance_id": "commit-0/tinydb",
|
|
44
|
+
"repo": "commit-0/tinydb",
|
|
45
|
+
"original_repo": "msiemens/tinydb",
|
|
46
|
+
"base_commit": "ed761a72c8c1e1cb24ca4dbcc089f35c5264d357",
|
|
47
|
+
"reference_commit": "429b27a513f0ad301632379e55667dd99865fb16",
|
|
48
|
+
"setup": {
|
|
49
|
+
"install": "pip install -e .",
|
|
50
|
+
"packages": null,
|
|
51
|
+
"pip_packages": [
|
|
52
|
+
"pytest>=7.2.0,<8.0.0",
|
|
53
|
+
"pytest-pycodestyle>=2.3.1,<3.0.0",
|
|
54
|
+
"pytest-cov>=4.0.0,<5.0.0",
|
|
55
|
+
"pycodestyle>=2.10.0,<3.0.0",
|
|
56
|
+
"sphinx>=7.0.0,<8.0.0",
|
|
57
|
+
"coveralls>=3.3.1,<4.0.0",
|
|
58
|
+
"pyyaml>=6.0,<7.0",
|
|
59
|
+
"types-PyYAML>=6.0.0,<7.0.0",
|
|
60
|
+
"typing-extensions>=4.4.0,<5.0.0"
|
|
61
|
+
],
|
|
62
|
+
"pre_install": null,
|
|
63
|
+
"python": "3.10",
|
|
64
|
+
"specification": "https://tinydb.readthedocs.io/_/downloads/en/v4.8.0/pdf/"
|
|
65
|
+
},
|
|
66
|
+
"test": {
|
|
67
|
+
"test_cmd": "pytest",
|
|
68
|
+
"test_dir": "tests/"
|
|
69
|
+
},
|
|
70
|
+
"src_dir": "tinydb/"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"task_id": 1,
|
|
4
|
+
"instructions": "Using the payment files, answer this calibration task with the exact integer 42.",
|
|
5
|
+
"all_golds_by_task": [
|
|
6
|
+
{
|
|
7
|
+
"kind": "number",
|
|
8
|
+
"value": 42.0
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"task_id": 2,
|
|
14
|
+
"instructions": "Using the payment files, answer this calibration task with the card scheme nexpay.",
|
|
15
|
+
"all_golds_by_task": [
|
|
16
|
+
{
|
|
17
|
+
"kind": "scheme",
|
|
18
|
+
"value": "nexpay"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
]
|