affectUI › Components › Agents
Handoff Relay
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.
Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/handoff-relay.json · Import from @/components/ui/handoff-relay
When to use
- One task travels through a chain of agents – triage, research, writing, review – and people should see who has it right now
- Replaying a finished multi-agent run step by step, with pause and replay, in a run view or a demo
- A live view of a running pipeline, driven by your own clock
When not to use
- What went along at each handoff and what got lost – use Agent Handoff
- Who does what across lanes, with approvals and tools – use Handoff Swimlanes
- Agents working side by side at the same time – use Agent Lanes
Usage
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" />Props
| 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 |
Keyboard
- Tab: Moves to the agents (one stop), the log, Restart and Pause / Resume / Replay
- ArrowLeft / ArrowRight: Walks the agents; Home and End jump to the first and the last
- Enter / Space: On an agent: opens its card, with the focus on Close; Jump to goes to the moment it got the baton
- Esc: Closes the card and goes back to its agent
Accessibility
- An agent's card is a dialog in the top layer, so no edge cuts it; the agent says whether its card is open (aria-expanded)
- Each agent is a button that says its name, role and state; the agents are one tab stop
- The log is a list that can be scrolled with the keyboard; the arrow between two names is read as "to"
- Who has the task, and the result at the end, are announced politely
Responsive
- 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"
Requirements
- React 19
Related
- Agent Handoff – A task passed from agent to agent like a relay – at every handoff what went along to the next one, and what got lost on the way
- Handoff Swimlanes – Who does what in an agent run, and where work changes hands – a lane per person, agent and tool, handoffs as arrows, approvals as diamonds you can approve in place
- Agent Lanes – Where every agent is right now – a live timeline with a lane per agent, tasks growing into “now”, hand-offs drawn between agents and approvals right on the block
- Run Controls – Every control a running agent needs, in one composer – stop it, resume from the word it stopped at, retry, steer it mid-answer or queue what's next, with Chat or Act