Skip to content
GitHub (opens in a new tab)

AgentMonitor

One agent at work: a live clock and running cost lead; finished steps sit in a time strip you can open. Waiting shows the exact action as an ApprovalCard.

stableOrganismcontracts/agentmonitor.json

Preview

AgentMonitor

One agent at work. Not RunningNow. Not AgentFleet.

Master

A running agent. Click a step in the strip to open its detail. Variants shows each status.

Refactor billing service

claude-code · acme-demo · example data

Running

Searching src/billing

02:14

elapsed

$0.42

cost so far

Steps0 done · 1 running

Flaky test hunt

Rerunning the suite

Running05:31$0.71

Usage

AgentMonitor watches one run. Its pending action is a kit ApprovalCard, so Approve stays the one solid primary. Many agents at a glance belong in RunningNow.

Do's

  • watch one agent run in detail
  • inspect a step's duration, tokens and cost
  • approve the agent's next action in place
  • pause, resume, stop, cancel or retry a run

Don'ts

  • many agents at a glance — RunningNow
  • many agents with sub-agents — AgentFleet
  • a step-by-step log with labels — AgentTrail
<AgentMonitor
  name="Refactor billing service"
  status="running"
  elapsed="02:14"
  cost="$0.42"
  steps={steps}
  selectedStepId={stepId}
  onSelectStep={setStepId}
/>

When to use

  • watch one agent run in detail
  • inspect a step's duration, tokens and cost
  • approve the agent's next action in place
  • pause, resume, stop, cancel or retry a run

When not to use

  • many agents at a glance — RunningNow
  • many agents with sub-agents — AgentFleet
  • a step-by-step log with labels — AgentTrail

What an agent reads

import { AgentMonitor } from "agentic-ds-kit";
must
  • section aria-labelledby the h3 name
  • the clock is role=timer with aria-live off
  • strip steps are toggle buttons (aria-pressed) named with tool, status and duration
  • the detail panel is a named region with a Close button
  • pending action is a kit ApprovalCard (Enter / Escape)
  • collapse is a button with aria-expanded
  • motion is transform and opacity, plus a stroke draw when the run turns done or failed live (headline, collapsed bar and final step; a first load stays still), off under prefers-reduced-motion
  • Stop run opens a kit AlertDialog (role alertdialog, focus trapped, Escape cancels) before onStop
  • collapsed: status is a Badge with an icon and the word; elapsed and cost are a dl, the clock role=timer
defaults
  • status running
  • collapsed false
  • loading false
stops if
  • Do not invent a local AgentMonitor, RunCard, or AgentStatusCard
  • Do not rebuild the approval UI; pass pendingAction
  • Do not end a run without the Stop run confirmation; pass onStop
  • Only one solid primary, the pending Approve; run actions are outline or ghost
  • Do not use raw hex

From contracts/agentmonitor.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
namestringYes——
metastringNo—e.g. "claude-code · acme-demo".
statusenumNorunningidle shows Empty with Start run. idle | running | waiting | paused | done | failed
headlinestringNo—Over the clock, e.g. "Editing src/billing/invoice.ts".
headlineNotestringNo—e.g. "step 6".
elapsedstringNo—Run clock, e.g. "02:14".
coststringNo——
stepsarrayNo—{ id, tool, status: "done" | "running" | "waiting" | "failed", icon?, target?, duration?, tokens?, cost?, started?, weight? }[]. Every step in the strip has the same width; weight is ignored (deprecated).
axisstring[]No—Start and end labels under the strip, e.g. ["0:00", "2:14"]. Step tiles are equal widths, so only the first and last labels show.
selectedStepIdstringNo——
onSelectStepfunctionNo—(id | null) => void. Strip steps become toggle buttons; the detail panel has Close.
pendingActionobjectNo—Waiting: { title, description?, risk?, action, waitingSec? } rendered as a kit ApprovalCard with variant="compact": the title row ("waiting m:ss" when waitingSec is set), one line of description, the exact action and small Deny / Approve.
onApprovefunctionNo——
onDenyfunctionNo——
errorstringNo—Failed detail line in mono.
collapsedbooleanNofalseThe one-row bar: agent mark, name over a mono "02:14 · $0.42" line (other statuses lead with the word, e.g. "done · 4:02 · $0.18"), one tile per tool the run used, then the chevron. Done, failed, waiting and paused add a status icon; done drops the tools. Picking a tool opens the card on its first step. Running shows Pause and Stop run, paused shows Cancel run and Resume, on a row below.
onCollapsedChangefunctionNo——
onStartfunctionNo—Idle: Start run (outline neutral).
onPausefunctionNo—Running: Pause, beside Stop run when onStop is set.
onResumefunctionNo—Paused: Resume (outline neutral).
onCancelfunctionNo—Paused: Cancel run (outline danger).
onStopfunctionNo—Running: Stop run (sm, outline, danger) beside Pause. A kit AlertDialog confirms it once; confirming calls onStop.
onRetryfunctionNo—Failed: Retry step.
onViewDifffunctionNo—Done: View diff.
onOpenTrailfunctionNo—Done: Open trail. Failed: Open failed step.
loadingbooleanNofalse—
  • Component
    →

    RunningNow

    Many agents, small: a strip of what runs now for a header (row of chips) or a sidebar (stack), with status, activity and a clock.

  • 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
    →

    AlertDialog

    Must-choose overlay that interrupts until the user cancels or confirms.

  • Component
    →

    ApprovalCard

    The agent asks before it acts: risk, what will happen in words, an exact preview of the command or diff, and Approve (⌘/Ctrl+Enter) / Deny (Escape) with an optional auto-deny countdown.