Skip to content
GitHub (opens in a new tab)

TraceWaterfall

Where a run's time and money went: a waterfall of model, tool and approval spans with totals and span detail; compact form for a header.

stableOrganismcontracts/tracewaterfall.json

Preview

TraceWaterfall

Where a run's time and money went. Not BarChart. Not Meter.

Master

Select a span to open its detail. Running spans draw dashed toward now.

Run trace · Billing refactor

Complete
Total time
1m 14s
Total cost
$0.22
Spans
8

Draft patchModel

Model
Claude Sonnet 5.5
Retries
0
Tokens in / out
6,400 / 2,100
Duration
12.5s
Cost
$0.11
  • Model
  • Tool
  • Approval wait

Usage

TraceWaterfall explains one run. Kinds reuse existing roles (model primary, tool neutral, approval caution), and failed or running is always said in text.

Do's

  • explain the time and cost of one agent run
  • find the slow or expensive span
  • show a run that is still going or failed

Don'ts

  • compare categories — BarChart
  • plan or credit usage — UsageMeter
  • a step list with labels only — AgentTrail
<TraceWaterfall
  title="Run trace · Billing refactor"
  spans={spans}
  selectedId={spanId}
  onSpanClick={setSpanId}
/>

When to use

  • explain the time and cost of one agent run
  • find the slow or expensive span
  • show a run that is still going or failed

When not to use

  • compare categories — BarChart
  • plan or credit usage — UsageMeter
  • a step list with labels only — AgentTrail

What an agent reads

import { TraceWaterfall } from "agentic-ds-kit";
must
  • section aria-labelledby the h3 title
  • each span is a button (or group) named with label, kind, duration, cost and failed
  • a failed span shows an icon and the word Failed beside its label
  • with stepId, each step's spans are a group named by the step
  • the open span has aria-expanded and controls a named detail region
  • totals use kit NumberTransition
  • bars and axis are aria-hidden; the legend names the kinds
  • bars grow on transform, off under prefers-reduced-motion
defaults
  • status complete
  • compact false
  • currency $
  • loading false
stops if
  • Do not invent a local Waterfall, TraceChart, or SpanList
  • Do not use BarChart or Meter for a run trace
  • Do not encode failed or running by colour alone
  • Do not use raw hex
  • Do not make the bars square or pill; they use radius.controlSm like every kit meter. Legend marks stay square

From contracts/tracewaterfall.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
titlestringYes——
spansarrayYes—{ id, label, kind: "model" | "tool" | "wait" | "approval" | "other", startMs, endMs?, cost?, tokensIn?, tokensOut?, failed?, stepId?, detail? }[]; offsets from the run start; open spans draw dashed to now, and the legend adds "dashed = still running" only while at least one span has no endMs. stepId groups spans under a step heading, shown as written (e.g. "1 · Fetch Stripe charges").
statusrunning | complete | failedNocomplete—
totalMsnumberNo——
totalCostnumberNo——
errorstringNo—Failed run: why, under the spans.
selectedIdstringNo——
onSpanClickfunctionNo—(id | null) => void. Rows become buttons that open the span detail.
compactbooleanNofalse—
currencystringNo$—
loadingbooleanNofalse—
loadErrorstringNo——
onRetryfunctionNo——
  • Component
    →

    Bar

    Compare magnitudes across categories with vertical or horizontal bars.

  • Component
    →

    UsageMeter

    Plan usage or AI credits against a limit: total, usage by category, daily bars toned against the cap, and a warning near the limit.

  • Component
    →

    AgentTrail

    A vertical step list for a running agent task: done steps with durations, the current step with a live timer, then pending steps.

  • Component
    →

    Empty

    Placeholder when a list, page, or region has nothing to show.