Skip to content
PlanningSubagentMenu

Subagent

A subagent folded to one line that says what it is doing right now. Expand it for its own trace on a rail and its result.

The current action crossfades in place while the subagent works; expand to see its trace.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/subagent.json

Usage

tsx
import { Subagent } from "@/components/ui/chatcn/subagent"

<Subagent
  name="Explore agent"
  status="running"
  activity="Reading src/app/runs/layout.tsx"
  task="Find what blocks the first paint of /runs."
  toolCount={3}
  steps={steps}
/>

Pass steps for a compact built-in trace, or children for anything else: a full Trace, tool calls, or more Subagents for agents that spawn agents. The rails nest and line up with the glyphs.

Examples

Nested agents

A lead agent and the two agents it spawned, on one rail.

Every state

Starting, running, waiting for input, done, failed and cancelled.

Props

PropTypeNotes
nameReactNodeThe subagent's name
statusSubagentStatusspawning, running, waiting, done, failed, cancelled
activitystringThe one-line HUD; changes crossfade in place
taskReactNodeWhat it was asked, at the top of the trace
summaryReactNodeIts result; the first line shows in the folded row when done
summaryLinestringOverride the folded line when done
stepsSubagentStep[]{ id, label, detail?, status }
toolCountnumberShown as 8 tools
durationMs, startedAtnumberMeasured automatically when omitted
iconReactNodeGlyph at rest; defaults to the subagent icon
open, defaultOpen, onOpenChangeOpens by itself when failed or waiting

Keyboard

KeyAction
Enter, SpaceExpand or collapse the trace

Accessibility

  • The HUD line is deliberately not live: screen readers would hear every file. A polite region announces Explore agent done once it settles.
  • The old line is hidden from assistive tech the moment it starts fading out.

Motion

  • The activity line crossfades: the old text fades out in 110 ms while the new fades in over 150 ms in the same spot. No slide, no ticker, no layout shift.
  • Spinner to icon uses the 150 ms blur swap; the trace opens over 200 ms.