Devtools server
Expose a live feed of agent events so any browser extension or custom dashboard can inspect a running agent.
The AgentsKit devtools server is a transport-agnostic pub/sub hub for agent events. Plug it into your runtime as an observer; attach any transport (SSE response, WebSocket, in-process sink) as a client. New clients get a replay of the recent ring buffer so they can jump in mid-session. The envelope shape is the contract a browser extension (or your own dashboard) speaks against.
#Install
Comes with @agentskit/observability.
#Wire it up
import { createDevtoolsServer } from '@agentskit/observability'
import { createRuntime } from '@agentskit/runtime'
import { anthropic } from '@agentskit/adapters'
export const devtools = createDevtoolsServer({ bufferSize: 500 })
export const runtime = createRuntime({
adapter: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY!, model: 'claude-sonnet-4-6' }),
observers: [devtools.observer],
})devtools.observer receives every AgentEvent the runtime emits and
fans it out to every attached client.
#Expose over SSE (Node http example)
import { createServer } from 'node:http'
import { toSseFrame } from '@agentskit/observability'
import { devtools } from './runtime'
createServer((req, res) => {
if (req.url !== '/agentskit/devtools') {
res.statusCode = 404
res.end()
return
}
res.writeHead(200, {
'content-type': 'text/event-stream',
'cache-control': 'no-cache',
connection: 'keep-alive',
})
const detach = devtools.attach({
id: `c-${Date.now()}`,
send: envelope => res.write(toSseFrame(envelope)),
close: () => res.end(),
})
req.on('close', detach)
}).listen(4999)Point your browser extension at http://localhost:4999/agentskit/devtools
and it receives:
{ type: 'hello', protocol: 1, serverId, since }- One
{ type: 'agent-event' }per retained event { type: 'replay-end', seq }- Live feed of new
agent-eventenvelopes
#Protocol
type DevtoolsEnvelope =
| { type: 'hello'; protocol: 1; serverId: string; since: string }
| { type: 'agent-event'; seq: number; at: number; event: AgentEvent }
| { type: 'replay-end'; seq: number }seq is monotonic per server, at is Date.now() at publish time.
#Programmatic access
No browser needed β devtools.buffer() returns a snapshot of retained
events for in-process assertions, tests, or CLI tools.
#See also
- Console logger β simpler observability for local runs
- Cost guard β hard $ ceiling
Explore nearby
- PeerRecipes
Copy-paste solutions grouped by theme. Every recipe end-to-end, runs as written.
- PeerCustom adapter
Wrap any LLM API as an AgentsKit adapter. Plug-and-play with the rest of the kit in 30 lines.
- PeerAdapter contract tests
Verify any adapter against the ADR 0001 invariants A1βA10 with the shared test harness.