Loading component…
Loading component…
A run of agents working in steps – Plan, Build, QA, Review, Security – as a row of cards, with every time the run went back drawn as a counted arc underneath.
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AgentLoop from ./agent-loop.
import { AgentLoop, type LoopStep, type LoopBack, type LoopArtifact } from "@/components/ui/agent-loop";
const steps: LoopStep[] = [
{ id: "plan", label: "Plan", status: "done", model: "Claude Opus 5.5", logo: <ClaudeLogo />, summary: "Split the task into 4 changes", time: 66000, tokens: 15400,
tools: [{ name: "Linear", logo: <LinearLogo /> }] },
{ id: "build", label: "Build", status: "running", model: "GPT-5.1 Codex", logo: <OpenAILogo />, summary: "Fixing the Pay button", time: 192000, tokens: 61000, progress: 0.4 },
{ id: "qa", label: "QA", status: "queued", model: "Gemini 3 Pro", logo: <GeminiLogo /> },
{ id: "review", label: "Review", status: "queued" },
];
const loops: LoopBack[] = [
{ from: "qa", to: "build", label: "checks failed", count: 2, reasons: ["Pay overlaps the footer at 375px", "Total off by one cent"] },
];
const artifacts: LoopArtifact[] = [
{ id: "s1", kind: "screenshot", step: "qa", title: "Checkout · 375px", status: "fail", src: "/shots/checkout-375.png", logo: <ChromeLogo /> },
{ id: "l1", kind: "log", step: "build", title: "Build log", status: "pass", lines: ["$ npm run build", "✓ built in 3.8s"] },
];
export function Run() {
return <AgentLoop title="Dev loop" subtitle="shop · feat/coupons" logo={<GitHubLogo />} steps={steps} loops={loops} artifacts={artifacts} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| steps | LoopStep[] | Every step in order – { id, label, status, agent?, model?, logo?, summary?, time?, tokens?, progress?, tools? } | |
| logo | ReactNode | On a step: the model maker's logo before the model. On the root: a logo before the subtitle, e.g. GitHub for the repo | |
| tools | { name, logo? }[] | The tools a step works with – small overlapping tiles with their logos on its card, by name in its card | |
| status | "queued" \| "running" \| "done" \| "failed" | Running takes a soft wash of the agent's blue and shows a progress bar; failed gets a red edge | |
| progress | number | 0–1 on the running step; left out, its bar sweeps | |
| agent | { id?, name?, color? } | The agent doing the step – its pixel mark comes from its id (by default the step's id), in its color; by default each step's agent gets its own from a quiet palette | |
| loops | LoopBack[] | { from, to, count, label?, reasons?, id? } – the run going back from a later step to an earlier one (or the same one), drawn as an arc underneath with a count | |
| title / subtitle | string | The header – "Agent loop" by default; the subtitle sits next to it in grey | |
| iteration | number | Shown in the header – by default 1 + every time the run went back | |
| onSelect | ({ step } \| { loop } \| { artifact } \| null) => void | A step's, a loop's or an artifact's card opened or closed | |
| children | ReactNode | A slot under the artifacts | |
| formatTime | (ms) => string | Formats the times – 12s, 2m 05s by default | |
| className | string | An extra class on the root |
The classic style has a rounder card with a hairline border, rounder steps, pill tags and firmer type – the same behavior as the clean one
Fills its container's width – the cards share it, from 124 to 260px each; short of room the gaps narrow first
Still too wide, the row scales down to fit – it never scrolls sideways
Under 560px the steps stack and the arcs run down the right side
Every card has three fixed lines – name with the model's logo and the status, summary, tokens with the tools (the time is in its card) – so nothing jumps as it changes; on narrow cards the model shows only its logo, its name is in the card; long text ends in …; short of room the tool tiles give way, never the tokens
Tokens are short – 4.8K, 48K, 1.2M; times and tokens that aren't numbers are left out
Loops to steps that don't exist, forward loops and repeated ids are left out
Artifacts fill a grid of 118px tiles that wraps
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"