Skip to content

See your runtimes and where a command runs

View as Markdown

Studio’s Runtimes page, /runtimes, lists every app process that linked to it with runtime.Install: the ones connected now, the ones restored after a Studio restart and the ones that are gone. For each it says what Studio may do on the runs it starts and on the app’s own turns, and why not; each agent’s registered manifest against its latest run; and the breakpoints that park every run it starts. Every surface that starts a replay names the runtime it will run in, on a Runs in line, before Run.

Open it from the sidebar or the command palette, or from any runtimes ⤢ link. The same data is GET /api/runtimes:

Terminal window
curl -s -H "Authorization: Bearer $WEFT_STUDIO_TOKEN" http://127.0.0.1:7331/api/runtimes | jq '.runtimes[] | {id, service, pid, connected, restored}'

The page groups runtimes by state, with a count line at the top (“2 connected · 1 restored after restart · 1 gone”):

Studio's Runtimes page: the connected acme-app runtime with its process (host build-01, pid), cwd, weft version and dialled Studio, what Studio may do on the runs it starts and on the app's own turns (approve, steer, cancel, breakpoints), its acme-support agent with manifest and tools, and the breakpoint checkboxesStudio's Runtimes page: the connected acme-app runtime with its process (host build-01, pid), cwd, weft version and dialled Studio, what Studio may do on the runs it starts and on the app's own turns (approve, steer, cancel, breakpoints), its acme-support agent with manifest and tools, and the breakpoint checkboxes
A connected runtime: its process, cwd and dialled Studio, what Studio may do on the runs it starts and on the app's own turns, its agent and breakpoints.
StateMeans
connectedholds its command stream: experiments, approvals and breakpoints reach it
restored after restartlisted from Studio’s store after a Studio restart, waiting for the app to reconnect; nothing reaches it until it does
goneits stream is gone: the app stopped, or came back under another id; forget it once its commands resolve

Each runtime is a card that tells it apart from the others: its id, service and env, its process (host · pid), its working directory, the weft version it was built with, when it connected and was last seen, and the Studio its link dialled. Only the server token, or a request on setup A’s loopback, sees the working directory and the dialled URL; a panel token does not. Two connected links of one process (one host, pid and working directory) are drawn as one process, “one process · <host> · pid 2902 · 2 runtime links”. When two links register the same agent the card says “registered by more than one link: researcher — an experiment runs on the newest connected one”.

?runtime=<id> scrolls to a card. ?agent=<name> explains an agent that no connected runtime registers: either its app is not linked (start it with WEFT_ENV=dev and runtime.Install(…)), or its runtime.Agents(…) does not include the agent, or registers it under another name. The refusals elsewhere in Studio link there.

With no runtime at all the page reads “No runtime has registered: an app links with runtime.Install(…) under WEFT_ENV=dev (or runtime.Enabled(true)).” The page needs the playground: its capability is runtimes, off with --no-playground.

Each card has a table of the debugger’s verbs, on the runs the runtime starts (playground runs and replays) and on the app’s own turns of its service. Every “no” says why:

VerbOn runs it startsOn the app’s own turns
approveyes while connected and the playground capability is onneeds runtime.Sessions installed
steerthe steer capabilityneeds runtime.Sessions installed
cancelthe cancel capabilitynever: “cancel is not supported on an app turn”
breakpointsthe breakpoints capabilityneeds an agent built with runtime.Breakpoints()

Above the cards, the page explains /api/meta’s debug_scope. With own+runtime, the verbs act on runs a runtime starts and on the app’s own turns of a service whose connected runtime registered runtime.Sessions (approve, steer) or an agent built with runtime.Breakpoints() (breakpoints). With runtime-started runs, the app’s own turns are view-only: install runtime.Sessions to approve and steer them (Approve and steer your app’s own turns), and build an agent with runtime.Breakpoints() to park its own runs.

Each card lists its agents: the registered manifest’s hash, the latest run’s verdict, the models and the tools. A registration carries each agent’s manifest_hash, the sha256 of its registered manifest, the same value as the weft.manifest.hash its runs record (The manifest hash). Studio compares it with the hash the agent’s latest stored run carries, from /api/meta’s manifest_check.latest:

MarkMeans
currentthe latest run of this agent ran this manifest
stalethe latest run ran another manifest: the app runs another build than the one registered here (its title names the hash, “the latest run ran d2151022, not this manifest”)
other version ranthe latest run ran another registered version of this agent
uncheckedno stored run of this agent carries a manifest hash

The Agents page badges each agent card with the same mark, and the run header reads manifest <hash> · current or · stale from manifest_check alone. When a stale run’s weft version differs from the registered build’s, its title says the weft version changed and the manifest with it. Settings’ Runtimes section is a summary, manifest: checked N of M · stale K (…) naming the stale agents, with · differs D when services hold an agent in different versions, and a link here. A model with · resolver holds a runtime.ModelResolver: a model outside the list may be proposed, and the runtime decides before it acks.

Studio’s replay drawer and playground, and the devtools panel’s drawer, say before Run which runtime the command goes to:

Runs in: rt_0396… weft-arena-dev (pid 2902, seen just now) · runtimes ⤢

The runtime is the connected registration of the agent first, then the newest seen; a registration that is not connected is never a target. When two connected runtimes register the agent, a select names them apart in the same words as the line, rt_0396… weft-arena-dev (pid 2902, seen just now), and Studio adds “the newest connected of 2 registering researcher” while the first one is picked. The playground’s own runtime select labels each runtime <service> · <env> · pid N · N agents · rt_…, so two links of one process, or two replicas of one service, read apart.

