Replays reference
Commands, flags, settings, routes, day states and limits for Replays.
Before running commands
replays:setup loads apps/backend/.env itself. replays:flag, history:capture and
replay:environment do not, and stop with DATABASE_URL is required without it. On a source
install, load the backend environment in your shell first:
set -a; . apps/backend/.env; set +aOn a deployed install, export the backend’s environment the same way your deployment does.
replays:setup
Run from the repository root. It reads apps/backend/.env; variables already set in the shell win.
It prints JSON: the setup status, or {"status":"failed","code":...} with a hint on error.
bun run replays:setup --organization <id> --basis "<agreement reference>"| Flags | What it does |
|---|---|
--basis "<agreement>" (alone) | Turns Replays on with the Standard preset, or finishes an earlier run. |
--status | Shows status. Changes nothing. |
--confirm --basis "<agreement>" | Records every tool waiting for approval. |
--pause --basis "<reason>" | Pauses all new capture. History stays readable. |
--resume --basis "<reason>" | Resumes capture. New tools still wait for approval. |
--remove-history --confirm-remove <id> --basis "<reason>" | Pauses, then deletes kept history after 7 days. |
--cancel-removal --basis "<reason>" | Cancels a scheduled removal. Capture stays paused. |
--organization is always required. --basis is 1 to 2,000 characters. The actor is your operating
system user. Per-integration recording has no flag: use the Setup tab or the
backend call. The command line does not check what
you reviewed: run --status first.
The command prints raw codes, which differ from the page codes:
| Command code | Page code | Meaning |
|---|---|---|
source_unavailable | history_capture_off | History capture is off, or recovery mode is on. |
capture_paused | replays_paused | Resume first. |
removal_pending | removal_scheduled | Cancel the removal first. |
removal_due | removal_due | The removal can no longer be cancelled. |
removal_not_scheduled | removal_not_scheduled | Nothing to cancel. |
missing_source | organization_not_found, setup_required | Unknown business, or Replays not turned on yet. |
invalid_request | invalid_request | Bad flags, or --confirm-remove is not this business’s id. |
replays:flag
bun run replays:flag --organization <id> --enabled trueSets only the business’s Replays switch (replaysEnabled). Turning Replays on with replays:setup
already sets it. With the switch off, the Timeline, trial results and trial start refuse with
replays_disabled. It does not stop capture; pause does.
history:capture
Each subcommand takes one private JSON file. The ones Replays operators use most:
| Subcommand | What it does |
|---|---|
seed | Writes a disabled collection policy proposal to filePath. |
configure | Stores a collection policy. |
readiness | Checks a collection policy’s configuration. No provider calls. |
policies | Lists a business’s recording and run-input policies. |
overview, show, content | Inspect retained history. |
observation-configure | Writes a hand-written recording policy (never changed by the preset). |
run-configure | Writes a hand-written run-input policy. |
The full list and file formats are in historical data preservation.
replay:environment
bun run replay:environment run --config /private/replay-runner.json [--organization <id>] [--once]
bun run replay:environment import-backup --organization <id> --config /private/backup-import.jsonrun is the replay runner. import-backup stores an operator-supplied MongoDB or Redis backup for
replay. See prepare replay environments.
Settings
config/local-stack.json | Environment variable | Default | Purpose |
|---|---|---|---|
historyCaptureEnabled | HISTORY_CAPTURE_ENABLED | false | Turns history capture on for the install. |
historyDailyPreservation | HISTORY_DAILY_PRESERVATION | false | Hands scheduled collection to the daily S3 sync. |
replayReadToken | REPLAY_READ_TOKEN | none | Timeline, entries and trial results. |
replayTrialToken | REPLAY_TRIAL_TOKEN | none | Start and cancel trials. |
replaySetupToken | REPLAY_SETUP_TOKEN | none | Read and change Replays setup. |
historyArchiveS3 | HISTORY_ARCHIVE_S3 | none | Object with the private S3 bucket, region and credentials for history; else the install’s object store. |
integrationCredentialKey | INTEGRATION_CREDENTIAL_KEY | generated | Encrypts history. Keep it for as long as history. |
Tokens are at least 32 characters and must all differ from each other and from the agent service and execution-capture read tokens. They go to the backend and the frontend server only.
Per business, in the organization’s settings: snapshot days and the Replays display use UTC; replaysEnabled is the
Replays switch.
In the runner’s JSON file: trialTimeLimitMinutes (5 to 1,440; default 60).
Routes
All routes are under /organizations/{organizationId}. Each accepts one token and refuses every other.
| Route | Token | Use |
|---|---|---|
GET /replays/timeline | REPLAY_READ_TOKEN | Saved history over a range |
GET /replays/entries/{entryId} | REPLAY_READ_TOKEN | One saved entry’s content |
GET /eval-runs, /eval-runs/{trialId}, /eval-runs/{trialId}/trajectory | REPLAY_READ_TOKEN | Trial results |
GET /replay-trials/options | REPLAY_TRIAL_TOKEN | Days and their states |
POST /replay-trials | REPLAY_TRIAL_TOKEN | Start a trial |
DELETE /replay-trials/{trialId} | REPLAY_TRIAL_TOKEN | Cancel a trial |
GET /replays/setup | REPLAY_SETUP_TOKEN | Setup status |
POST /replays/setup | REPLAY_SETUP_TOKEN | Change setup |
/replay-environments/... | AGENT_SERVICE_TOKEN | Replay control API (environments) |
POST /replays/setup takes an action: apply, confirm, pause, resume, cancel_removal,
remove (with confirmOrganizationId), recording_off or recording_on (with integrationId).
Each needs a basis. apply, confirm and recording_on also send reviewed: the exact tools staff
saw, so consent never covers tools nobody reviewed.
The full contracts are in the API reference: Replays and Replay environments.
Day states
| State | Meaning | Can start a trial |
|---|---|---|
frozen | A complete snapshot exists. | Yes |
not_frozen | No snapshot yet. Starting a trial freezes one. | Yes |
missing_data | The snapshot lacks required data. | No |
no_history | The day ended before the business’s state was first saved. | No |
not_over | The day has not ended in UTC. | No |
Limits
| Limit | Value |
|---|---|
| Default retention | 90 days |
| Recorded tools per integration policy | 200 (the rest are listed as over the limit) |
| Requirements per snapshot | 100 |
| Requirements pointing outside internal state | 50 |
| Integrations per generated snapshot | 32 |
| Days offered for a trial | Today and the 13 before |
| Unfinished trials per business | 3 |
| Trial time limit | 60 minutes by default |
| Removal grace period | 7 days |
| Insights copy window | 6 hours after the day ends |
| Timeline range | 92 days |
| Agreement reference | 2,000 characters |