Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
4a7e927
refactor(standard): name a keyless custom provider's key from its set…
pierreleca Nov 23, 2026
eee7947
feat(standard): keep each model call of a unit's agent whole in its r…
pierreleca Nov 23, 2026
8226592
feat(builder): choose on the Limits step what each trial keeps of its…
pierreleca Nov 23, 2026
3e3a7a0
feat(runs): read a trial's model calls from its relay's record
pierreleca Nov 23, 2026
eee9f14
feat(traces): show a trial's conversation call by call, with its pict…
pierreleca Nov 23, 2026
80dd971
feat(standard): send a recorded model call again under a spending cap
pierreleca Nov 23, 2026
6739601
feat(standard): compare many recorded calls under named arms, and cou…
pierreleca Nov 23, 2026
af38d41
Merge remote-tracking branch 'origin/main' into feat/model-calls-record
pierreleca Nov 24, 2026
ca88140
Merge branch 'feat/model-calls-record' into feat/replay-and-study
pierreleca Nov 24, 2026
aed6f26
docs(standard): say the exchange record in a row or a sentence each
pierreleca Nov 24, 2026
74fca01
Merge branch 'feat/model-calls-record' into feat/replay-and-study
pierreleca Nov 24, 2026
f619eda
docs(standard): cut the replay page to its commands and one row a rule
pierreleca Nov 24, 2026
a2d10e5
Merge remote-tracking branch 'origin/main' into feat/replay-and-study
pierreleca Nov 25, 2026
4bf5b9f
docs(standard): say the trial saved its exchange record, as the run p…
pierreleca Nov 25, 2026
25dbd7a
docs(standard): say saved for what a run's relay holds of its calls, …
pierreleca Nov 25, 2026
7f62584
Merge remote-tracking branch 'origin/main' into feat/replay-and-study
pierreleca Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
413 changes: 411 additions & 2 deletions app/nullius/standard/cli.py

Large diffs are not rendered by default.

869 changes: 869 additions & 0 deletions app/nullius/standard/runner/replay.py

Large diffs are not rendered by default.

615 changes: 615 additions & 0 deletions app/nullius/standard/runner/study.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/site/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ nav:
- Prove a benchmark: cli/prove.md
- Conform an agent or a capability: cli/conform.md
- Fidelity: cli/fidelity.md
- Replay a model call: cli/replay.md
- Shard and merge: cli/shard-and-merge.md
- Pages from a shell: cli/pages.md
- Exit codes and output: cli/exit-codes.md
Expand Down
16 changes: 15 additions & 1 deletion app/tests/test_standard_exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from nullius.standard.contract import definitions
from nullius.standard.pages import recipe
from nullius.standard.requirements import install
from nullius.standard.runner import pace as pacing, run
from nullius.standard.runner import pace as pacing, replay, run

ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "fixtures", "standard", "catalogue")
APP = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down Expand Up @@ -266,6 +266,11 @@ def test_empty_and_placeholder_keys_leave_exchanges_unchanged(self):
self.assertEqual(line["reply"]["body"], body.decode())
self.assertEqual(exchanges.rebuild(store.dir, line), raw)
self.assertTrue(exchanges.check(store.dir, "u0001", n)["same"])
(job / "config.json").write_text(json.dumps({"standard": {"provider": "custom"}}))
src = replay.source(str(job), "task__u0001", 1)
prep = replay.prepare(src, prices={"local-model": {"input": 1.0, "output": 2.0}}, env=env)
self.assertEqual(prep.raw, raw)
self.assertEqual(prep.sha256, line["sent_sha256"])

def test_a_damaged_part_leaves_other_calls_rebuildable(self):
for damage in ("truncated", "digest", "picture", "missing"):
Expand Down Expand Up @@ -734,6 +739,15 @@ def test_a_keyless_custom_endpoint_keeps_a_call_that_can_be_replayed(self):
self.assertNotIn("key_cut", line)
self.assertEqual(line["reply"]["body"], body.decode())
self.assertEqual(exchanges.rebuild(self.store(r), line), raw)
(job / "config.json").write_text(json.dumps({"standard": {"provider": "custom"}}))
src = replay.source(str(job), "task__u0001", 1)
prep = replay.prepare(src, prices={"local-model": {"input": 1.0, "output": 2.0}}, env=env)
self.assertEqual(prep.sha256, line["sent_sha256"])
before = len(Upstream.seen)
doc = replay.send(prep, 1, 1.0, str(Path(self.tmp) / "replay"), env=env)
self.assertEqual([sent for _, _, sent in Upstream.seen[before:]], [raw])
self.assertTrue(doc["sent_as_prepared"])
self.assertEqual(doc["sends"]["answered"], 1)

def test_the_relays_key_is_in_no_file_of_the_store(self):
r = self.relay()
Expand Down
606 changes: 606 additions & 0 deletions app/tests/test_standard_replay.py

Large diffs are not rendered by default.

