Subagents
Show the work an agent hands to other agents, one line per run. Each run says what it’s doing now and folds into a short summary when done. Parallel runs share a header with live progress, and every run can be stopped, retried and opened to its tool calls and report.
Coding agents like Claude Code, Codex and Cursor hand parts of a job to other agents, often several at once. Subagents gives each of those runs one line that reads like a person delegating: the agent, its task in plain words, a live label of what it’s doing (“Reading auth/session.ts”), a timer and how many tools it has used.
Runs start folded, so a busy reply stays short. Each line keeps saying what its run is doing, and opening it shows the tool calls streaming into a short window that follows the newest step. When a run finishes, its line turns into a past-tense summary such as “Mapped the token refresh flow · 14 tool uses · 32s”, with the first sentence of its report underneath and the full report inside.
Parallel runs share a header that reads “Running 3 agents” with a progress bar, then “3 agents finished in 48s”. Runs can be queued, running, done, failed with a reason and Retry, stopped, or left running in the background. getSubagentFromPart reads an AI SDK tool whose output streams the subagent’s own messages, and the nested steps render with Tool Calls and the report with Markdown.
Get HextaUI Pro
One payment unlocks every block, including future ones. See pricing.
Add the Pro registry to components.json
components.json Add your token
Create a token on your account page and put it in
.env.localasHEXTAUI_PRO_TOKEN.Add the block
pnpm dlx shadcn@latest add @hextaui-pro/subagents
With the AI SDK
Make the subagent a tool whose execute is an async generator that yields the subagent’s UI messages, so each one arrives as a preliminary output. getSubagentFromPart turns that part into a run, nested tool parts into Tool Calls steps, and the text after the last tool call into the report. Keep the tool on the server and the rendering in a client component.
Parallel runs
Pass several runs to Subagents for one header with live progress and Stop all. Wire onStop and onRetry to whatever runs the agents, and the row’s button switches between them as the run’s status changes.
From stored data
Render a finished run from history with plain props. A stored duration replaces the live timer, and the report stays one click away.
Anatomy
The parts you compose, from the outside in.
| Part | Description |
|---|---|
Subagents | A group of runs with a summary header, progress, Stop all and announcements. |
Subagent | One run: status mark, agent, task, live label, tool count, timer and its Stop or Retry button. |
SubagentMark | The status mark on its own: an orb while running, then a check, alert or stop icon. |
getSubagentFromPart | Maps an AI SDK tool part with streamed subagent messages to a run. |
Subagents
Also accepts every section prop except children. One run renders without the header.
| Prop | Type | Default |
|---|---|---|
runsRuns in the order they were started. They keep their place as they finish. | SubagentProps[] | – |
labelNames the region and its progress bar. | string | "Subagents" |
durationStored total seconds, for history. Defaults to the time measured while the runs worked. | number | – |
defaultOpenStart with the runs listed under the header. | boolean | true |
onStopAllCalled from Stop all. Without it, Stop all calls each running run’s onStop. | () => void | – |
Subagent
Also accepts every div prop except children.
| Prop | Type | Default |
|---|---|---|
idStable id, usually the toolCallId. | string | – |
taskWhat the agent was asked to do, in a few words: “Map the token refresh flow”. | string | – |
statusqueued, running, done, failed or stopped. | SubagentStatus | – |
agentThe agent’s type or name, such as Explore or Plan. | string | – |
titleReplaces the task on the line while the run works. | string | – |
doneTitleThe line once done. Defaults to the task in the past tense when its first word is a known verb. | string | – |
promptThe full instructions, shown at the top when opened. | string | – |
callsThe run’s steps, rendered with Tool Calls. | ToolCallProps[] | – |
activityReplaces the live label, which otherwise comes from the newest busy step. | string | – |
resultThe final report, as Markdown. | string | – |
resultStreamingThe report is still arriving. | boolean | – |
previewOne line for the collapsed run. Defaults to the report’s first sentence. | string | – |
errorWhy the run failed, shown on the line and in full when opened. | string | – |
toolUsesOverrides the count, which defaults to the number of calls. | number | – |
modelShown as a badge on wider screens. | string | – |
durationStored seconds, for history. | number | – |
startedAtWhen a run that is already working started, in milliseconds, so the timer doesn’t restart on mount. | number | – |
backgroundThe run keeps working while the chat goes on. It shows a Background badge and stays folded. | boolean | – |
defaultOpenStart the run open to its tool calls and report. | boolean | false |
onStopShows Stop while the run is queued or running. | () => void | – |
onRetryShows Retry once the run failed or was stopped. | () => void | – |
getSubagentFromPart(part, options)
Returns a run from a tool part. Pass the result straight to Subagent or into Subagents’ runs.
| Prop | Type | Default |
|---|---|---|
partThe subagent’s tool part. Its output is a UI message whose parts hold reasoning, tool calls and text. | ToolUIPart | DynamicToolUIPart | – |
options.stoppedThe chat stopped, so an unfinished run reads Stopped. | boolean | false |
options.describeToolAdds a kind, subject or view per nested tool. Common names like readFile, grep and bash are guessed for you. | (part) => Partial<ToolCallProps> | – |
options.agentAgent name. Defaults to subagent_type in the input, then the tool name. | string | – |
options.modelModel badge. Defaults to model in the message metadata. | string | – |
| Key | Action |
|---|---|
| EnterSpace | Opens or closes a run, or the list under the group header. |
| Tab | Moves from a run to its Stop or Retry button, and from the header to Stop all. |
- Each run’s header is a button with aria-expanded whose name reads the agent, task, live label, tool count and time.
- The group is a labelled region with aria-busy while agents work. A polite live region announces when a run starts again, finishes, fails or stops, and then the group summary. Tool steps and timer ticks stay quiet.
- Stop and Retry are real buttons named after their run, such as “Stop Explore: Map the token refresh flow”. When a button goes away, focus moves back to the run’s header.
- Status is never color alone: each state has its own mark and wording. With reduced motion, the orb holds still and lines change without sliding.
Built with
The free HextaUI components Subagents is made from. Each one installs on its own.
Code
6 files, added to components/blocks/subagents.