Skip to main content
A workflow can stream its result on the connection that started it, or run independently of that connection. Those are the synchronous and asynchronous execute endpoints. Use the asynchronous endpoint for production integrations. The run is unaffected if your client disconnects, its result is always stored, and you can attach to it, cancel it, or come back to it later. The synchronous endpoint is still the shortest path to a first result, so the Workflows quickstart uses it. Reach for the asynchronous endpoint as soon as a run has to survive a dropped connection, a page reload, or a deploy of your own service.

Submit a run

POST /v1/workflow/execute/async takes the same body as the synchronous endpoint — a template (inline or a stored template id), input, time_range, and model_name — and returns 202 Accepted straight away.
The execution_id is the handle for everything that follows: reading the result, attaching to the event stream, cancelling, and resuming the run if it stops early. Store it: nothing else identifies the run.
persistence_mode is not accepted here. Every submitted run is stored, because the stored run is how you read its result once the request that started it has returned. See Stored runs and retention below.

Read the result

Retrieve the run with GET /v1/workflow/executions/{execution_id} and check its status. A run is finished when its status is completed, error, or cancelled; while it is pending or running, its events are null.
The events list is the run’s streamed messages replayed in order, using the same message types you get live. A handler written for the live stream replays a stored run without changes. See Streaming responses for the full set, and Execution history for the rest of the retrieval response.

Watch a run live

Polling is enough for most integrations. If you want to show progress as it happens — the research plan filling in, the answer arriving token by token — attach to the run’s event stream: GET /v1/workflow/execute/async/{execution_id}/stream
The run proceeds whether or not anything is listening, and disconnecting does not stop it. You can attach after the run has already produced output and still receive everything from the start.

Resume a dropped stream

Every event on this stream carries an SSE id. If the connection drops, reconnect to the same URL and send the last id you received in the standard Last-Event-ID header. Delivery continues from that point instead of replaying the run from the beginning.
A browser EventSource client does this for you: it tracks the last id and sends the header on reconnect automatically.
A run that had begun answering and then starts its answer again emits a STREAM_ROLLBACK event telling you which events to discard. Handle it if you render answer text as it arrives — see STREAM_ROLLBACK.

Cancel a run

POST /v1/workflow/execute/async/{execution_id}/cancel stops a running workflow. The response reports the run’s status once the cancellation was applied, so you do not need to poll afterwards.
Cancelling is safe to repeat. A run that finished while your request was in flight reports completed or error instead of cancelled. A cancelled run keeps whatever it had produced, and you can continue it later.

Continue a run that stopped early

A run that stopped before it finished — one you cancelled, or one that ended in an error — can be continued from where it stopped. Pass its execution_id in the submit body:
The run picks up from its last saved point rather than starting over, and keeps the same execution_id.
This is a resume, not a follow-up turn. A run that is still pending or running cannot be continued, and neither can one that already completed. Both return 409. To start another piece of research, submit a new run.

Stored runs and retention

Every submitted run is stored, so you decide how long to keep it. List your runs, retrieve any one of them, and delete the ones you no longer need:
  • GET /v1/workflow/executions — your runs, newest first
  • GET /v1/workflow/executions/{execution_id} — one run with its full result
  • DELETE /v1/workflow/executions/{execution_id} — remove a run permanently
Deleting a run that is still in progress stops it first. There is no undo. Execution history covers these endpoints in full.

Error responses

Alongside the usual HTTP errors, the stream and cancel endpoints share one error contract: On submit, 409 means something different: the execution_id you asked to continue cannot be continued, because it is still in progress or has already completed.

Next steps

Execution history

List, retrieve, and delete your stored runs.

Streaming responses

Every message type the stream can emit, and a handler that dispatches on type.

Creating templates

Template anatomy, input placeholders, content filters, and research plans.

Conversation continuity

How execution_id compares with Research Agent chats and checkpoints.