Skip to content
EspañolEnglish
All components (283)

Subagent

AI · Subagent

What it is and when to use it

An agent to which another has delegated a job: its name, its task, where it stands and, folded, what it has been doing and what it returned.

When to use it

  • Showing the work an agent hands out: a security review, a parallel search.
  • status says where it stands (in progress by default: it comes out open); result is what it returns and the children are its log, normally ToolCall.

When not to

  • A single tool call: ToolCall.
  • The steps of a plan: Plan.
  • The reasoning of a model: Reasoning.

Keyboard: the title folds and opens: Tab, Enter or Space.

Accessibility: the state is seen through the icon and said with hidden text. While it works it carries aria-busy. The task and the result are a definition list.

Fine-tuning: amset-subagent and the amset-subagent__* classes; the line on the border changes with the state.

What it looks like

Task
Look for SQL injections in the order controllers.

<Subagent
  name="Security reviewer"
  task="Look for SQL injections in the order controllers."
  status="active"
  durationMs={6400}
  toolCount={3}
/>

Props

Import it with import { Subagent } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
namerequiredstringWhat the agent is called: "Security reviewer". Required.
taskrequiredstringWhat it has been asked to do.
childrenReactNodeWhat it has been doing: its tool calls, its log.
classNamestringMerged with the library classes; it does not replace them.
defaultExpandedbooleanOpen at the start. By default, only while it works.
durationMsnumberHow long it took, in milliseconds.
resultReactNodeWhat it returned when it finishes.
status"pending" | "done" | "active" | "failed" | "skipped"Where it stands: pending, in progress, done, failed or skipped. In progress by default.
toolCountnumberHow many tools it has used: it is said in the header, next to the state.
toolsreadonly SubagentTool[]The tools it has used, with how long each took. If given, `toolCount` comes from its length.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

In the test bench

Every state and variant, to try one at a time, on its page at storybook.amsetui.com: