Loading component…
Loading component…
An agent's step-by-step plan to review before it runs – rename, drag to reorder, remove or add steps, then watch each one run with live timers and retry from a failed step
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AgentPlan from ./agent-plan.
import { useState } from "react";
import { AgentPlan, type PlanStep } from "@/components/ui/agent-plan";
export function PlanReview({ plan }: { plan: PlanStep[] }) {
const [steps, setSteps] = useState(plan);
const [status, setStatus] = useState<"draft" | "running" | "done">("draft");
return (
<AgentPlan
title="Prepare the Q3 board update"
estimate="~2 min"
steps={steps}
status={status}
onChange={setSteps}
onRun={(final) => {
setStatus("running");
agent.run(final); // stream step updates back into setSteps
}}
onCancel={() => agent.discard()}
onRetry={(id) => agent.retryFrom(id)}
/>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| steps | PlanStep[] | Controlled steps: { id, title, detail?, tool?, status?, duration?, error? }. Pair with onChange | |
| defaultSteps | PlanStep[] | [] | Initial steps when uncontrolled – edits are kept inside the component |
| status | "draft" \| "running" \| "done" | "draft" | Review and edit, executing, or finished. Editing is only possible in draft |
| onChange | (steps: PlanStep[]) => void | Every edit during review: rename, remove, reorder, add | |
| onRun | (steps: PlanStep[]) => void | "Run plan" pressed – gets the steps in their final order. Set status to "running" here. Also shows "Run again" on the tray once done | |
| onCancel | () => void | Shows a Cancel button next to Run plan | |
| onRetry | (stepId: string) => void | Shows "Retry from here" under failed steps | |
| title | string | The goal of the plan, shown as the heading and used as the list's label | |
| estimate | string | Estimated run time shown in review, e.g. "~2 min" | |
| className | string | Extra class on the root |
Fills its container up to 460px; titles and details wrap, tool chips stay on one line
Below 400px the footer hint drops away, below 340px gutters tighten – works down to 320px
On touch screens the grip and remove button are always visible
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"