486 changes: 486 additions & 0 deletions app/tests/test_standard_study.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ From a source checkout, replace `nullius` with
| [Prove a benchmark](prove.md) | `nullius standard prove` |
| [Conform an agent or a capability](conform.md) | `nullius standard conform` |
| [Fidelity](fidelity.md) | `nullius standard fidelity` |
| [Replay a model call](replay.md) | `nullius standard replay`, `study`, `recount` |
| [Shard and merge](shard-and-merge.md) | `nullius standard run --shard`, `merge` |
| [Storage](../settings/README.md#storage) | `nullius paths [--json]` |
| [Model prices](../settings/model-prices.md) | `nullius prices [list\|update\|set\|remove]` |
Expand Down
3 changes: 2 additions & 1 deletion docs/cli/exit-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ A refusal is one line on stderr, nothing partial written; the standard's command
| Streams | stdout for output, stderr for diagnostics; `--json` is one document |
| Job id | The job directory's name, everywhere |
| Secrets | Read commands make no model call and never print credentials. Job content is redacted |
| Writes | Reads write nothing, open no socket; import under `-o`; the standard its jobs, and a user definition on `new`, `prove`, `conform`, `fidelity`; migration writes only with `--apply`; `flags` writes only the job's `failure-analysis.json` |
| Writes | Reads write nothing, open no socket; import under `-o`; the standard its jobs, and a user definition on `new`, `prove`, `conform`, `fidelity`; `replay` and `study` their own folder, `recount` a file in it; migration writes only with `--apply`; `flags` writes only the job's `failure-analysis.json` |
| Paid actions | `standard replay` and `standard study` send only under their required `--max-usd`; `--dry-run` sends nothing |

<div class="grid cards" markdown>

Expand Down
72 changes: 72 additions & 0 deletions docs/cli/replay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Replay a model call

Send a trial's recorded model call again, K times under a spending cap, as it was or changed, and count the answers. A [study](#a-study-over-many-calls) does it for many calls and compares named arms of changes.

```bash title="Replay"
nullius standard replay <job dir> <trial> --list [--read CMD] [--json]
nullius standard replay <job dir> <trial> --call N --times K --max-usd USD \
[--through CMD] [--system FILE] [--tools FILE] [--tool-description NAME TEXT]... \
[--replace OLD NEW]... [--drop-last K] [--set FIELD=JSON]... \
[--model M] [--served-by SLUG[,SLUG...]] [--provider P] [--price MODEL=INPUT,OUTPUT]... \
[--read CMD] [-j N] [--dry-run] [--out DIR] [--json]
```

The trial must have saved its [exchange record](run.md#the-exchange-record).

| Item | Detail |
| --- | --- |
| `--list` | The trial's recorded calls, and whether each request rebuilds to its recorded hash. |
| Where it goes | The job's provider, model, pin and price, through a relay of the replay's own. |
| The key | The provider's key from the environment or the saved settings, never written. |
| `--max-usd` | Required: the first send past the cap is refused, with nothing after it. |
| `--dry-run` | What would be sent and its estimated cost; sends and writes nothing. |
| Refused | A call cut or saved as text, a model with no price, a stored conversation. |

## Changes

Applied in this order. A `TEXT`, `OLD` or `NEW` that starts with `@` is that file's text.

| Option | Change |
| --- | --- |
| `--through CMD` | The request's JSON passed through a command, such as another version's request builder. |
| `--system FILE`, `--tools FILE` | The system text, or the tools as a JSON list, replaced whole. |
| `--tool-description NAME TEXT` | One tool's description. |
| `--replace OLD NEW` | A text of the system text or a message, found exactly once. |
| `--drop-last K` | The last K messages left out. |
| `--set FIELD=JSON` | A top-level parameter such as `temperature=0`; `null` removes it. |
| `--model`, `--served-by`, `--provider` | Another model, pin or provider. |

## Answers

By default an answer's label is its first tool call, as canonical JSON. `--read CMD` reads one answer as JSON on its stdin and prints its label, for a model that writes its action as text:

```python title="read_action.py"
import json
import sys

answer = json.load(sys.stdin)
print(json.loads(answer["text"])["action"])
```

The replay's folder (`--out DIR`, else under `replays/`) holds `replay.json` with the counts, the request sent and each answer.

## A study over many calls

Several recorded calls, each sent K times as recorded and under named arms of changes, under one cap, compared call by call.

```bash title="Study"
nullius standard study <dir> --times K --max-usd USD \
[--targets FILE] [--job <job dir> --trial TRIAL... [--every N] [--where REGEX]] \
[--arm NAME=CHANGES]... [--price MODEL=INPUT,OUTPUT]... [--read CMD] [--yes REGEX] [--compare A B] \
[-j N] [--stop-after N] [--dry-run] [--json]
nullius standard recount <dir> [--read CMD] [--yes REGEX] [--compare A B] [--json]
```

| Item | Detail |
| --- | --- |
| Targets | Lines `JOB_DIR TRIAL CALL` in `--targets`, or the calls of `--job`'s trials. |
| Arms | `recorded` first, then each `--arm NAME=CHANGES`, a JSON list such as `[["drop_last", 1]]`. |
| Yes or no | An answer reads yes when its label is the recorded one's, or matches `--yes`. |
| The result | Each arm's yes by target, and an exact sign test between two arms. |
| Goes on | The same command again sends only what was not answered, under the same cap. |
| `recount` | A kept study or replay read again by another rule, with no send. |
1 change: 1 addition & 0 deletions docs/cli/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ A benchmark that names a cut in `limits.scored_cuts` still scores an agent's uni
| `off` | No exchange record: the call record in `agent/calls.jsonl` alone. |
| The bound | `--exchanges-max-mb`, 256 MB a unit by default; later calls are marked `cut`. |
| Not kept | The judge's and the simulated user's calls: their call record alone. |
| A request sent again | A recorded call sent K times, as it was or changed: [Replay a model call](replay.md) |
| The result | `config.json`: `standard.exchanges` and `standard.exchanges_max_mb`. |

## A spending cap
Expand Down
Loading