Loading component…
Loading component…
An agent in the middle with every tool it can reach around it – which ones it used, which failed and which it calls right now; open a tool for its calls and replay one on its own
To reuse this local React demo, copy all files from the Code tab into the same folder, then import ToolAccessMap from ./tool-access-map.
import { ToolAccessMap, type MapAgent } from "@/components/ui/tool-access-map";
const agents: MapAgent[] = [
{
id: "coder",
name: "Coder",
model: "GPT-6 Sol",
status: "running",
task: "Build the pricing page",
tools: [
{ id: "github", name: "GitHub", calls: [{ id: "c1", status: "done", input: { branch: "pricing-page" }, output: { ref: "refs/heads/pricing-page" }, duration: 450 }] },
{ id: "terminal", name: "Terminal", calls: [{ id: "c2", status: "running", input: { cmd: "npm test" } }] },
// A tool it can use but hasn't yet
{ id: "stripe", name: "Stripe" },
],
},
];
// Every tool of the run – the ones an agent can't reach are grayed out on its map, with a dashed line
const tools = [
{ id: "github", name: "GitHub" },
{ id: "terminal", name: "Terminal" },
{ id: "stripe", name: "Stripe" },
{ id: "slack", name: "Slack" },
];
export function Tools() {
return <ToolAccessMap agents={agents} tools={tools} onReplay={(call, input, tool) => agent.call(tool.id, input)} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| agents | MapAgent[] | { id, name, model?, avatar?, status, task?, tools } – pass them again whenever a call starts or comes back | |
| tools | AccessTool[] | the tools of all agents together | Every tool of the run, { id, name, icon?, description? }, in the order they're laid out – the first half on the left |
| agent.tools | AgentTool[] | Per agent: { id, calls? } for every tool it has access to – name and icon come from tools; one without calls shows as not used yet, one that isn't listed as no access | |
| calls | ToolCall[] | Per tool, oldest first: { id, status, input, output?, error?, at?, duration?, replay? } – a running call turns its line blue | |
| status | "queued" \| "running" \| "waiting" \| "done" \| "failed" | Per agent – shown as a badge on its card; waiting reads "Needs you" | |
| agent | string | Controlled id of the agent on the map | |
| defaultAgent | string | the first agent | The agent on the map at first, uncontrolled |
| onAgentChange | (id: string) => void | A tab was picked | |
| onReplay | (call, input, tool, agent) => void | Replay was pressed – input is the call's own, or the one it was changed to (parsed from JSON when the original was an object) | |
| formatTime | (ms: number) => string | 0:42 | Formats when a call was made |
| title | string | "Tool access" | Heading of the bar |
| className | string | Extra class on the root |
Every tool card has a fixed size, so nothing moves when a call starts, finishes or fails
The map lays itself out from its own width; below 540px the tools sit in a grid under the agent and the lines give way
In the calls view, narrow puts the list above the call
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"