---
title: What is the devtools panel?
description: 'The devtools panel is Studio''s view of one conversation, drawn in a corner of your own app''s page: its turns, steps, tool calls and timing, read live from Studio''s API.'
url: https://weftgo.dev/docs/observe/devtools/overview/
type: concept
sources:
  - weft/studio/web/src/panel/layout.ts:51-52 (tab labels story, request, waterfall, raw)
  - 'weft/studio/web/src/lib/scope.ts:53-87 (tag.<k>=<v> and agent= keys; a scope without a public id); weft/studio/web/src/panel/config.ts:478-500 (no scope named: a panel token''s claims, public id and tags, become the scope); weft/studio/web/src/panel/element.ts:2452-2468 (a bare loopback tag logs one console line); weft/CHANGELOG.md:46 (0.20.0: Agent and Tags in a scope)'
  - 'weft/studio/README.md:398-477 (one script tag; what rung 1 shows: turns, the step story, attempts and timing, approvals, honesty, raw JSON, live tail, deep links, subagents, waterfall)'
  - 'weft/studio/README.md:500-510 (the four tabs: Story, Request, Timeline, Raw)'
  - weft/studio/README.md:862-927 (data-endpoint and data-token for setups B and C; the scope a panel follows)
  - 'weft/studio/README.md:1078-1107 (the fallback: no conversation detected; the activity pill)'
  - 'weft/studio/README.md:1301-1330 (no Studio answering: the self-mounted dock removes itself off loopback; 401/403 never removed)'
  - weft/studio/README.md:1330-1352 (studio/dist/panel/panel.js, 294,632 B raw, minified, no sourcemap)
  - weft/studio/README.md:1420-1434 (the same file on npm as @weftgo/devtools, a second delivery)
  - weft/studio/README.md:1456-1462 (the host API, window.weft.devtools the one global)
  - 'weft/AGENTS.md:354-400 (block 7: /panel.js, its host API, layout, theme, views, the scope ladder, the pill, the npm package)'
  - 'weft/studio/web/src/panel/main.ts:1-13 (the entry: define <weft-devtools>, watch window.__WEFT__, read the ladder, mount the dock; fail silent)'
  - weft/studio/web/src/panel/element.ts:523 (NO_SCOPE_LABEL), 4027 (Studio is newer than this panel; update panel.js)
  - 'weft/studio/web/npm/README.md:11-30 (one UI: the custom element in its shadow DOM; versioned with the backend)'
  - weft/studio/panel.go:26-58 (panel.js embedded, GET /panel.js)
  - weft/CHANGELOG.md:2288 (weft/scope, the Go side of the scope, since 0.12.0)
  - 'weft/scope/scope.go:1-48 (package doc: the Go side of the devtools'' Scope)'
  - weft/studio/panelconfig.go:34-45 (panel-config.json on every studio.Handler)
  - 'weft/studio/web/src/panel/config.ts:537-555 (headerRungOn: loopback page and endpoint, no weft_pt. token)'
  - 'observed: weft studio v0.17.0 (WEFT_DISCOVERY=off) and docs-site/examples/devtools in Chromium (Playwright 1.62.0): the dock mounts from one script tag, says no conversation detected on this page until the first chat response names one, then follows pub_demo'
  - weft/studio/web/src/panel/state.ts:2055-2068 (a fetchMeta failure sets gone; 401/403 walled, never removed — v0.20.2); weft/studio/web/src/panel/element.ts:2276-2290 (the self-mounted dock removed, a mount the host made shows the not-reachable line)
---

# What is the devtools panel?

The devtools panel is Studio's view of one conversation, drawn in a corner of your own app's page. One script tag loads it from Studio's `/panel.js`. It shows the turns of the conversation the page is having, each step's story with its tool calls, usage and timing, and a live tail of the running turn. It reads Studio's API, so it needs a Studio to talk to and records nothing itself.

```html
<script type="module" src="/studio/panel.js" data-weft></script>
```

