Skip to content

Watch runs live

View as Markdown

The Live page (/live) lists every run that is running now and updates each row as its events arrive: the current step, tokens so far, time to first token and, once it ends, its cost. It reads one server-sent-events stream, GET /api/live, which you can also open yourself, scoped to one run, session, public id or agent. In setup A the stream follows the recorder’s own database handle, with no network in between (Run Studio).

A row is one run: its id, the agent, the status word, and then:

ColumnShows
stepThe current step, ”…” while a step runs; the total once the run ended
tokensInput + output so far, summed from each finished step; ”≥” when the page joined mid-run
costThe run’s own cost, under pricing: ”—” while it runs (usage arrives at run end), the figure once the final run frame arrives
TTFTTime to first token of the last finished step
startedWhen it started, and the time elapsed
sessionThe session’s short id, the public id under it
Studio's Live page with one running run: ● live, 1 running, an ops-watch turn of session pub_ops_watch started seconds ago, with peek and cancelStudio's Live page with one running run: ● live, 1 running, an ops-watch turn of session pub_ops_watch started seconds ago, with peek and cancel
The Live page with one run in progress: an ops-watch turn of session pub_ops_watch, running, with peek.

A child run sits under its parent, indented. A run that ended stays a minute, dimmed, then drops; a reload lists the runs that ended in the last minute. While a step retries, a line under it says so (”↻ attempt 1 failed”, the error type and the provider’s wait in its hover; “ok on attempt 2” after), read from each attempt span as it lands.

The header says how the stream stands:

WordMeans
connecting…Asking for a live grant and opening the stream
● liveThe stream is open; rows update as frames arrive
reconnecting…The stream dropped; the browser resumes it and the running list is read again
overflow — catching upStudio dropped this page’s subscription when its queue overflowed: a fresh stream, then the running list
stoppedThe stream gave up reconnecting; the rows are as last seen, and a retry button opens it again

A reconnect resumes where it left off, and Studio backfills the runs running or seen in the last hour, newest 500. A run whose history the resume could not read gets a “could not read” gap badge.

The filter agent or status box narrows the rows. A status word (running, failed, cancelled, parked, …) matches by its key, so failed does not match a cancelled run; any other text matches the agent or the shown word.

Since 0.20.0 the filter is part of the URL, so a shared link opens filtered. The box’s words are ?q=, written as you type without new history entries. ?agent=<name> keeps one agent’s runs, matched exactly, and shows an agent <name> × chip that clears it. While a turn runs, the devtools panel’s running dot links to /live?agent=<agent>. Every key is in Studio pages, URL parameters and keyboard.

Click a row, or its peek, to open that run’s story beside the list in a resizable pane (?peek=<run id>); Escape or the close button closes it.

Under the cancel capability, a run the playground started has a cancel button: the first click arms it for 3 seconds, the second posts POST /api/runs/{id}/cancel and the row reads “cancelling…” until the run ends, or for 30 s, after which the button returns as “no end seen — cancel again”. Your app’s own runs show it disabled (“cancel is not supported on an app turn”), and a parked run’s says “parked — decide instead”, linking the run page (Pause runs at breakpoints, then steer or cancel them).

The page’s stream is GET /api/live?all=1, every run in the database. It is open to the dev token, or with no token to a loopback Host; /api/meta’s live_all says whether this caller may. Under a panel token the page polls the running list every 5 s instead and says “live: polling every 5 s — the all stream needs the dev token or loopback”.

On the runs list, set an agent filter and press follow: the list subscribes to /api/live?agent=<name>&kinds=run and updates each listed row from its run frames as that agent’s runs start and finish. Child runs stay out unless the list shows them. When the stream is refused (a panel token), follow polls every 5 s instead and says “streaming needs the server token · polling”.

GET /api/live is a text/event-stream. It takes exactly one selector and, optionally, the kinds of frame to send:

ParameterValues
selectorExactly one of run=<id>, session=<id>, public_id=<id>, agent=<name> or all=1; none or two is a 400
kindsComma-separated: event, delta, messages, run, attempt. Default event,run

With a bearer token, curl opens it directly (-N turns off output buffering):