When no connected runtime registers the agent, the line is the refusal, and Run is held on the replay drawer, the playground, an experiment’s cell re-runs and the source matrix:

Runs in: ✗ no connected runtime registers researcher · runtimes ⤢
connected: weft-arena-dev (support, orders)
fix: runtime.Install(…, runtime.Agents(researcher)) under WEFT_ENV=dev
asked http://127.0.0.1:7331 · rt_0396… weft-arena-dev chose http://127.0.0.1:7347

The last line names the Studio this page asked and, in Studio, each connected runtime whose link dialled another (rt_… <service> chose <url>): a runtime connected to a different Studio is why this one cannot run the command.

A 503 on Run reads the same refusal and fix. The panel draws no Runs in line while no agent is picked.

The runtime-wide breakpoints live on the card, under “breakpoints (parked on every run this runtime starts)”. Pick tools to park every call to them in every run the runtime starts; an agent built with runtime.Breakpoints() parks its own runs too (Pause runs at breakpoints). clear all removes the set. Picking every tool says “every tool is a breakpoint: every tool call of every run this runtime starts parks”. The editor needs the breakpoints capability, a connected runtime and at least one tool; otherwise the set is shown read-only, with why.

Under a non-empty set, a line says who set it:

breakpoints_byThe line
studio“set 4m ago through this Studio’s runtimes page”, or “set 4m ago through the API” with the route named (PUT /api/runtimes/{id}/breakpoints)
runtimeset by an earlier Studio: the runtime’s own registration carried it
storerestored from Studio’s store after a restart, with when and through which surface when it was stored

PUT /api/runtimes/{id}/breakpoints takes an optional surface, a short lowercase word; the page sends runtimes, and a PUT without one reads api. Studio keeps breakpoints_set_at and breakpoints_surface across a restart. The replay drawers and the playground carry no breakpoint setting of their own: they point here, “breakpoints for the whole runtime live on Runtimes”, with the count in force.

A runtime that is gone, or restored and never reconnected, has a forget button: it removes the runtime from the list and from Studio’s store. Its commands and run routes stay as history, and an app that comes back registers anew. A connected runtime is never forgotten. Over the API:

Terminal window
curl -s -X DELETE -H "Authorization: Bearer $WEFT_STUDIO_TOKEN" http://127.0.0.1:7331/api/runtimes/rt_0396d1e2
AnswerWhen
204forgotten: its row and breakpoint set are removed from memory and the command store
404an id nothing registered
409it is connected (runtime … is connected: only a runtime that is gone is forgotten), or a queued or accepted command is addressed to it (… still has queued or accepted commands: forget it once they resolve)
403any panel token: forgetting changes Studio’s list for everyone

The capability is runtime_forget, off with the playground. In Go, RuntimeServer.Forget does the same and returns ErrConnected or ErrRuntimeBusy; a third-party obsdb.CommandStore implements DeleteRuntime for it.

GET /api/runtimes answers {"runtimes": [...]}, one object per runtime. The fields the page reads:

FieldMeans
id, host, pid, service, envthe registration
cwd, studio_urlthe working directory and the Studio the link dialled (credentials, query and fragment stripped; absent in-process); both absent to a panel token
weft_versionthe weft the runtime was built with
connected_since, last_seenUTC times
connected, restoredthe state: restored marks one listed from the store after a Studio restart
sessions, breakpoints_ownit registered runtime.Sessions; one of its agents was built with runtime.Breakpoints()
breakpoints, breakpoints_set_at, breakpoints_surface, breakpoints_bythe runtime-wide set and where it came from
agents[]name, manifest_hash, model_provider, models, resolver, defaults and tools[] (name, side_effects, allow, and approval: true for a RequireApproval tool)

An agent’s manifest_hash is the registration’s, else Studio hashes the registered manifest, so an older runtime’s agents carry one too. model_provider is the provider the agent’s own model names in its manifest.

GET /api/meta adds what the page needs from Studio itself: debug_scope, manifest_check (source, agents, checked, stale, differs, latest) and runtime_link, this Studio process’s own runtime link: in_process when it is runtime.Local(srv) or an HTTP link to this same server, else studio_url, the Studio it dialled. runtime_link is absent when no link is open, and to a panel token.

  • Forget a runtime only after its commands resolve. A queued or accepted command addressed to it keeps it (409), so a forget never strands a command. (Source: studio/debugger.go serveForgetRuntime)
  • Read “stale” as another build, not an error. The latest run ran a manifest other than the registered one: the app you run now is not the build that recorded it. Regenerate weft.json when you keep one (Describe your agents). (Source: lib/runtimes.ts MANIFEST_WORDS)
  • Restart the app, not Studio, to bring a restored runtime back. A restored runtime receives nothing until its app reconnects and registers again. (Source: lib/runtimes.ts STATE_WORDS)
  • Name the agent in runtime.Agents(…) by the name its runs record. A replay targets agents by name, and a refusal names the one no connected runtime registers. (Source: lib/runs-in.ts RUNS_IN, lib/runtimes.ts missingWords)

Symbols used: runtime.Install · runtime.Sessions · runtime.Breakpoints · runtime.ModelResolver · RuntimeServer.Forget · obsdb.CommandStore