That tag is the whole install for a Go app that embeds Studio at `/studio/` ([setup A](https://weftgo.dev/docs/reference/glossary/#setup-a-b-c)). [Install the devtools panel](https://weftgo.dev/docs/observe/devtools/install/) covers the other setups and the npm package.

![The weft devtools panel docked on the right of an app page, its Story tab showing a step's tool calls and their errors](https://weftgo.dev/docs/_astro/panel-docked-right.light.BuHdPlbl.webp)

*The panel docked on the right of an app's page, on its story tab.*

## What the panel is

The panel is one custom element, `<weft-devtools>`, which draws itself inside its own shadow DOM. Your page's CSS does not reach it, and its CSS does not reach your page. The element is defined by one ES module, `panel.js`, which Studio's handler serves at `<base>/panel.js` with no token. The file is embedded in the `studio` package, so a Studio of version X serves the panel of version X. The same bytes ship in the npm package `@weftgo/devtools`, for apps that bundle their JavaScript instead of loading script tags.

When the module loads, it does four things in order:

1. It defines `<weft-devtools>`, so markup already in the page upgrades.
2. It watches `window.__WEFT__`, the global a single-page app sets to switch conversations.
3. It reads its configuration: `<meta name="weft:…">` tags and its own script tag.
4. It mounts the dock, unless the page has its own `<weft-devtools>` or the tag says `data-auto="false"`.

The panel then asks Studio's `/api/meta`. If no Studio answers, the dock it mounted by itself removes itself, unless you named a loopback endpoint ([When the panel does not connect](https://weftgo.dev/docs/observe/devtools/install/#when-the-panel-does-not-connect)). Your page loses nothing when Studio is down. A Studio that refuses the token (a 401 or 403) is there, so since 0.20.0 the panel stays and says which token it wants.

### What it shows

Inside the panel, the open turn has four tabs:

| Tab | What it shows |
|---|---|
| story | The steps of the turn: what the model was sent and replied, each tool call and its result, the step's attempts and timing ("attempt 4 of 4 · fallback to glm-b", "1.2 s · first token 180 ms"), approvals, and each child run inline at any depth |
| request | One step's request: the prompt, the messages, the tool catalog and the parameters |
| waterfall | The run's spans on a time axis (Timeline before 0.20.0), or its steps in event order when it has no spans |
| raw | The run's JSON, as a tree you can filter and copy |

A badge marks anything the recording does not hold: a truncated result, a gap, content stripped by a content-off destination. ⤢ links open the same run, at the same step, in Studio. [Read a run in the panel](https://weftgo.dev/docs/observe/devtools/reading-runs/) explains each tab.

### What it follows

The panel follows a [scope](https://weftgo.dev/docs/reference/glossary/#scope): a conversation's [public id](https://weftgo.dev/docs/reference/glossary/#public-id), and optionally the session, flow and run inside it, written `pub_…;session=…;flow=…;run=…`. The public id is the one your app gave its `thread` session with `thread.PublicID`. Its runs carry it as `weft.public_id`, and the panel lists them as the conversation's turns.

Since 0.20.0 a scope may also name a page of unrelated runs, with or without a public id. `tag.<k>=<v>` matches a run's metadata pair; repeat it to require several. `agent=` narrows to one agent. `;tag.arena.batch=b1` is a whole scope.

The page names the scope, or the panel detects it: from `data-scope` on the tag, from the `Weft-Scope` header your chat handler sets, from a `data-weft-scope` attribute on the chat's element, or from the page URL. Since 0.20.0, when nothing names a scope, a panel token's claims become it: its public id and its tags. With none of these, the header reads `no conversation detected on this page · how to scope` and lists the newest runs. [Scope the panel to a conversation](https://weftgo.dev/docs/observe/devtools/scope/) is the whole ladder.

While a run of the conversation runs, the collapsed dock (the pill) pulses and shows the live step count, `● 3`.

## Panel or Studio

The panel and Studio read the same database through the same JSON API and the same live stream. They differ in how much they show and where:

| Aspect | The panel | Studio |
|---|---|---|
| Where | A corner or a side of your app's page | Its own pages, at `<base>` |
| What | One conversation: the scope the page names | Every run, session and trace in the database |
| Finds runs by | The scope (public id, session, run) | Lists, search, filters, ⌘K |
| Extra | Replay verbs, and deciding your app's parked turns | The run page, compare, cost, settings, the playground, export |
| Loaded by | `<script src=…/panel.js>` or `@weftgo/devtools` | `studio.Handler`, `weft studio` or `weft dev` |

The panel is for the developer who is using the app: ask a question in your own chat, and the turn it started is open beside it. Studio is where you go for everything else, and the panel's ⤢ links open the same run there.

### What the panel does to your page

The panel adds one element and, under the script tag, one global, `window.weft.devtools`, its [host API](https://weftgo.dev/docs/observe/devtools/host-api/). `data-global="off"` keeps that global off; the npm package never adds it. Two of the scope rungs read your page's DOM or its traffic:

- The DOM-marker rung reads `data-weft-scope` attributes through one `MutationObserver` and never writes your DOM.
- The header rung wraps `window.fetch` to read the `Weft-Scope` response header. It is on by default only when the page and Studio are both on loopback and the panel has no panel token (`weft_pt.`), and it is put back as found when the panel disconnects.

Neither rung reads a response body.

### What the panel does not do

- It is not a recorder. The runs it shows were recorded by your app's pipeline ([Record your runs](https://weftgo.dev/docs/observe/recording/)). A run that was never recorded never appears.
- It is not a security boundary. Studio enforces what a token may read on every route. In a page you ship, the panel carries a per-page panel token ([Secure the devtools panel](https://weftgo.dev/docs/observe/devtools/security/)).
- It needs no Go code of its own. Studio's `/panel.js` and `/panel-config.json` routes serve it, and package [`scope`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/scope) is the optional Go side of the header rung.

## Complete example

The docs example [`docs-site/examples/devtools`](https://github.com/weftgo/weftgo.dev/tree/main/docs-site/examples/devtools) is a Go app that embeds Studio, serves a chat page with the script tag above, and sets the `Weft-Scope` header on its chat responses. Run it and open `http://127.0.0.1:8080/`:

```sh
go run ./devtools
```

```text
app: http://127.0.0.1:8080/  ·  studio: http://127.0.0.1:8080/studio/
```

The dock mounts and reads `no conversation detected on this page`. Ask a question: the response carries `Weft-Scope: pub_demo;run=…`, and the panel follows that conversation and pins that turn. [Install the devtools panel](https://weftgo.dev/docs/observe/devtools/install/) walks through the program.

## Best practices & gotchas

- **Keep the panel and Studio on one version.** The panel compares its version with `/api/meta`'s `studio_version` and, when Studio is newer, says `Studio is newer than this panel; update panel.js`. Loading `/panel.js` from the Studio you talk to keeps them equal. (Source: `studio/web/npm/README.md:22-27`; `studio/web/src/panel/element.ts:4027`)
- **Read the source, not the bundle.** `panel.js` ships minified, with no sourcemap; its source is `studio/web/src/panel` in weft's repository. (Source: `studio/README.md:1330-1352`)
- **Expect silence when Studio is down off loopback.** The self-mounted dock removes itself without a line on the page. A bare tag whose guessed endpoint is on loopback logs one console line. On a loopback endpoint you named, and for a `<weft-devtools>` you wrote or a `mount()` call, it shows `Studio not reachable at … · retry` instead. (Source: `studio/README.md:1301-1330`)

## See also

- [Install the devtools panel](https://weftgo.dev/docs/observe/devtools/install/)
- [Scope the panel to a conversation](https://weftgo.dev/docs/observe/devtools/scope/)
- [Read a run in the panel](https://weftgo.dev/docs/observe/devtools/reading-runs/)
- [Lay out and theme the panel](https://weftgo.dev/docs/observe/devtools/layout-and-theme/)
- [Run Studio: embedded, local binary or hosted](https://weftgo.dev/docs/observe/studio/setup/)

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