Implementation: DESIGN (server) · Exposure: PUBLIC PREVIEW (contract). The Agency API is not live yet. This page describes the published v0.3 contract so you can review and build against it; details may change before alpha.
A replay re-runs a finished run at the decision and tool boundary, using the run’s trace, receipts and recording (its cassette). It answers whether the system makes the same decisions given the same recorded world. For the concepts see Replay. The endpoints are served by allternit-api’s Agency API alpha (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_REQUEST divergence. 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_EFFECT and 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: replay and source: replay, attributed to the source run.
  • Those live calls count against the same daily spending caps as runs (ALLTERNIT_AGENCY_DAILY_BUDGET globally and ALLTERNIT_AGENCY_ORG_DAILY_BUDGET per 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 with ERR_BUDGET_CAP_REACHED (429, family BUDGET) 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

ReplayStatus

Verdict

Create a replay

Parameters

Request body

ReplayRequest overrides 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:
Re-run the cognition in the local model class and test a candidate head on the run’s decisions:

Get a replay

Parameters

Responses

Example

Get replay results

The divergence report and the comparison. It is available when the replay’s status is completed; before that the endpoint returns 409 ERR_REPLAY_NOT_FINISHED.
  • divergences: what differed. Receipt-chain divergences from the kernel replay (always unexpected: 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_NODE and UNRECORDED. A divergence is expected when the overrides explain it (it comes after a changed output or graph), unexpected otherwise. The verdict is equivalent with no divergences, diverged_expected when all are expected, diverged_unexpected otherwise.
  • nodes: per node of the replayed path, via (recorded, live, deterministic or refused), outcome, the source node’s outcome, tokens and duration, tokens / latency_ms / cost_usd of a live re-generation, output_matches, and for effect nodes effect.served: "recorded" and effect.request_matches.
  • decisions: per recorded decision, the served choice (backend, latency, cost), the outcome label, the candidate (head, version, choice, confidence, answered, confident), the effective_choice, agrees_with_served, correct and served_correct.
  • metrics.decisions: replayed, answered, coverage, agreement_with_served, labelled, accuracy (with the head live), head_accuracy (where it answered), baseline_accuracy (served), mean cost_usd / baseline_cost_usd and latency_ms / baseline_latency_ms, pass_at_1, pass_at_k, k, deterministic, and the same per kind under by_kind. A decision is labelled when its outcome names the right option.
  • metrics.run: verifier (source and replay: pass or fail at the completion gate), the replayed run’s status, tokens, cost_usd and latency_ms as source (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) and replay (source − regenerated + live), and live_model_calls.

Parameters

Responses

ReplayResults. divergences is paginated with cursor and limit.

Example

Batch replays

Replay up to 50 of your finished runs (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, verdicts per kind, verifier (source_pass_rate, replay_pass_rate, pass_at_1 = the replayed runs’ verifier pass rate, agreement with the source), and summed tokens, cost_usd, latency_ms (source, source_regenerated, live) and live_model_calls;
  • metrics.decisions: the decision metrics above over every re-decided decision of the batch, with by_kind.
A batch with 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).

Polling pattern