anvil dev serves it automatically at /_anvil. In production, mount it yourself as middleware so you control who can reach it.
The dashboard reads from the same TraceStore you pass to your Tracer, so there is no separate sink to configure — traces written during a request are visible the moment the run ends.
What the dashboard shows
- Trace list — every agent run, sorted by most recent, with name, status badge, duration, token count, and cost.
- Span tree — drill into any trace to see the nested agent → model → tool → retrieval hierarchy, with per-span attributes (model, provider, token usage, tool inputs/outputs) and error details.
- Token usage and cost — rolled-up
totalInputTokens,totalOutputTokens, andtotalCostUsddisplayed per trace and per span.
Enabling in production with dashboardMiddleware
For deployed environments, importdashboardMiddleware from anvil/trace and add it to your root _middleware.ts:
dashboardMiddleware arguments
dashboardMiddleware accepts a TraceStore as its first argument and an optional DashboardOptions object as its second.
The first positional argument is the trace store to read from. Wire this to the same SqliteTraceStore (or other TraceStore) instance you passed to your Tracer, so the dashboard and the tracer share one underlying database.
DashboardOptions has one field:
The URL prefix at which the dashboard is mounted. The middleware intercepts all requests whose path starts with this value. Change it if
/_anvil conflicts with an existing route.Sharing the store with the Tracer
The dashboard and the tracer must point at the sameTraceStore instance. The idiomatic pattern is to open the store once at application startup and pass it to both:
Dashboard API routes
The middleware also exposes a small JSON API used by the built-in UI:| Route | Description |
|---|---|
GET /_anvil | Serves the self-contained dashboard HTML (no external assets) |
GET /_anvil/api/traces | Lists traces (spans omitted for payload efficiency). Accepts ?limit= |
GET /_anvil/api/traces/:id | Returns a single trace with the full span tree |