Agents and the tools they call as a live network. Each call travels as a light streak along the link, and the target lights up when it lands. Links stay hairline-thin; only the streak shows traffic.
On this page
- Watch a run live
- See who called which tool
- Map a team of agents
- Spot a stuck agent
- Demo a multi-agent flow
Examples
Installation
npx knowns-ui@latest add agent-graphPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Agent graph from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/agent-graph
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add agent-graph
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/icons/actor-icon.tsx
- lib/knowns/icons/model-icons.tsx
- lib/knowns/icons/tool-icons.tsx
- lib/knowns/icons/model-icons.data.ts
- lib/knowns/icons/tool-icons.data.ts
- lib/knowns/icons/LICENSES.md
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/badge.tsx
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/agent-graph/agent-graph.tsx
- components/ui/knowns/agent-graph/detail-card.tsx
- components/ui/knowns/agent-graph/frame.ts
- components/ui/knowns/agent-graph/layout.ts
- components/ui/knowns/agent-graph/pulse-layer.tsx
- components/ui/knowns/agent-graph/radial.ts
- components/ui/knowns/agent-graph/routing.ts
- components/ui/knowns/agent-graph/tree.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/agent-graph, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "agent-graph" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Layouts
tree flows top-down and stacks tools into a list when a row gets crowded, then scrolls sideways. horizontal flows left to right and grows downward. center puts the root agent in the middle with branches on both sides. radial puts it in the middle with You just above it, its agents on a tight inner ring (diagonals first) and every tool packed just outside the ring, next to the agent that calls it. In a fixed frame the rings are ellipses shaped like the frame, so the graph fills it. Below 520px both fall back to tree. Center lays out again on every join or leave and everyone glides to the new spot: agents are balanced between both sides, a heavy agent's tools pack into a grid beside it, and the lead stays in the middle. Radial is stable: nodes that join mid-run take the closest free spot and everyone else stays put (an agent whose slot is already taken by tools lays the graph out again). With a fixed height (and width), the graph fits that frame and scales down if it must.
Tools sit under the agent that called them first, so the tree does not reshuffle while calls stream in.
Props
- run
AgentRun- Read actors, spans and links from a run. Takes precedence over the data props.
- actors / spans / links
Actor[] / Span[] / Link[]- Default
[] - Plain data instead of a run.
- layout
"tree"|"horizontal"|"center"|"radial"- Default
"tree" - How the graph is arranged. Radial: lead in the middle, You just above it, agents on an inner ring, tools packed just outside it beside their agent (elliptical rings shaped like a fixed frame); newcomers take the closest free spot.
- intro / introSpeed
"grow"|"fade"|false / number- Default
false / 180 - How the graph appears on first layout, after a reset or a new run. Grow reveals nodes from You outward: each link draws into its child, then the child pops in, siblings staggered, the whole reveal capped near 2.5s. Streaks wait for both ends. Off with reduced motion.
- ref
Ref<AgentGraphHandle>- replayIntro() plays the intro again.
- selectedId
string|null- Controlled selection. Leave undefined to let the graph manage it.
- onActorSelect
(actor | null) => void- Fires when the detail popover opens or closes.
- renderDetail
(actor, spans) => ReactNode- Replace the body of the detail popover.
- header
ReactNode|false- Default
"Agent graph" - Title of the header bar, or false to hide it.
- activityWindow
number- Default
20000 - Window in ms of calls counted toward the calls/min readouts.
- height / width
number- Default
fits / container - A fixed frame: the layout targets this box; if it still doesn't fit, the canvas scales down to fit (no scrollbars).
- fit
"contain"|"none"- Default
"contain" - With a fixed height: scale to fit, or the old sideways scroll.
- zoomControls
boolean|"bottom-right"|"top-right"|"bottom-left"- Default
true ("bottom-right") in a frame - Zoom out / in / Fit in a corner; fitting keeps the graph clear of them, and they fade back while the pointer is on the canvas. ⌘/Ctrl + wheel or pinch zooms around the cursor, drag pans, double-click fits.
- touch
"pan"|"scroll"- Default
"pan" - Touch in a frame. Pan: one finger pans, two pinch. Scroll: swipes scroll the page and the graph takes taps only. Use it in a long page, like a landing hero.
- clock
number- Default
Date.now() - Clock for rates; without it the graph ticks every second.
- formatSpend
(n) => string- Default
$0.00 - How spend is shown.
| Prop | Type | Default | Description |
|---|---|---|---|
| run | AgentRun | - | Read actors, spans and links from a run. Takes precedence over the data props. |
| actors / spans / links | Actor[] / Span[] / Link[] | [] | Plain data instead of a run. |
| layout | "tree" | "horizontal" | "center" | "radial" | "tree" | How the graph is arranged. Radial: lead in the middle, You just above it, agents on an inner ring, tools packed just outside it beside their agent (elliptical rings shaped like a fixed frame); newcomers take the closest free spot. |
| intro / introSpeed | "grow" | "fade" | false / number | false / 180 | How the graph appears on first layout, after a reset or a new run. Grow reveals nodes from You outward: each link draws into its child, then the child pops in, siblings staggered, the whole reveal capped near 2.5s. Streaks wait for both ends. Off with reduced motion. |
| ref | Ref<AgentGraphHandle> | - | replayIntro() plays the intro again. |
| selectedId | string | null | - | Controlled selection. Leave undefined to let the graph manage it. |
| onActorSelect | (actor | null) => void | - | Fires when the detail popover opens or closes. |
| renderDetail | (actor, spans) => ReactNode | - | Replace the body of the detail popover. |
| header | ReactNode | false | "Agent graph" | Title of the header bar, or false to hide it. |
| activityWindow | number | 20000 | Window in ms of calls counted toward the calls/min readouts. |
| height / width | number | fits / container | A fixed frame: the layout targets this box; if it still doesn't fit, the canvas scales down to fit (no scrollbars). |
| fit | "contain" | "none" | "contain" | With a fixed height: scale to fit, or the old sideways scroll. |
| zoomControls | boolean | "bottom-right" | "top-right" | "bottom-left" | true ("bottom-right") in a frame | Zoom out / in / Fit in a corner; fitting keeps the graph clear of them, and they fade back while the pointer is on the canvas. ⌘/Ctrl + wheel or pinch zooms around the cursor, drag pans, double-click fits. |
| touch | "pan" | "scroll" | "pan" | Touch in a frame. Pan: one finger pans, two pinch. Scroll: swipes scroll the page and the graph takes taps only. Use it in a long page, like a landing hero. |
| clock | number | Date.now() | Clock for rates; without it the graph ticks every second. |
| formatSpend | (n) => string | $0.00 | How spend is shown. |
Accessibility
Every actor is a button labelled with its name, type, state, model, activity and call rate. Tab walks the tree in order and highlights the focused actor's neighbours; Enter opens the detail popover, Escape closes it and returns focus. A visually hidden list mirrors the graph, the needs-you / failed chips sit in a polite live region, and state is never shown by colour alone. Streaks and breathing stop under reduced motion.
What it handles
- 01Lays agents and their tools out as a tree, horizontal, center or radial graph with the layout prop, and falls back to the tree below 520px.
- 02Sends a light streak along a link each time a new span starts, and the answer travels back once the span gets an outcome.
- 03Thickens a link by how many spans crossed it inside activityWindow, 20 seconds by default, so busy paths stand out.
- 04Opens a detail card on click or Enter with the agent's state, spend and last spans, closes it with Escape, and takes your own body through renderDetail.
- 05Pans by dragging empty canvas, zooms with ctrl or cmd plus wheel or a pinch, and fits the whole graph from the corner zoom buttons.
- 06Plays an optional intro that grows nodes outward from You, and replayIntro() on the ref runs it again.
States
- First render
- Nothing. It paints as it is, unless intro is set
- none
- intro="grow"
- Each link draws into its child, then the node pops in from 0.9 scale
- 280ms, ease out
- intro="fade"
- Nodes fade in together
- 180ms, ease out
- A streak reaches an agent
- The node's halo flares once in the streak's colour
- 280ms, opacity only
- Node hover or focus
- Border and shadow change
- 120ms, ease out
- Detail card opens
- The card rises into place
- 180ms, ease out
- Reduced motion
- No intro, flare or join animation
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. It paints as it is, unless intro is set | none |
| intro="grow" | Each link draws into its child, then the node pops in from 0.9 scale | 280ms, ease out |
| intro="fade" | Nodes fade in together | 180ms, ease out |
| A streak reaches an agent | The node's halo flares once in the streak's colour | 280ms, opacity only |
| Node hover or focus | Border and shadow change | 120ms, ease out |
| Detail card opens | The card rises into place | 180ms, ease out |
| Reduced motion | No intro, flare or join animation | 0ms |
Works with
- BadgeInstalled with it. Shows counts and state chips inside the graph.
- ButtonInstalled with it. The zoom and fit controls and the card's close button are its buttons.
- Agent lanesPairs with it: the graph shows who talks to whom, the lanes show when.
- Trace waterfallPairs with it: click an agent here, then read its calls in time order there.
When to use
When to use
- Showing which agents and tools a run involves and how they connect, while calls are happening.
- An overview panel where the shape of the work matters more than exact timings.
- Runs with a handful to a few dozen nodes, where a click on a node should open its details.
When not to use
- You need to see when each call started and how long it took: use Trace Waterfall.
- You want who spawned whom as an org chart, with the cost of each branch: use Agent Tree.
- A decorative hero graph with no real run behind it: use Run Pulse.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Agent Graph to my app and wire it to my own data.
- I need showing which agents and tools a run involves and how they connect, while calls are happening. Set that up with the Knowns UI Agent Graph.
- Which Agent Graph props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "agent-graph" }) and search_docs({ query: "agent graph" }).