Handoff

AgentHandoff visualizes control passing from one agent to another, showing the source and target agent pills joined by an arrow, the reason for the handoff, and a list of context items carried over. It flips from an active blue highlight to a muted, faded state when the handoff is marked settled.

Handoff
LIVE · running in a sandboxed iframe
Installed with shadcn add · 1 workaround · theme from registry.json
  • installed base item https://r.assistant-ui.com/shimmer-style.json (registry preview settings)
See how it was built

Installation

pnpm dlx shadcn@latest add @assistant-ui/elements-agent-handoff

Requires @assistant-ui in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { AgentHandoff } from "@/components/assistant-ui/elements/agent-handoff";export function Example() {  return (    <AgentHandoff      from="Triage"      to="Billing"      reason="User asked about a duplicate charge."      carried={["Order #4821", "Refund policy summary"]}      settled={false}    />  );}
  • Showing that a conversation or task moved from one agent (e.g. triage bot) to another (e.g. billing specialist)
  • Displaying the reason for a handoff alongside the context items that were passed along
  • Indicating in a transcript or trace whether a handoff is still in progress or has been completed (settled)
  • Visualizing multi-agent routing in an assistant-ui thread or agent timeline

Examples

In-progress handoff

A handoff that has just been requested and is still active, so the target agent is highlighted in blue.

in-progress-handoff.tsx
import { AgentHandoff } from "@/components/assistant-ui/elements/agent-handoff";export function InProgressHandoff() {  return (    <AgentHandoff      from="Sales Agent"      to="Support Agent"      reason="Customer reported a login issue that requires account access."      carried={["Account email", "Ticket #1093"]}      settled={false}    />  );}

Settled handoff without carried context

A completed handoff where nothing was carried over, so the carried-over section is omitted.

settled-handoff-without-carried-context.tsx
import { AgentHandoff } from "@/components/assistant-ui/elements/agent-handoff";export function SettledHandoff() {  return (    <AgentHandoff      from="Router"      to="Code Reviewer"      reason="Pull request touches the payments module."      carried={[]}      settled    />  );}

Handoff inside a transcript list

Rendering several handoffs with custom spacing via className.

handoff-inside-a-transcript-list.tsx
import { AgentHandoff } from "@/components/assistant-ui/elements/agent-handoff";export function HandoffTimeline() {  return (    <div className="flex flex-col gap-6">      <AgentHandoff        from="Intake"        to="Medical Info"        reason="Patient described symptoms needing clinical context."        carried={["Symptom summary", "Allergy list"]}        settled        className="max-w-md"      />      <AgentHandoff        from="Medical Info"        to="Scheduler"        reason="Follow-up appointment is required."        carried={["Preferred dates"]}        settled={false}      />    </div>  );}

API reference

PropTypeDefaultDescription
fromstring—Display name of the agent handing off control. Rendered in the left pill with a bot icon.
tostring—Display name of the agent receiving control. Rendered in the right pill with a bot icon; highlighted blue while not settled.
reasonstring—Explanation of why the handoff occurred, shown as a small muted paragraph.
carriedreadonly string[]—Context items passed to the target agent. When the array is empty, the 'carried over' section is not rendered.
settledboolean—When true, fades the source pill, neutralizes the target pill and arrow to indicate the handoff is complete. When false, the handoff is styled as active with blue accents.
classNamestring—Additional classes merged onto the root div via cn(). The root defaults to flex column, w-full, max-w-sm, gap-2.
...propsOmit<ComponentProps<"div">, "children" | "from" | "to" | "reason" | "carried" | "settled">—All other standard div attributes are forwarded to the root element, such as id, aria-* and data-* attributes. children is not accepted.

Accessibility

  • The component renders plain div and span elements with no ARIA role, so screen readers read the from name, arrow (decorative SVG), to name, reason and carried items in DOM order; consider wrapping in a list or group with an aria-label such as 'Agent handoff' via the spread props.
  • The arrow and bot icons are decorative SVGs from lucide-react and carry no text; the agent names carry the meaning, so no additional label is required on the icons.
  • Because the active and settled states differ only by color and opacity, do not rely on the blue highlight alone to convey status; expose the state in text or via aria-label (e.g. 'Handoff settled') through the spread props.
  • Text contrast: the faded source pill at 45% opacity may fall below WCAG contrast for small text; keep the handoff text meaningful without it.
  • The carried-over label is rendered in monospace muted text; the items are plain spans, so consider marking the list with a role or aria attribute if the items should be announced as a group.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Handoff" component (assistant-ui/elements-agent-handoff) from its shadcn registry.1. Install it with: npx shadcn@latest add @assistant-ui/elements-agent-handoff2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: from, to, reason, carried, settled, className, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { AgentHandoff } from "@/components/assistant-ui/elements/agent-handoff";export function Example() {  return (    <AgentHandoff      from="Triage"      to="Billing"      reason="User asked about a duplicate charge."      carried={["Order #4821", "Refund policy summary"]}      settled={false}    />  );}```

Files & dependencies

  • components/assistant-ui/elements/agent-handoff.tsx
dependencieslucide-react
registryDependencieshttps://r.assistant-ui.com/elements-surfaces.json

Looks similar, elsewhere