Resume Workflow Run Stream

Stored runs and access

Use the database-backed example workflow server and retain the returned workflow, run and session IDs. Configured authorization requires access to run the target workflow.

JWT user isolation is opt-in; non-admin service-account PAT callers always self-scope. Scoped callers can read only their own matching workflow sessions and runs. A wrong owner, missing record or cross-component ID returns 404. Authentication alone does not enable user isolation.

Reconnect to event delivery

This endpoint reconnects a background streaming run. It does not restart execution or resolve a human-review pause; use Continue Workflow Run for a paused run. Poll background non-streaming runs with Get Workflow Run.

Use the saved IDs and the last event_index actually received. Omit that field if you have not received an indexed event yet:

RUN_ID="returned-run-id"
SESSION_ID="returned-session-id"
curl --fail-with-body --no-buffer \
  "http://127.0.0.1:7777/workflows/echo/runs/$RUN_ID/resume" \
  -H "Authorization: Bearer $OS_SECURITY_KEY" \
  -F "session_id=$SESSION_ID" -F 'last_event_index=7'

Here 7 represents the last received index; replace it with your client's value. session_id is mandatory for scoped identities, not every non-admin JWT caller. Always supplying it also enables database fallback. Factory and remote workflows do not support this endpoint (400).

An active run can deliver catch-up events followed by live events. A terminal buffer can replay completed, paused, errored or cancelled runs. Without a buffer, database fallback can replay only events that were saved; AgentOS enables event storage on initialized registered workflows, but skipped or otherwise missing events cannot be regenerated. A stored output with no events produces replay metadata with total_events=0.

The default event buffer is process-local. Live reconnection across replicas requires a distributed event stream. Durable run output and live stream availability are separate. HTTP 200 can contain an event: error frame; handle that as a replay failure.

POST/workflows/{workflow_id}/runs/{run_id}/resume

Resume an SSE stream for a workflow run after disconnection.

Sends missed events since last_event_index, then continues streaming live events if the run is still active.

Three reconnection paths:

  1. Run still active: Sends catch-up events + continues live streaming
  2. Run completed (in buffer): Replays missed buffered events
  3. Run completed (in database): Replays events from database

Client usage: Track event_index from each SSE event. On reconnection, pass the last received event_index as last_event_index.

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

workflow_id*Workflow Id
run_id*Run Id

Request Body

application/x-www-form-urlencoded

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl --request POST 'https://example.com/workflows/string/runs/string/resume'
null