Parallel sub-agents under one task: a lane per agent with its live step, status, run time and tool calls, opening into its result.
Set your access key from API keys as NEXTUI_TOKEN in .env.local and add the @nextui namespace below to components.json once. Then every item installs by name. Each install counts as a copy on a free account.
$pnpm dlx shadcn@latest add @nextui/sub-agents
1{2"registries": {3"@nextui": {4"url": "https://nextui.dev/r/{name}.json",5"headers": { "Authorization": "Bearer ${NEXTUI_TOKEN}" }6}7}8}
1"use client";23import { SubAgents, type SubAgent } from "@/components/nextui/sub-agents";45// Render the parts your orchestrator streams. One way with AI SDK 7: a "delegate"6// tool per sub-agent run, whose output is a stream of preliminary results7// ({ status, step, toolCalls }) and a final one with the answer.8export function Delegation({ parts }: { parts: { toolCallId: string; state: string; input: { name: string; task: string }; output?: { step?: string; toolCalls?: number; result?: string; durationMs?: number } }[] }) {9const agents: SubAgent[] = parts.map((p) => ({10id: p.toolCallId,11name: p.input.name,12task: p.input.task,13status: p.state === "output-error" ? "error" : p.state === "output-available" && p.output?.result ? "done" : p.output ? "running" : "queued",14step: p.output?.step,15toolCalls: p.output?.toolCalls,16duration: p.output?.durationMs,17result: p.output?.result,18}));1920return <SubAgents title="Research Q3 competitors" agents={agents} />;21}
| Prop | Type | Default | Description |
|---|---|---|---|
| agents | SubAgent[] | – | One lane per agent: id, name, task, status (queued, running, done, error), step, result, error, duration (ms), toolCalls |
| title | string | "Research Q3 competitors" | The parent task in the header |
| summary | ReactNode | – | Line shown under the lanes once every agent has finished |
| onStop | (id: string) => void | – | Adds a stop button to running lanes |
| autoPlay | boolean | false | Loop a scripted parallel run, for demos |
| className | string | – | Extra classes on the wrapper |
Sign in to see the code
Preview it freely. A free account copies code and prompts a few times a day.