All systems operational--:--:-- UTC

Streaming

Watch agent runs live with server-sent events, including tokens, tool calls and approvals.

On this page

Agent runs can be streamed so operators and your own interfaces see progress as it happens. Streams use server-sent events (SSE) over HTTPS.

Open a stream

curl -N https://api.consciouslab.xyz/v1/agents/runs/run_7Hq2xV/stream \
  -H "Authorization: Bearer $CL_API_KEY" \
  -H "Accept: text/event-stream"
event: step.started
data: {"step":3,"kind":"model","model":"cl-reason-2"}

event: token
data: {"step":3,"text":"Damaged pallet confirmed by scan RX-4471."}

event: tool.called
data: {"step":4,"tool":"refund.issue","args":{"amount":182.40,"currency":"EUR"}}

event: approval.required
data: {"step":4,"policy":"refunds.max_eur","approvers":["role:support-lead"]}

Event types

EventWhen
step.startedA model or tool step begins
tokenModel output, in chunks
tool.calledThe agent called a tool, with arguments
tool.resultA tool returned, with latency
approval.requiredThe run paused at a gate
approval.decidedSomeone approved, rejected or amended
run.finishedThe run reached a terminal state

TypeScript

const run = await cl.agents.run('support-triage', { input });

for await (const ev of run.stream()) {
  if (ev.type === 'token') process.stdout.write(ev.text);
  if (ev.type === 'approval.required') notifyOnCall(ev);
}

The SDK reconnects automatically using the Last-Event-ID header, so a dropped connection resumes without losing events.

Joining a run in progress

Streams replay all events from the start of the run before switching to live, so you can open a stream at any point. Pass ?from=live to skip the replay.

Limits

Each run allows up to 20 concurrent stream connections. Streams close 60 seconds after the run finishes. Idle connections receive a comment line every 15 seconds to keep proxies from timing out.