The run as a relay: which agent handed what to whom, the context that went along and what got lost on the way. Each new hand-off sends a light down the rail; drag a card forward to give it to someone later.
- Show who passed what
- Reassign a hand-off
- Spot lost context
- Follow a relay of agents
- Review a pipeline
Examples
Installation
npx knowns-ui@latest add agent-handoffPaste 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 handoff 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-handoff
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-handoff
```
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
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- 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/agent-handoff/agent-handoff.tsx
- components/ui/knowns/agent-handoff/handoff-map.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-handoff, 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-handoff" }) 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.A card per agent in relay order (model, spend, status and what it's on right now), and between each pair a lane with the handoffs that went from one to the next. Each handoff lists the context passed along; lost items are struck through, and opening the list shows why, with “Add back”. The status line says whether the next agent is on it, it looks good, or it needs a look.
Connectors draw in from each agent into its lanes; a new handoff sends a light down the sender's line and rises in at the top of the lane. Hover or focus an agent to brighten its lines. Reassign by dragging a card onto a later agent, or with the keyboard: Space picks it up, ← → choose the agent, Space hands it over, Escape cancels. Below 760px the relay stacks, each lane under its sender, without connectors.
Props
- run
AgentRun- Agents (with description, model, spend), tasks and tool calls; ended tasks with handoffTo become handoffs.
- actors / tasks / approvals / spans
arrays- Default
[] - Plain data instead of a run.
- handoffs
Handoff[]- Default
from tasks - { id, from, to, title, summary?, at, items, task? } - richer data; you then own reassigning and restoring.
- items
(task) => HandoffItem[]|undefined- Default
task.handoffItems - Context passed with a handoff, { id, label, kind?: file | note | data | link, lost?: { reason } }.
- order
string[]- Default
first appearance - Relay order of agent ids; the rest follow.
- verb
(agent, task) => string|undefined- Default
"Working" - Short word next to an agent's current task, e.g. “Drafting”.
- onAssign
(handoff, agent) => void- A handoff was moved onto a later agent (forward only).
- onRestore
(handoff, item) => void- Default
emit task.item.restore - “Add back” on a lost item. With a run the event is emitted for you; this is called as well.
- onOpen
(handoff) => void- Enter on a handoff card.
- laneHeight
number- Default
300 - Max height of a lane before it scrolls; the bottom fades while there's more.
- title
ReactNode|false- Default
false - Optional header with a handoff count.
| Prop | Type | Default | Description |
|---|---|---|---|
| run | AgentRun | - | Agents (with description, model, spend), tasks and tool calls; ended tasks with handoffTo become handoffs. |
| actors / tasks / approvals / spans | arrays | [] | Plain data instead of a run. |
| handoffs | Handoff[] | from tasks | { id, from, to, title, summary?, at, items, task? } - richer data; you then own reassigning and restoring. |
| items | (task) => HandoffItem[] | undefined | task.handoffItems | Context passed with a handoff, { id, label, kind?: file | note | data | link, lost?: { reason } }. |
| order | string[] | first appearance | Relay order of agent ids; the rest follow. |
| verb | (agent, task) => string | undefined | "Working" | Short word next to an agent's current task, e.g. “Drafting”. |
| onAssign | (handoff, agent) => void | - | A handoff was moved onto a later agent (forward only). |
| onRestore | (handoff, item) => void | emit task.item.restore | “Add back” on a lost item. With a run the event is emitted for you; this is called as well. |
| onOpen | (handoff) => void | - | Enter on a handoff card. |
| laneHeight | number | 300 | Max height of a lane before it scrolls; the bottom fades while there's more. |
| title | ReactNode | false | false | Optional header with a handoff count. |
What it handles
- 01Puts agents in relay order, from the order prop first and then by first appearance, with a lane for each.
- 02Builds a handoff card from each ended task that has handoffTo, or from your own handoffs prop, listing the context items it carried.
- 03Marks an item as lost with a tooltip giving the reason, and an Add back action that calls onRestore and emits task.item.restore on a run.
- 04Draws a connector between the giving and receiving agent and runs a light along it once when a new hand-off arrives.
- 05Reassigns a handoff forward only: drag it onto a later agent, or press Space, Left or Right and Space again, with Escape to cancel and a spoken hint.
- 06Shows each receiving agent's status as todo, working, done or warning, with a spinner and your verb, Working by default, next to its current task.
States
- First render
- Nothing. Lanes and cards paint as they are
- none
- New hand-off
- The card rises into its lane
- 280ms, ease out
- Lost items open
- The list rises under the card
- 180ms, ease out
- Card hover or drag
- Shadow and scale change
- 180ms, ease out
- Connector highlights
- The line thickens
- 280ms, ease in-out
- Row hover
- Text and background colour change
- 120ms, ease out
- Reduced motion
- New cards and lists appear at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. Lanes and cards paint as they are | none |
| New hand-off | The card rises into its lane | 280ms, ease out |
| Lost items open | The list rises under the card | 180ms, ease out |
| Card hover or drag | Shadow and scale change | 180ms, ease out |
| Connector highlights | The line thickens | 280ms, ease in-out |
| Row hover | Text and background colour change | 120ms, ease out |
| Reduced motion | New cards and lists appear at once | 0ms |
Works with
When to use
When to use
- Pipelines where work passes from agent to agent and you need to show what context went along and what was lost.
- Letting a person reassign the next step by drag or keyboard.
When not to use
- Agents working in parallel rather than in sequence: use Agent Lanes.
- A generic multi-step form or wizard: use Stepper.
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 Handoff to my app and wire it to my own data.
- I need pipelines where work passes from agent to agent and you need to show what context went along and what was lost. Set that up with the Knowns UI Agent Handoff.
- Which Agent Handoff props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "agent-handoff" }) and search_docs({ query: "agent handoff" }).