Loading component…
Loading component…
A multi-agent run's call stack as a flame graph – the orchestrator on top, then subagents and their LLM and tool calls, every block as wide as it took.
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AgentFlameGraph from ./agent-flame-graph.
import { AgentFlameGraph, type FlameNode } from "@/components/ui/agent-flame-graph";
const run: FlameNode = {
id: "orchestrator", name: "Orchestrator", kind: "agent", model: "claude-opus-4.5", start: 0, end: 134_000,
children: [
{
id: "coder", name: "Coder", kind: "agent", start: 52_500, end: 123_500,
children: [
{
id: "c-1", name: "claude-sonnet-4.5", kind: "llm", start: 53_000, end: 64_000,
tokens: 30_900, cost: 0.58, icon: <ClaudeLogo />, detail: "Write the patch for 9 files",
children: [{ id: "c-1a", name: "github.get_file", kind: "tool", tool: "GitHub", icon: <GitHubLogo />, start: 55_000, end: 56_400 }],
},
{ id: "t-1", name: "shell.run", kind: "tool", status: "failed", error: "3 tests failed", start: 73_000, end: 80_000 },
],
},
],
};
export function Run() {
return <AgentFlameGraph title="Ship v2.4" root={run} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| root | FlameNode | The run – { id, name, kind, start, end?, status?, tokens?, cost?, model?, tool?, detail?, error?, icon?, color?, children? } | |
| kind | "agent" \| "llm" \| "tool" | Agents get a quiet gray block with their pixel mark, LLM calls indigo, tool calls teal; failed blocks are red | |
| start / end | number | In ms from the start of the run. Leave end out while it runs; with status "running" an end is how far it reaches for now | |
| tokens / cost | number | A block's own – an agent's children are added on top. NaN and negatives count as nothing | |
| icon | ReactNode | The model maker's or the tool's logo, 12px – also shown in the breadcrumb and the card | |
| now / startedAt | number | The clock in ms from the start, or when the run started (epoch ms) for a clock of its own | |
| metric / defaultMetric / onMetricChange | "time" \| "tokens" \| "cost" | What sizes the blocks – time by default | |
| zoomId / defaultZoomId / onZoomChange | string \| null | The block that fills the width – null for the whole run | |
| query / defaultQuery / onQueryChange | string | The search – matches names, models, tools and details (agents by name) | |
| onRetry | (block: FlameNode) => void | Offers Retry on failed blocks – in their card, or R on a focused failed block | |
| title / rootLabel | string | The heading, and the first crumb of the breadcrumb ("Run") | |
| formatCost | (amount: number) => string | Formats every cost – dollars by default | |
| className | string | An extra class on the root |
Fills its container's width and never scrolls sideways; the graph keeps a fixed height of 10 rows, deeper trees scroll inside
Blocks under 40px show no text, names end in …; the number pill shows from 150px
Narrow: the title and a search button on top, the switch across the width, the breadcrumb collapses to Run › … › last
On a touch screen a tap zooms and keeps the block's card open until a tap somewhere else
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"