Installation
Usage
"use client"
import { AgentRunMonitor, type RunStep } from "@/components/agent-run-monitor"
const steps: RunStep[] = [
{ id: "1", agent: "plan", name: "Plan the work", kind: "model", status: "done", start: 0, end: 6, tokens: 3400, cost: 0.04 },
{ id: "2", agent: "code", name: "Write change", kind: "model", status: "running", start: 6, tokens: 5200, cost: 0.08 },
{ id: "3", agent: "code", name: "Run the migration", kind: "approval", status: "waiting", start: 14, input: "ALTER TABLE plans ADD COLUMN billing text" },
]
export function RunView() {
return (
<AgentRunMonitor
title="Ship yearly billing"
agents={[
{ id: "plan", name: "Planner", detail: "large model" },
{ id: "code", name: "Coder", detail: "repo tools" },
]}
steps={steps}
elapsed={16}
status="waiting"
budget={1.5}
onApprove={(step) => console.log("approved", step.id)}
onDeny={(step) => console.log("denied", step.id)}
/>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| agents | RunAgent[] | — | One lane each: id, name, an optional detail (model, tools) and colour. |
| steps | RunStep[] | — | id, agent, name, kind ("model", "tool" or "approval"), status (queued, running, waiting, done, failed, denied, skipped), start and end in seconds, and optional tokens, cost, tool, model, input and output. |
| elapsed / status | number / RunStatus | — | Seconds since the run started, and running, paused, waiting, done, failed or stopped. You keep the clock, so the server and the browser agree. |
| title / subtitle | string | — | The run's name and a line under it. |
| budget / currency | number / string | — / "USD" | The spending limit: the bar warns at half and turns red past 80%. |
| plannedSteps | number | steps.length | How many steps the plan expects, for the Steps count. |
| onApprove / onDeny | (step) => void | — | Answers a step waiting for a person. renderApproval adds content to the card. |
| onPause / onResume / onStop | () => void | — | Show Pause, Resume and Stop run while the run is live. |
| locale | string | "en-US" | Formats money and numbers. |
Accessibility
- Each agent's lane is a labelled group; every step is a button named with its status, start and duration, and opens its details.
- A step waiting for approval raises an alert dialog with focus on Approve.
- Failures, approvals and the end of the run are announced once each through a polite live region.
- The budget bar is a meter with its value in words; the stats are a description list.
- Under prefers-reduced-motion running steps don't sweep and the status doesn't pulse.
Changelog
- v1.0.0Latest
First release.