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.
<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). Install the devtools panel covers the other setups and the npm package.


What the panel is
Section titled “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:
- It defines
<weft-devtools>, so markup already in the page upgrades. - It watches
window.__WEFT__, the global a single-page app sets to switch conversations. - It reads its configuration:
<meta name="weft:…">tags and its own script tag. - It mounts the dock, unless the page has its own
<weft-devtools>or the tag saysdata-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). 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
Section titled “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 explains each tab.
What it follows
Section titled “What it follows”The panel follows a scope: a conversation’s 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 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
Section titled “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
Section titled “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. 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-scopeattributes through oneMutationObserverand never writes your DOM. - The header rung wraps
window.fetchto read theWeft-Scoperesponse 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
Section titled “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). 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).
- It needs no Go code of its own. Studio’s
/panel.jsand/panel-config.jsonroutes serve it, and packagescopeis the optional Go side of the header rung.
Complete example
Section titled “Complete example”The docs example 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/:
go run ./devtoolsapp: 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 walks through the program.
Best practices & gotchas
Section titled “Best practices & gotchas”- Keep the panel and Studio on one version. The panel compares its version with
/api/meta’sstudio_versionand, when Studio is newer, saysStudio is newer than this panel; update panel.js. Loading/panel.jsfrom 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.jsships minified, with no sourcemap; its source isstudio/web/src/panelin 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 amount()call, it showsStudio not reachable at … · retryinstead. (Source:studio/README.md:1301-1330)
See also
Section titled “See also”- Install the devtools panel
- Scope the panel to a conversation
- Read a run in the panel
- Lay out and theme the panel
- Run Studio: embedded, local binary or hosted
Symbols used: thread.PublicID · studio.Handler