Loading component…
Loading component…
One task passed from agent to agent like a baton, played back live – every agent a tile with its pixel mark that fills in as the baton travels, and a log of the run
To reuse this local React demo, copy all files from the Code tab into the same folder, then import HandoffRelay from ./handoff-relay.
import { HandoffRelay, type RelayAgent, type RelayEvent } from "@/components/ui/handoff-relay";
const agents: RelayAgent[] = [
{ id: "triage", name: "Triage", role: "Router", doing: "classifying the request" },
{ id: "researcher", name: "Researcher", role: "Analyst", doing: "pulling 6 sources" },
{ id: "writer", name: "Writer", role: "Author", doing: "drafting the summary" },
];
const events: RelayEvent[] = [
{ at: 0, agent: "triage", text: "Run started" },
{ at: 1800, agent: "triage", to: "researcher", text: "classified as research" },
{ at: 4600, agent: "researcher", text: "6 sources shortlisted" },
{ at: 5100, agent: "researcher", to: "writer", text: "6 sources attached" },
{ at: 8000, agent: "writer", text: "Approved", note: "draft signed off", end: "approved" },
];
<HandoffRelay agents={agents} events={events} task="Summarize churn drivers from Q2 tickets" />| Name | Type | Default | Description |
|---|---|---|---|
| agents | RelayAgent[] | { id, name, role?, model?, doing?, color? } – in the order the baton travels | |
| events | RelayEvent[] | { at, agent, text, to?, end?, note?, logo?, cost? } – everything that happened, in ms from the start | |
| logo (event) | ReactNode | Per step – the logo of the tool it used, on a small white tile; without it the line shows its agent's mark | |
| cost | number | Per event – what that step cost; added up into the run's cost on the top right, next to its time | |
| formatCost | (amount: number) => string | dollars | Formats the run's cost |
| logoFill | boolean | Per step – the logo is a square of its own (e.g. Intercom's blue tile) and fills the tile edge to edge | |
| to | string | Per event – makes it a handoff from agent to this agent: the line fills on to that agent and its mark starts to twinkle | |
| end | "approved" \| "failed" | Per event – the run ends here; its text shows green or red in the log and the footer | |
| doing | string | Per agent – what the footer says while it holds the baton (defaults to its latest step) | |
| color | string | Per agent – any CSS color; defaults to blue, purple, orange, green … in order (one agent alone is blue) | |
| task | string | What the run is about – muted, under the title | |
| time | number | Drives it from your own run (ms) – no own clock, no controls | |
| autoPlay | boolean | true | Starts playing on mount |
| speed | number | 1 | Playback speed |
| onHandoff | (from, to) => void | A handoff happened while it played | |
| onFinish | () => void | The run reached its end while it played | |
| title | string | "Handoff Relay" | Heading on the frame |
| className | string | Extra class on the root |
Built on a container query; under 420px the task next to the title steps aside
Many agents scroll sideways inside the lane – each agent keeps at least 72px
Fixed heights: the log keeps five lines and the footer one, so nothing jumps while it plays
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"