affectUI › Components › Agents

Agent Timing

An agent run as a timing diagram – time runs left to right, you and every agent a row with its own signal line. Idle it rests on the baseline, thinking it steps up a little, calling a tool all the way up with the tool's name under the line, waiting on you a dashed amber step – one line per row, rounded where it steps and gliding to each new level, a soft fill under it fading down, so steps that touch flow into each other. The step still running ends in a softly pulsing dot on the now line, and beside every name stands what it does right now. Hand-offs are dashed lines straight to the other row, drawn in as they happen, with a small white dot where they land. Point at a step or a hand-off for what it was, when and how long.

Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/agent-timing.json · Import from @/components/ui/agent-timing

When to use

  • An agent run where it matters when each agent worked, how long, and where it waited
  • Finding where a run loses time – long tool calls, agents sitting idle, the run waiting on you
  • A live view of a multi-agent run next to its chat or log

When not to use

  • Who said what to whom, in order – use Agent Sequence
  • Spans of one trace with their nesting – use Trace Waterfall
  • Agents working side by side on separate tasks – use Agent Lanes

Usage

import { AgentTiming, type TimingParticipant, type TimingSegment, type TimingHandoff } from "@/components/ui/agent-timing";

const participants: TimingParticipant[] = [
  { id: "you", name: "You", kind: "person" },
  { id: "lead", name: "Lead" },
  { id: "coder", name: "Coder" },
];

const segments: TimingSegment[] = [
  { who: "lead", state: "thinking", start: 0.5, end: 4, label: "Planning the fix" },
  { who: "lead", state: "tool", start: 4, end: 8, label: "search_code" },
  { who: "coder", state: "tool", start: 9, label: "edit_file" }, // no end – still running
];

const handoffs: TimingHandoff[] = [
  { from: "you", to: "lead", at: 0.2, label: "Fix the cart total bug" },
  { from: "lead", to: "coder", at: 8.6, label: "Fix rounding in cart.ts" },
];

export function Run({ now }: { now: number }) {
  return <AgentTiming title="Fix the cart total" participants={participants} segments={segments} handoffs={handoffs} now={now} />;
}

Props

NameTypeDefaultDescription
participantsTimingParticipant[]The rows – { id, name, kind?, color? }. person is the full pixel mark in ink; agents their own mark, the first blue, the others the palette
segmentsTimingSegment[]What each one did – { who, state, start, end?, label?, id? } in seconds from the start. thinking is a low step, tool a high one with its name, waiting a dashed amber step. No end: it still runs and reaches to now
handoffsTimingHandoff[]Hand-offs – { from, to, at, label?, id? }. A thin arrow from one row to the other, drawn in as now passes it
nownumberSeconds since the run started – the now line; steps without an end grow to it. Leave it out for a finished run
durationnumberSeconds the axis shows – by default the run's length with a little room
titlestringThe run's name in the bar
classNamestringExtra class on the root – set the color variables on it, e.g. --ui-atg-gutter

Keyboard

  • Tab: One stop for the diagram
  • ← / →: The step before or after in the same row – each shows its card
  • ↑ / ↓: The nearest step in the row above or below
  • Home / End: The row's first or last step
  • Esc: Hides the card

Accessibility

  • Steps and hand-offs are a list; each reads who, what, when and how long – "Coder, tool call, edit_file, from 0:17 for 5.5s"
  • Waiting on you shows as words in the bar, not only as amber
  • Every step names itself inside when there is room – the tool, what it thinks about, "Waiting on you"
  • Focus rings show for the keyboard only (:focus-visible)

Responsive

  • The time axis fits the width – a tick about every 90px, in seconds, minutes or hours
  • Narrow: the names and what they do become their pixel marks, the counts go under the title
  • Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"

Requirements

  • React 19

Related

  • Agent Sequence – One agent run as a sequence diagram – a column for you, every agent and every tool, and each message an arrow from one lifeline to the next: calls solid, replies dashed, every label a tag in its line's color, a bar on the lifeline while a participant works, parallel and retried messages in labelled frames; new messages draw themselves across with a light at the tip, and a click on a participant or a message opens its card
  • Trace Waterfall – Where the time and money of an agent run go – every LLM call, tool call and sub-agent as a bar on a live timeline, with tokens and cost per step, the slowest call marked and branches that fold into their parent
  • Agent Lanes – Where every agent is right now – a live timeline with a lane per agent, tasks growing into “now”, hand-offs drawn between agents and approvals right on the block
  • Agent Handoff – A task passed from agent to agent like a relay – at every handoff what went along to the next one, and what got lost on the way