Agent Handoff
Show one agent handing a conversation to another, with the reason and the context that went with it.
Overview
Agent Handoff marks the moment a conversation moves from one agent to another, such as from a triage agent to a billing agent. It says who handed it over, who took it, and why, and it can show the context the receiving agent was given: a summary, named facts, attached files, and the size of the payload in tokens. People can see what the new agent knows instead of wondering why it seems to know it.
Use the card in a conversation or a run log. Use the inline variant between two messages, where the handoff should read as a divider.
Anatomy
- HeaderA sentence for the status, such as Handed off to Billing, with the status and time
- AgentsThe handing and receiving agents, with avatars or initials and their roles
- ReasonWhy the conversation was handed over
- ContextA summary, facts, and attached items, shown on request
- FooterThe context toggle, the payload's token count, View full context, and Accept and Decline while pending
Behavior
Status
pending reads "Handing off to Billing" with a spinning icon. accepted reads "Handed off to Billing". declined reads "Billing declined the handoff" in red, the only status with color. returned reads "Billing handed back to Triage". Reword them with labels.title.
Context
The context is closed by default and opens from the footer. Control it with open and onOpenChange, or start it open with defaultOpen. Without a summary, facts, or items, there is no toggle. onViewContext adds a button for the full payload, such as a panel with the raw message.
Deciding
When the handoff is pending and you pass onAccept or onDecline, the footer shows Accept and Decline, for handoffs a person must approve. Update status when they choose.
Inline
variant="inline" draws one line between hairlines: both avatars, an arrow, the sentence, the time, and a Context button. The context opens as a small plate under the line, with the reason first.
Accessibility
The card is a region named by its sentence, and the inline variant is a group named the same way. The avatars are hidden from assistive technology, since the names are in text. The context toggle reports whether it is open and which panel it controls. A declined inline handoff also reads "Declined", so the red icon is never the only cue.
Installation
Usage
import { AgentHandoff } from "@/components/ai/agent-handoff"
<AgentHandoff
from={{ name: "Triage", role: "Routes new conversations" }}
to={{ name: "Billing", role: "Refunds and invoices" }}
status="accepted"
reason={handoff.reason}
summary={handoff.summary}
facts={[{ label: "Order", value: "#48213" }]}
tokens={handoff.tokens}
/>
<AgentHandoff variant="inline" from={triage} to={billing} status="accepted" time="2:14 PM" />Examples
Inline
Between two messages, the handoff reads as a divider, and its context opens under the line.
Pending
A handoff a person must approve, with Accept and Decline.
API reference
AgentHandoff
Accepts native div props beyond those listed.