/ v1/ workflows/ {id}/ streamReal-time event stream (WebSocket)
Upgrades the connection to a WebSocket. The server pushes RunEvent objects as JSON text frames as the workflow executes.
Subscribe before starting — open the WebSocket connection before calling POST /command with "start" to ensure you receive all events from the beginning.
Event types you will receive:
| Type | When | |------|------| | step_started | A step has been dispatched | | step_completed | A step finished successfully; data.result holds the output | | step_failed | A step failed; data.error describes the failure | | human_task_created | A human_task step created a pending task; run is now paused | | human_task_completed | A human submitted a decision; run is resuming | | run_completed | All steps finished; data.outputs holds the final outputs | | run_failed | The run terminated with an error | | run_paused | The run was paused via a pause command | | run_cancelled | The run was cancelled |
JavaScript example:
const ws = new WebSocket(
'wss://api.agentruntime.io/v1/workflows/wf_01hw3k9x4v8m/stream?run_id=run_01hw3k9x4v8m',
[],
{ headers: { Authorization: 'Bearer <your-api-key>' } }
);
ws.onmessage = (event) => {
const e = JSON.parse(event.data);
console.log(e.type, e.data);
if (e.type === 'run_completed') ws.close();
};Server
API key obtained from the AgentRuntime dashboard. Pass as Authorization: Bearer <key> on every request.
Stored only in this page session. It is not saved to local storage.
Runs from your browser. Non-GET requests require explicit confirmation and tokens are sent only when you click Send.
Enter a bearer token to enable testing.
curl -sS -X GET \
'https://api.agentruntime.io/v1/workflows/{id}/stream' \
-H 'Authorization: Bearer <token>'Responses
- 101WebSocket upgrade successful. Events will be pushed as JSON text frames.
- 401Missing or invalid Bearer token.
application/json
errorrequiredstring
Human-readable description of what went wrong.
Example:
"workflow not found"codestring
Machine-readable error code for programmatic handling.
Example:
"NOT_FOUND"
Example response
{ "error": "unauthorized", "code": "UNAUTHORIZED" } - 404The requested resource does not exist.
application/json
errorrequiredstring
Human-readable description of what went wrong.
Example:
"workflow not found"codestring
Machine-readable error code for programmatic handling.
Example:
"NOT_FOUND"
Example response
{ "error": "workflow not found", "code": "NOT_FOUND" }