Replay a run
Starts a new run of a finished run's routine that reuses what the source run already did. Each top-level step that succeeded in the source run is copied: it succeeds at once with its recorded outputs, does not run its callable again (no request, no sandbox, no charge) and shows `replayed: true`. Everything else runs: `from_step` and every step downstream of it, the steps that failed, were skipped or were canceled, steps another version adds or changes (compared with the source version's step of the same id: the step as written, the pack and routine versions it pinned at publish, the steps it depends on, and the `vars` and `env` it reads), steps that read an `input` that differs from the source's (directly or through `env`), steps that wait for a signal unless the version and input are the source's, and every step downstream of one of those. `trigger` and `run` are not compared. Without `from_step`, a replay of a failed run picks up where it failed. The new run uses the source run's version and input unless `version` or `input` is given, so a fix published as a new version can be replayed against the run that failed. Its trigger is `{type: replay, parent_run_id, from_step}`; steps that run again read what the source got from its trigger through the input. Copied steps do not count toward `routines.steps.daily`. The copied outputs and the input together are at most `routines.max_step_output_bytes` (1 MiB by default), or the replay answers 422 `replay_too_large`. Answers like `routinesCreateRun`: `?wait=`, `Accept: text/event-stream`, `webhook` and `Idempotency-Key` work the same way.
/v1/routines/runs/{run_id}/replay
Authentication
Path Parameters
run_id
string
required
path
"run_01m5t5fr06dx6azc42f4wbzf5s"Query Parameters
wait
integer
optional
query
Header Parameters
Idempotency-Key
string
optional
header
Request Body
application/jsonfrom_step
string
input
object
version
string | integer
durability
string
ephemeral, standard, strictwebhook
object
url
string (uri)
REQUIRED
events
string[]
metadata
object
Responses
application/jsonid
string
REQUIRED
object
string
REQUIRED
routine_runstatus
string
REQUIRED
queued, running, succeeded, failed, canceledcreated_at
string (date-time)
REQUIRED
updated_at
string (date-time)
REQUIRED
started_at
string (date-time) | null
finished_at
string (date-time) | null
progress
object
completed
integer
REQUIRED
failed
integer
total
integer | null
unit
string
REQUIRED
result
unknown
error
object
type
string (uri)
REQUIRED
title
string
REQUIRED
status
integer
REQUIRED
code
string
REQUIRED
detail
string
REQUIRED
instance
string
errors
object[]
pointer
string
REQUIRED
detail
string
REQUIRED
reason
string
required_scope
string
retry_after_s
integer
limit
object
id
string
REQUIRED
limit
number
REQUIRED
unit
string
REQUIRED
window_s
integer
current
number
current_status
string
upstream_status
integer
step
string
pack_error
object
code
string
REQUIRED
message
string
REQUIRED
retryable
boolean
REQUIRED
timing
object
total_ms
number
REQUIRED
expires_at
string (date-time) | null
metadata
object
webhook
object
url
string (uri)
REQUIRED
events
string[]
routine_id
string
REQUIRED
version_id
string
REQUIRED
version_number
integer
REQUIRED
durability
string
REQUIRED
ephemeral, standard, stricttrigger
object
REQUIRED
type
string
REQUIRED
api, cron, interval, webhook, action, routine, replayid
string
occurrence_id
string
scheduled_at
string (date-time)
hook_id
string
delivery_id
string
subscription_id
string
event_id
string
parent_run_id
string
parent_step_id
string
from_step
string
input
object
REQUIRED
summary
string
steps
object[]
REQUIRED
id
string
REQUIRED
uses
string
item_index
integer
status
string
REQUIRED
pending, running, waiting, retrying, succeeded, failed, skipped, canceledattempt
integer
REQUIRED
started_at
string (date-time)
finished_at
string (date-time)
duration_ms
number
outputs
unknown
error
object
type
string (uri)
REQUIRED
title
string
REQUIRED
status
integer
REQUIRED
code
string
REQUIRED
detail
string
REQUIRED
instance
string
errors
object[]
pointer
string
REQUIRED
detail
string
REQUIRED
reason
string
required_scope
string
retry_after_s
integer
limit
object
id
string
REQUIRED
limit
number
REQUIRED
unit
string
REQUIRED
window_s
integer
current
number
current_status
string
upstream_status
integer
step
string
pack_error
object
code
string
REQUIRED
message
string
REQUIRED
retryable
boolean
REQUIRED
map
object
total
integer
succeeded
integer
failed
integer
running
integer
waiting_for
object
signal
string
until
string (date-time)
replayed
boolean
truecurl -X POST 'https://beta-api.b3os.org/v1/routines/runs/run_01m5t5fr06dx6azc42f4wbzf5s/replay' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "from_step": "summary"}'
const response = await fetch('https://beta-api.b3os.org/v1/routines/runs/run_01m5t5fr06dx6azc42f4wbzf5s/replay', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "from_step": "summary" })});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/routines/runs/run_01m5t5fr06dx6azc42f4wbzf5s/replay', headers=headers, json={ "from_step": "summary"})print(response.json())
{ "id": "run_01m5t7a3k2xq9zb4c8d6e0f1g2", "object": "routine_run", "status": "succeeded", "routine_id": "rtn_01m5t6vhkw4a8fa4tb5w4ffz37", "version_id": "ver_01m5t6ncrsssrysy1p2fbn2pgf", "version_number": 2, "durability": "standard", "trigger": { "type": "replay", "parent_run_id": "run_01m5t5fr06dx6azc42f4wbzf5s", "from_step": "summary" }, "input": { "topic": "pricing" }, "result": { "summary": "Prices did not change today." }, "summary": "Prices did not change today.", "steps": [ { "id": "page", "uses": "vision/scrape@1", "status": "succeeded", "attempt": 1, "started_at": "2026-10-25T20:10:00.001Z", "finished_at": "2026-10-25T20:10:00.001Z", "duration_ms": 0.004, "replayed": true }, { "id": "summary", "uses": "infer/chat@1", "status": "succeeded", "attempt": 1, "started_at": "2026-10-25T20:10:00.001Z", "finished_at": "2026-10-25T20:10:01.180Z", "duration_ms": 1179.2 } ], "progress": { "completed": 2, "total": 2, "unit": "steps" }, "created_at": "2026-10-25T20:10:00.000Z", "updated_at": "2026-10-25T20:10:01.180Z", "started_at": "2026-10-25T20:10:00.000Z", "finished_at": "2026-10-25T20:10:01.180Z", "timing": { "dispatch_ms": 0.02, "steps_ms": 1179.3, "total_ms": 1180.1 }, "expires_at": "2026-11-24T20:10:01.180Z", "metadata": {}}
Try this endpoint
/v1/routines/runs/{run_id}/replay