---
title: Watch runs live
description: 'Follow runs as they happen on Studio''s Live page, from the runs list''s follow toggle, or on the /api/live server-sent-events stream: selectors, kinds, frames, resume and the live grant.'
url: https://weftgo.dev/docs/observe/studio/live/
type: how-to
sources:
  - 'W11-auditB2-fix, v0.20.2: weft/studio/livegrant.go:104-133 (the grant binds the filter pairs and agent)'
  - 'weft/studio/README.md:23-27 (setup A''s live lane), 1813-1817 (the Live page derives a running row from event frames), 2354 (the /live page: the all stream, rows, stream states, backfill bound, attempt lines, polling, cancel, peek)'
  - weft/studio/web/src/routes/live.tsx:1-16 (the page), 73 (route), 84-86 (the polling line), 280-315 (the stream's state words)
  - weft/studio/web/src/lib/live-rows.ts:35-51 (a minute's grace, polling every 5 s, the backfill line)
  - weft/studio/web/src/components/studio/live-table.tsx:252-292 (columns)
  - weft/studio/web/src/routes/runs.index.tsx:293-363, 556-580 (follow, /api/live?agent=)
  - 'weft/studio/live.go:17-19 (frame ids, the (run, kind, pos) dedup), 122-202 (record, attempt and run frames), 204-262 (selectors, kinds), 434-575 (serveLive: Last-Event-ID, HEAD, X-Accel-Buffering, ping, overflow, expired), 706-713 (the all backfill: an hour, 500), 800-893 (backfill_error)'
  - weft/studio/livegrant.go:353-357 (the grant never outlives a panel token)
  - weft/studio/web/src/routes/live.tsx:477-481 (retry under stopped)
  - weft/studio/live.go:158-178 (the attempt frame's fields), 712-729 (resume replays the selector's stored records)
  - 'weft/studio/web/src/routes/runs.index.tsx:309-311 (follow: kinds run), 576-580 (streaming needs the server token · polling)'
  - 'weft/studio/livegrant.go:23-52 (POST /api/live-grant: a 60 s window, reusable)'
  - weft/studio/auth.go:251-258 (a token in the URL is never accepted), 572-587 (all needs the server token or setup A's loopback)
  - weft/AGENTS.md:346-349 (/api/live kinds, attempt frames, ?all=1, the resume backfill), 402-407 (EventSource opens /api/live with POST /api/live-grant's sig)
  - 'weft/CHANGELOG.md:292 (the attempt frame; ↻ attempt 1 failed), 310 (subagent rows under their parent, a minute''s grace, the session cell), 847 (the /live page on one all stream, peek, cancel), 984 (backfill_error), 1002 (GET /api/live?all=1, live_all), 3426 (write deadline, HEAD, X-Accel-Buffering), 4556 (GET /api/live: selector, kinds, Last-Event-ID, ping every 15 s, overflow)'
  - 'W11-auditB1-fix, v0.20.2: studio/web/src/routes/live.tsx:62-81 (LiveSearch q, agent), 132-153 (q written with replace), 216-229 (the agent chip), 461, 533 (agent matched exactly); studio/web/src/panel/element.ts:3008-3016 (the running dot links liveLink({agent}))'
  - 'observed: weft studio v0.17.0 /live during a running run; curl -N /api/live?agent=…&kinds=event,run against it (frames below)'
---

# Watch runs live

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](https://weftgo.dev/docs/observe/studio/setup/#embed-studio)).

## The live page

A row is one run: its id, the agent, the [status word](https://weftgo.dev/docs/observe/studio/runs/#status-words), and then:

| Column | Shows |
|---|---|
| step | The current step, "…" while a step runs; the total once the run ended |
| tokens | Input + output so far, summed from each finished step; "≥" when the page joined mid-run |
| cost | The run's own cost, under `pricing`: "—" while it runs (usage arrives at run end), the figure once the final run frame arrives |
| TTFT | Time to first token of the last finished step |
| started | When it started, and the time elapsed |
| session | The 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 cancel](https://weftgo.dev/docs/_astro/studio-live.light.CWmGMrI7.webp)

*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:

| Word | Means |
|---|---|
| connecting… | Asking for a live grant and opening the stream |
| ● live | The 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 up | Studio dropped this page's subscription when its queue overflowed: a fresh stream, then the running list |
| stopped | The 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](https://weftgo.dev/docs/reference/studio-urls/#live-and-settings-parameters).

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](https://weftgo.dev/docs/observe/playground/breakpoints/)).

### Without the all stream

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".

## Follow one agent from the runs list

On the [runs list](https://weftgo.dev/docs/observe/studio/runs/#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".

## Open the stream yourself

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

| Parameter | Values |
|---|---|
| selector | Exactly one of `run=<id>`, `session=<id>`, `public_id=<id>`, `agent=<name>` or `all=1`; none or two is a 400 |
| `kinds` | Comma-separated: `event`, `delta`, `messages`, `run`, `attempt`. Default `event,run` |

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

```sh
curl -N -H "Authorization: Bearer $TOKEN" \
  'http://127.0.0.1:7331/api/live?agent=slow-bot&kinds=event,run'
```

```text
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` |
|---|---|
| `record` | One 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` |
| `run` | The run's row, as `GET /api/runs` serves it, cost included |
| `attempt` | One 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` |
| `ping` | Every 15 s, so proxies keep the connection open; never a record |
| `overflow` | Studio dropped the subscriber (its queue overflowed) and closes the stream: refetch, then reconnect |
| `backfill_error` | A resume could not read one run's stored records: `{run_id, kind}` |
| `expired` | A 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.

### Open it from a browser

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):

```sh
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
```

```text
{"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.

## Best practices & gotchas

- **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)

## See also

- [Read a run in Studio](https://weftgo.dev/docs/observe/studio/run-page/)
- [Run Studio: embedded, local binary or hosted](https://weftgo.dev/docs/observe/studio/setup/)
- [Studio HTTP API](https://weftgo.dev/docs/reference/studio-api/)
- [Secure Studio](https://weftgo.dev/docs/production/security/)

Symbols used: [`studio.DB`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/studio#DB) · [`studio.Live`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/studio#Live) · [`studio.Open`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/studio#Open)
