Developers

Messages, runs and streaming.

Follow a session as it works, send it more, and read each run's result, duration and tokens.

Send a message

A message wakes a paused or archived session first. It can carry images and files, or be files alone. A message sent while the agent works reaches the running turn at its next step.

Terminal
curl -X POST -H "Authorization: Bearer $OUTRUNNER_API_KEY" -H "Content-Type: application/json" \
  "$OUTRUNNER/api/v1/workspaces/$ID/messages" -d '{ "content": "Also add a test for it." }'
Response
{ "result": "sent", "after_event": "48213", "run_id": "48290" }

Stream what it does

GET /workspaces/{id}/stream holds a Server-Sent Events stream open and sends what the session does as it happens. GET /workspaces/{id}/runs/{run_id}/stream sends one run's events and ends with its result.

Terminal
curl -N -H "Authorization: Bearer $OUTRUNNER_API_KEY" -H "Accept: text/event-stream" "$OUTRUNNER/api/v1/workspaces/$ID/stream"
Stream
id: 48290
event: prompt
data: {"run_id":"48290","text":"Also add a test for it."}

id: 48733
event: tool_call
data: {"call_id":"toolu_…","name":"Bash","status":"running","args":{"command":"pnpm test"}}

id: 51877
event: assistant
data: {"uuid":"…","text":"Added checkout.test.ts; all 41 pass."}

id: 51877
event: result
data: {"run_id":"48290","status":"finished","text":"Added checkout.test.ts; all 41 pass.","duration_ms":84120}
Event
statusWhere the turn is: working, needs_input, idle, or preparing while the session is set up
promptA run began
assistantWhat the agent said
tool_callA tool call: running, then completed with its result
needs_inputIt asked a question or for secrets
resultA run ended: its status, last words, duration and tokens
heartbeat, error, doneEvery 15 seconds; the stream failed; it ended

Reconnect with the last event's id as Last-Event-ID to go on where you left off. A stream lasts up to 15 minutes, then ends with done and "reconnect": true.

Runs

A run is a prompt and what the agent did for it, up to the next. Each has a status (running, needs_input, finished, cancelled or error), its result (the last thing it said), duration_ms, and the tokens it spent.

Terminal
curl -H "Authorization: Bearer $OUTRUNNER_API_KEY" "$OUTRUNNER/api/v1/workspaces/$ID/runs/$RUN"
curl -H "Authorization: Bearer $OUTRUNNER_API_KEY" "$OUTRUNNER/api/v1/workspaces/$ID/usage"

Or wait for it

Without a stream, GET /workspaces/{id}/wait?after_event=… holds the call until the turn is over or needs input, up to 10 minutes, and answers with the session and its turn. Pass the after_event a message answered with, so it never mistakes the quiet before the turn for its end.

Questions, secrets and plans

While the agent waits on you, the turn is needs_input, and pending_input says for what. Answer a question with POST /workspaces/{id}/answer, give secrets it asked for with POST /workspaces/{id}/secrets, and approve a plan with POST /workspaces/{id}/plan/approve.

Something unclear? Let us know ↗