Loading component…
Loading component…
A router agent sorting incoming requests to the agents that handle them – a light runs to the chosen agent with a confidence, and unsure requests go to a person
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AgentRouter from ./agent-router.
import { AgentRouter, type RouterAgent, type RouterRequest } from "@/components/ui/agent-router";
const router: RouterAgent = { id: "router", name: "Router", model: "Claude Haiku", status: "active", activity: "Reading “Refund for order #4821”" };
const agents: RouterAgent[] = [
{ id: "billing", name: "Billing", model: "Claude Sonnet", status: "active", activity: "Refunding order #4821", load: 0.45, queue: 2 },
{ id: "tech", name: "Tech support", model: "Claude Sonnet", status: "idle", load: 0.3, queue: 1 },
{ id: "human", name: "Support lead", model: "Human", human: true },
];
const requests: RouterRequest[] = [
{ id: "r1", title: "Refund for order #4821", from: "maria@northwind.io", channel: "email", preview: "I was charged twice…", status: "routed", to: "billing", confidence: 0.94, scores: { billing: 0.94, tech: 0.12 }, reason: "A double charge – billing." },
];
export function Inbox() {
return <AgentRouter title="Support inbox" router={router} agents={agents} requests={requests} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| router | RouterAgent | The router itself, in the middle – { id, name, model?, status?, activity? }; its bar shows how sure it is about the request it reads or last sent on | |
| agents | RouterAgent[] | Who it sends requests to – { id, name, model?, status?, activity?, load?, queue?, human?, color?, logo? }. Agents get their pixel mark in a color of the palette, a person (human: true) the full square in ink and an orange glow when a request reaches them | |
| requests | RouterRequest[] | Newest first – { id, title, from?, channel?, icon?, preview?, status, to?, confidence?, scores?, reason?, tags? } | |
| tags | (string \| { label, color? })[] | Per request – up to three small tags on its card in a task queue, gray or tinted with their own color | |
| status | "new" \| "routing" \| "routed" \| "escalated" \| "done" | Per request – routing runs the light into the router and shimmers its line; routed or escalated with to runs it on to that agent, whose card lights up in its color | |
| channel / icon | "email" \| "chat" \| "ticket" \| "call" \| "slack" \| ReactNode | Where the request came in – its icon in the card's tile; icon puts your own there | |
| confidence / scores / reason | number / Record<string, number> / string | How sure the router is (0–1), every agent's score and why – shown on the card and when it is open | |
| layout | "lanes" \| "columns" | lanes (default): the request coming in on top, the router under it, the agents side by side at the bottom, each with its task queue below as in Agent Handoff – a request drops into the queue when the light reaches its agent. People (human: true) get no card: a line out of the router's right side fades out, with a Human tag on it that counts what waits for them. columns: requests, router and agents side by side | |
| modelLogo | ReactNode | Per agent and on the router – the model maker's logo, before the model's name (Claude, OpenAI, Gemini …) | |
| max | number | How many requests show on the left in columns – 4 by default | |
| onReroute | (request, agentId) => void | With it, an open request lists every agent as a button to send it there – update the request's to and the light runs to the new agent | |
| onSelect | (request) => void | A request was opened | |
| title | string | The header's name, with how many are routing, need you and are routed | |
| className | string | Extra class on the root – set the color variables on it |
Lanes (wide): the request on top, the router, every agent side by side with its task queue – the queues fade out at the bottom and keep one height
Columns (wide): requests, router and agents side by side, joined by connectors with rounded bends
Narrow: one column – the requests indented above the router, the agents hanging below it as in Agent Crew; the light runs the same way
Every card keeps its rows – a long subject, sender or line ends in … with the full text on hover
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"