Terminal window
curl -N -H "Authorization: Bearer $TOKEN" \
'http://127.0.0.1:7331/api/live?agent=slow-bot&kinds=event,run'
id: 19905
event: record
data: {"run_id":"2410b8cd50ca887935c80a7a5810d1d3","session_id":"","public_id":"","kind":"event","pos":0,"time":"2026-10-18T01:08:09.473935414Z","trace_id":"996279e50784af96060d317d481228dd","span_id":"92ffd5f42909bfaa","event":{"type":"run_start",…}}
id: 19911
event: record
data: {"run_id":"2410b8cd50ca887935c80a7a5810d1d3",…,"kind":"event","pos":2,…,"event":{"type":"tool_start","run_id":"2410b8cd50ca887935c80a7a5810d1d3","seq":1,"call_id":"c1","name":"slow_lookup","args":{"n":1}}}
id: 19919
event: run
data: {"run":{"id":"2410b8cd50ca887935c80a7a5810d1d3",…,"agent":"slow-bot",…}}

The frames:

event:data
recordOne record as ingested: run_id, session_id, public_id, kind (event, delta or messages), pos, time, trace_id, span_id, and the record’s body under event
runThe run’s row, as GET /api/runs serves it, cost included
attemptOne try inside a model call, from its attempt span the moment it lands: run_id, session_id, public_id, step, attempt, layer, status (ok or error), error_type, provider, model, wait_ms, retry_after_ms, start, end, trace_id, span_id
pingEvery 15 s, so proxies keep the connection open; never a record
overflowStudio dropped the subscriber (its queue overflowed) and closes the stream: refetch, then reconnect
backfill_errorA resume could not read one run’s stored records: {run_id, kind}
expiredA panel token’s stream reached the token’s expiry

Each live record, run and attempt frame’s id is the hub’s sequence number, the resume cursor; backfilled frames and the ping, overflow, backfill_error and expired frames carry no id. Reconnect with Last-Event-ID and Studio replays every stored event and messages record the selector covers (not only the gap you missed), then the live frames. It deduplicates on run, kind and position within the connection, so every durable record arrives once per connection; fold what you receive on the same key. Deltas are never stored, so they are never backfilled, and neither are attempt frames. An all=1 resume backfills the runs running or last seen in the past hour, newest 500.

The stream sends X-Accel-Buffering: no, so an nginx proxy does not hold frames back, and a HEAD request answers the headers only. Each frame’s write has a deadline: a client that stops reading without closing is dropped instead of holding the stream open.

A token is never accepted in the URL: ?token= is a 401 on every /api route. A browser’s EventSource cannot set headers, so it asks for a grant first, with its bearer (or setup A’s open loopback):

Terminal window
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"agent":"slow-bot","kinds":"event,run"}' http://127.0.0.1:7331/api/live-grant
{"sig":"weft_lg.…","exp":"2026-10-18T00:56:44.42781215Z"}

Then it opens /api/live?agent=slow-bot&kinds=event,run&sig=<sig>. The signature binds who asked, the selector, the kinds, any tag.<k> or flow filter and narrowing agent (0.20.0), and the expiry: 60 s after the grant, never past a panel token’s own expiry. Within that window any number of streams may open with it, since EventSource reconnects with the same URL; each stream then runs until it is closed, a panel token’s until the token expires.

all=1 needs the dev (server) token, or setup A on a loopback Host: every panel token gets a 403, on the stream and on the grant.

  • Pass the recorder’s handle to embed Studio live. With studio.Open or the default path, Studio reads a second handle on the file: history works, but the live lane does not see the app’s writes. (Source: studio.DB and studio.Live godoc)
  • Read cost after the run ends. A running run’s own cost is unknown; the final run frame carries it. (Source: studio/README.md:1813-1817)
  • Handle overflow by refetching. The stream closes after it; reconnecting with Last-Event-ID backfills the stored records. (Source: studio/live.go:551-565)
  • Ask for delta only when you render streaming text. Deltas are never stored or backfilled, and a full destination queue drops them first. (Source: studio/live.go:714-724; AGENTS.md block 9)

Symbols used: studio.DB · studio.Live · studio.Open