One agent at work, as a card: its current step with a clock and the bill so far, a time strip and the finished steps with each tool's logo, the exact command when it needs your OK, and a small bar when folded.
Used for
- Watch one agent work
- Allow a risky command
- Pause or cancel a run
- Show run cost live
- Summarise a finished run
Examples
Installation
npx knowns-ui@latest add agent-monitorFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Agent monitor from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/agent-monitor
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add agent-monitor
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/icons/actor-icon.tsx
- lib/knowns/icons/model-icons.tsx
- lib/knowns/icons/tool-icons.tsx
- lib/knowns/icons/model-icons.data.ts
- lib/knowns/icons/tool-icons.data.ts
- lib/knowns/icons/LICENSES.md
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/kbd.tsx
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/popover.tsx
- components/ui/knowns/agent-monitor/agent-monitor.tsx
- components/ui/knowns/agent-monitor/monitor-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/agent-monitor, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "agent-monitor" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- state
"running"|"paused"|"waiting"|"finished"|"failed"|"idle"- Default
from run, else idle - Tag colour and what the well shows. waiting turns the well amber and the footer into Decline / Allow.
- agent
{ name, role?, model?, icon? }- Header. model picks the provider logo (modelIcon); icon overrides it.
- steps
{ id, label, kind?, tool?, icon?, state, since?, took?, detail?, output? }[]- Default
[] - state: queued | running | done | failed. Finished steps list newest first (3 rows, then scroll); every started step gets a bar in the time strip, width ∝ took. tool picks the brand logo, kind a glyph.
- current
{ label, tool?, icon?, since? }- Default
the running step - The live line in the well, with a ticking clock from since.
- since / until / pausedFor
epoch ms / epoch ms / ms- Run clock: (until ?? now) − since − pausedFor, shown as "Finished in 19s". While paused the clock and bars hold.
- cost
number|string- Numbers go through formatUsd. Shimmers while running.
- ask
{ title, command?, tool?, since? }- While waiting: the title and the exact command as inline code. since grows the amber wait bar.
- outcome / error
{ added?, removed?, files?, note? } / ReactNode- Finished: "+1284 −316 · 42 files · Tagged v3.2.0". Failed: the error line.
- run / actor
AgentRun / string- Live from a run: the actor's tasks become steps (the tool it called most gives the logo), its open tool call is the current line, spend is the cost, a pending approval is the ask. Allow / Decline emit approval.resolve. Explicit props still win.
- onAllow / onDecline
() => void- Allow (⏎) and Decline (Esc) while the card has focus and is waiting - never global. Enter on another control in the card does that control's job.
- onPause / onResume / onCancel / onLog
() => void- Each button shows only when its handler is given.
- collapsed / defaultCollapsed / onCollapsedChange
boolean- Default
false - Folds into a 40px bar: logo, name, state dot, the tools used, cost. Height animates by grid rows.
- a11y
role=group- Labelled by the agent's name; state changes and the ask are announced politely. Rows are buttons that open the step's info card; bars do the same with the mouse.
| Prop | Type | Default | Description |
|---|---|---|---|
| state | "running" | "paused" | "waiting" | "finished" | "failed" | "idle" | from run, else idle | Tag colour and what the well shows. waiting turns the well amber and the footer into Decline / Allow. |
| agent | { name, role?, model?, icon? } | - | Header. model picks the provider logo (modelIcon); icon overrides it. |
| steps | { id, label, kind?, tool?, icon?, state, since?, took?, detail?, output? }[] | [] | state: queued | running | done | failed. Finished steps list newest first (3 rows, then scroll); every started step gets a bar in the time strip, width ∝ took. tool picks the brand logo, kind a glyph. |
| current | { label, tool?, icon?, since? } | the running step | The live line in the well, with a ticking clock from since. |
| since / until / pausedFor | epoch ms / epoch ms / ms | - | Run clock: (until ?? now) − since − pausedFor, shown as "Finished in 19s". While paused the clock and bars hold. |
| cost | number | string | - | Numbers go through formatUsd. Shimmers while running. |
| ask | { title, command?, tool?, since? } | - | While waiting: the title and the exact command as inline code. since grows the amber wait bar. |
| outcome / error | { added?, removed?, files?, note? } / ReactNode | - | Finished: "+1284 −316 · 42 files · Tagged v3.2.0". Failed: the error line. |
| run / actor | AgentRun / string | - | Live from a run: the actor's tasks become steps (the tool it called most gives the logo), its open tool call is the current line, spend is the cost, a pending approval is the ask. Allow / Decline emit approval.resolve. Explicit props still win. |
| onAllow / onDecline | () => void | - | Allow (⏎) and Decline (Esc) while the card has focus and is waiting - never global. Enter on another control in the card does that control's job. |
| onPause / onResume / onCancel / onLog | () => void | - | Each button shows only when its handler is given. |
| collapsed / defaultCollapsed / onCollapsedChange | boolean | false | Folds into a 40px bar: logo, name, state dot, the tools used, cost. Height animates by grid rows. |
| a11y | role=group | - | Labelled by the agent's name; state changes and the ask are announced politely. Rows are buttons that open the step's info card; bars do the same with the mouse. |
What it handles
- 01Shows the agent's name, role and model logo above a well that holds the current step, a run clock and the cost so far.
- 02Runs the clock as until, or now, minus since and pausedFor, so the clock holds while the state is paused.
- 03Draws a time strip with one bar per step and finished steps below it with their tool logos and how long each took.
- 04Asks for permission with the exact command in inline code, and wires Allow to Enter and Decline to Escape through aria-keyshortcuts.
- 05Offers Pause, Resume, Cancel and View log only when you pass the matching handler, and its state label reads Idle, Running, Paused, Needs you, Finished or Failed.
- 06Folds to one line with a state dot through collapsed, and derives every field from an actor in a run when you pass run and actor.
States
- First render
- Nothing. It paints as it is
- none
- Card collapses or opens
- The body folds and fades
- 280ms, ease out
- Strip while running
- Bars grow with the clock once a second
- none
- Strip after the run
- Bars settle to their final length
- 280ms, ease in-out
- Step row hover
- The row tints
- 120ms, ease out
- Chevron flips
- It rotates half a turn
- 180ms, ease out
- Reduced motion
- Fold, strip and chevron change at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. It paints as it is | none |
| Card collapses or opens | The body folds and fades | 280ms, ease out |
| Strip while running | Bars grow with the clock once a second | none |
| Strip after the run | Bars settle to their final length | 280ms, ease in-out |
| Step row hover | The row tints | 120ms, ease out |
| Chevron flips | It rotates half a turn | 180ms, ease out |
| Reduced motion | Fold, strip and chevron change at once | 0ms |
Works with
- ButtonInstalled with it. Allow, Decline, Pause and Cancel are its buttons.
- KbdInstalled with it. Shows the Enter and Esc keys on Allow and Decline.
- PopoverInstalled with it. Each step opens an info card with its detail and output.
- Approval promptPairs with it: the monitor holds one agent's ask, the prompt lists every ask in the run.
When to use
When to use
- Watching one agent at work: current step with a clock and cost, recent steps, and the exact command when it needs your OK.
- A side panel or card that folds into a small bar when the user looks elsewhere.
When not to use
- Many agents at a glance: use Agent Fleet.
- Detailed timing of every call: use Trace Waterfall.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Agent Monitor to my app and wire it to my own data.
- I need watching one agent at work: current step with a clock and cost, recent steps, and the exact command when it needs your OK. Set that up with the Knowns UI Agent Monitor.
- Which Agent Monitor props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "agent-monitor" }) and search_docs({ query: "agent monitor" }).