Skip to Content
Components

Agent tree

An orchestrator and its sub-agents, with cost rolled up per branch.

An agent tree shows an orchestrator and its sub-agents as a tree. Each row has its name, its task, a status glyph and a cost; a branch's cost is its own plus everything under it, and the header rolls up the whole run. A chevron folds a branch, and the arrow keys move through it as in any tree view. A failed step can carry a fix — a button under its task that offers the way out.

Preview
Redesign the pricing pageRunning · 0:00
$0.24
OrchestratorPlans the work and hands it out$0.24
Design agentRework the plan cards in Figma$0.08
Update the Pro cardPricing v4, frame 2$0.03
Update the Team cardPricing v4, frame 3$0.03
Apply library tokensColour and spacing–
Copy agentRewrite the plan descriptions–

Usage

<!-- include core.css + agent-tree.css -->
<div class="dm-atr dm-panel">
  <div class="dm-atr-h">
    <div class="dm-atr-ht"><b>Redesign the pricing page</b><span class="dm-muted dm-atr-st">Running · 0:14</span></div>
    <span class="dm-atr-tot dm-num">$0.24</span>
  </div>
  <div class="dm-atr-tree" role="tree" aria-label="Agents">
    <div class="dm-atr-n dm-run" role="treeitem" aria-level="1" aria-expanded="true" style="--dm-lv:0">
      <span class="dm-atr-tg"><!-- chev-d --></span>
      <span class="dm-atr-g"><span class="dm-spin"></span></span>
      <span class="dm-atr-t"><b>Orchestrator</b><span>Plans the work and hands it out</span></span>
      <span class="dm-atr-c dm-num">$0.24</span>
    </div>
    <!-- child rows, folded under a .dm-atr-kids group -->
  </div>
</div>

Properties

NameTypeDescription
rootAgentNodeThe orchestrator, with its agents and their steps as children.
titlestringThe run's goal, like "Redesign the pricing page".
statusstringThe line under the title. Defaults to "Running", "N steps failed" or "Done".
secondsnumberSeconds to show as m:ss. Leave it out to count up until the root is done.
summarystring | falseShown under the tree once the root is done. false hides it; default rolls one up.
collapsedstring[]Ids of the folded branches (controlled).
defaultCollapsedstring[]Ids folded to begin with when uncontrolled.
onCollapsedChange(ids) => voidEmitted when a branch folds or unfolds, with the ids now folded.
formatCost(dollars) => stringWrites a cost. Defaults to dollars and cents, like $0.12.
AgentNode.idstringIdentifies the node; used as the fold key.
AgentNode.namestringLike "Design agent", or a step's name.
AgentNode.taskstringIts task, or what it is doing now. Crossfades when it changes.
AgentNode.statusqueued | running | done | failedPicks the status glyph and row tint.
AgentNode.costnumberWhat this node spent on its own. A branch shows this plus everything under it.
AgentNode.fix{ label; onClick }On a failed step, a button under its task that offers the way out.
AgentNode.childrenAgentNode[]The agents or steps under this node.

Theming

Works in light and dark (data-theme="dark") and in the Soft style (data-style="soft"). The tree sits on a surface; the running glyph spins in the accent colour, a done branch turns green and a failed step tints its row with the bad-tone background, so it reads in either theme. In Soft the card, rows and the fix button are rounder.

On this page