cmd/allternit-api/src/agency_api/replays/) on top of the kernel’s replay engine (cassette recording from the receipt chain, recorded-only replay, divergence reports). Replays with overrides let you test a change (a candidate decision head, another model class, another task graph) against real past runs before it goes live. Replay is one of the five conditions of the alpha gate: a run must survive restart, resume, verify, replay and receipt-backed completion before alpha opens.
Replays never cause effects
effects is always recorded_only. It is the only allowed value.
- Every external effect is served from the recorded, content-addressed result.
- A call with no recording fails that node with
ERR_REPLAY_UNRECORDED. It is never executed live. - An effect whose request changed under an override (for example a document with new content) is answered with the recorded result and reported as an
EFFECT_REQUESTdivergence. Nothing is executed. - Before a result is stored the server asserts that the kernel replay and the graph walk both performed zero live effects. If not, the replay fails closed with
ERR_REPLAY_LIVE_EFFECTand no result is kept. - Live model calls an override needs (cognition only, tools off) go through gizzi-code and land on the usage ledger with
surface: replayandsource: replay, attributed to the source run. - Those live calls count against the same daily spending caps as runs (
ALLTERNIT_AGENCY_DAILY_BUDGETglobally andALLTERNIT_AGENCY_ORG_DAILY_BUDGETper org, run spend plus replay spend). The caps are checked before the walk and before every call; when one is reached the replay fails closed withERR_BUDGET_CAP_REACHED(429, familyBUDGET) and no partial result is kept. Replay spend also counts toward the caps that admit runs. Evals replay through the same path.
Endpoints
The Replay object
Replay IDs match^rpl_[A-Za-z0-9]+$.
Status
ReplayStatusVerdict
Create a replay
Parameters
Request body
ReplayRequestoverrides selects what to vary. Anything not overridden is taken from the source run’s recording. The alpha accepts three keys; any other key (including the contract’s completion, models and runtime) is rejected with 400 ERR_INPUT_UNSUPPORTED and param: "overrides.<key>".
The top-level
k (1-50) sets pass@k sampling for nondeterministic heads (default: the kind’s replay_k, 5).
Decisions of a run are the decisions you made with session_id (or task) set to the run id. A candidate head re-decides each one as the head stands now minus that decision’s own outcome (leave-one-out), so it gets no credit for remembering the answer it is tested on. Its effective choice is what the chain would serve with the head live: its answer when its confidence clears the kind’s threshold, otherwise the recorded served choice. A replay never teaches a head: no shadow rows, no lookup updates.
Cognition replays (model_class, graph_version) re-walk task-type graphs; for BUG_FIX runs only decision_heads is available in the alpha (422 ERR_REPLAY_UNSUPPORTED). A graph that cannot bind the run’s declared write set fails with 422 ERR_REPLAY_GRAPH_INVALID; a model class with no available generative model with 422 ERR_REPLAY_MODEL_CLASS. WAIT gates are answered from the run’s recorded answers (an unrecorded one stops the replay; nobody is asked). The user’s recalled memory is not part of the recording, so re-generated prompts carry no memory section.
S1 decision steps (decisions inside agency runs) are answered from the run’s journaled decision. A replay never decides one live, and a live replay with no recorded decision stops at that step. When decision_heads names the step’s decision kind, the replay re-decides the recorded decision with the candidate head, leaving out its own outcome. It then follows the effective choice through the step’s routes, pass list and escalation the way the run would. A changed choice is reported once as a DECISION divergence on the step, along with any MISSING_NODE or EXTRA_NODE divergences from the new route. The nodes row shows via: "candidate_head" and the comparison. A decision_heads-only replay re-generates nothing, so a route into a step that was never recorded stops with UNRECORDED.
Replays that need live model calls run in the background: the response says status: "running"; poll the replay. Other replays complete before the response.
A source run records a cassette when runtime.record_cassette is true, which is the default.
Responses
Example
Replay a run unchanged:Get a replay
Parameters
Responses
Example
Get replay results
completed; before that the endpoint returns 409 ERR_REPLAY_NOT_FINISHED.
divergences: what differed. Receipt-chain divergences from the kernel replay (alwaysunexpected: the recording itself does not check out), plus, with overrides,DECISION(the candidate’s effective choice differs from the served one),OUTPUT(a re-generated node produced different text),EFFECT_REQUEST,OUTCOME(a node committed or failed unlike the source),EXTRA_NODE,MISSING_NODEandUNRECORDED. A divergence isexpectedwhen the overrides explain it (it comes after a changed output or graph),unexpectedotherwise. Theverdictisequivalentwith no divergences,diverged_expectedwhen all are expected,diverged_unexpectedotherwise.nodes: per node of the replayed path,via(recorded,live,deterministicorrefused),outcome, thesourcenode’s outcome, tokens and duration,tokens/latency_ms/cost_usdof a live re-generation,output_matches, and for effect nodeseffect.served: "recorded"andeffect.request_matches.decisions: per recorded decision, theservedchoice (backend, latency, cost), the outcomelabel, thecandidate(head, version, choice, confidence, answered, confident), theeffective_choice,agrees_with_served,correctandserved_correct.metrics.decisions:replayed,answered,coverage,agreement_with_served,labelled,accuracy(with the head live),head_accuracy(where it answered),baseline_accuracy(served), meancost_usd/baseline_cost_usdandlatency_ms/baseline_latency_ms,pass_at_1,pass_at_k,k,deterministic, and the same per kind underby_kind. A decision is labelled when its outcome names the right option.metrics.run:verifier(sourceandreplay:passorfailat the completion gate), the replayed run’sstatus,tokens,cost_usdandlatency_msassource(the whole run),source_regenerated(what the source spent on the nodes the replay re-generated; cost is estimated pro rata by tokens),live(what the replay spent) andreplay(source − regenerated + live), andlive_model_calls.
Parameters
Responses
ReplayResults.divergences is paginated with cursor and limit.
Example
Batch replays
completed, partial or failed) with the same overrides and read aggregate metrics: an eval set built from real trajectories. Name the runs, or select the most recent ones:
Each run gets its own replay (readable at
/v1/replays/{replay_id}, with batch_id set). The batch object (rpb_…) carries replays (id, source run, verdict, verifier per run), skipped (with the reason, including runs with no recording), the worst verdict, and metrics:
metrics.runs:requested,replayed,skipped,verdictsper kind,verifier(source_pass_rate,replay_pass_rate,pass_at_1= the replayed runs’ verifier pass rate,agreementwith the source), and summedtokens,cost_usd,latency_ms(source,source_regenerated,live) andlive_model_calls;metrics.decisions: the decision metrics above over every re-decided decision of the batch, withby_kind.
decision_heads run by a decisions admin is stored as the kind’s replay evidence, which the flywheel reads before it promotes that head (Decisions: replay evidence); evidence lists the stored rows with the acceptance verdict. Other users’ batches report the same metrics but are not evidence (evidence_note says so).