OfferLifetime Pro for $99

Sub-agent Tree

Every agent a card with role, status, model, its own cost and time, and the total of its branch. Any branch folds to one line with a dot per agent. Clocks tick while agents run and a finished child's cost rolls into every total above it. Cancel works on any live node and asks before cancelling the agents below it.

The decision inside it

A failure travels up

A parent showing a tick while a grandchild failed is how a broken result gets shipped. A failure marks every ancestor with a red dot and "1 failed below", even when the branch is folded, and totals that include running work say "so far".

When to use it

Use Sub-agent Tree to show an orchestrator and the agents it started: status, model, cost and time per agent, with branch totals and failures that travel up. For one agent's steps over time use Agent Timeline; for agents side by side in time use Agent Lanes.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's Sub-agent Tree for this.
Install it: npx shadcn@latest add @layro/agent-tree
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/agent-tree.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.

Usage

components/run-tree.tsx
import { AgentTree, type AgentNode } from "@/components/ui/agent-tree";

const run: AgentNode = {
  id: "lead", name: "Lead", role: "Orchestrator", status: "running", cost: 0.04,
  children: [
    { id: "research", name: "Research", role: "Researcher", model: "Deep", status: "done", cost: 0.31 },
    { id: "writer", name: "Writer", role: "Writer", model: "Swift", status: "running", cost: 0.08 },
  ],
};

export function RunTree({ cancel }: { cancel: (id: string) => Promise<void> }) {
  return <AgentTree root={run} onCancel={cancel} />;
}

API reference

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
rootrequiredAgentNode—
selectedIdstringControlled selection.
defaultSelectedIdstring—
onSelect(id: string) => void—
onCancel(id: string) => void | Promise<void>May return a promise. Called once per agent being cancelled, deepest first.
foldedstring[]Controlled folded branches, by id.
defaultFoldedstring[]—
onFoldedChange(ids: string[]) => void—
currencystringISO 4217. Default "USD".
nowDate | numberFix the clock, for screenshots and tests.
lookLookLayered sets it in a tray, the heading above the card and the status in the strip below. Flat is one card.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-themebutton

States

All of them are drawn by the component. None is left for you to design.

  • Running
  • Waiting on you
  • Done
  • Failed below
  • Folded
  • Cancelling
  • Cancelled

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Used in a screenAll screens

Lifetime access

Every component, and everything we ship next.

  • All 232 components, source included
  • Every template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.