Xzero UI
Pro library

Agent planPro

The plan an agent writes before it acts: edit, reorder or add steps while it is a draft, then watch it work through them as a live checklist.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/agent-plan
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/agent-plan

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { AgentPlan, type AgentPlanStep } from "@/components/xzero/agent-plan/agent-plan";

// With no props it shows a sample plan and simulates the run.
export function PlanDemo() {
  return <AgentPlan />;
}

// Driven by your agent.
export function AgentPlanPanel({ run }) {
  return (
    <AgentPlan
      goal={run.goal}
      steps={run.steps}           // [{ id, title, state, substeps, note, error, duration }]
      status={run.status}         // "draft" | "running" | "paused" | "done"
      summary={run.summary}
      model={{ name: "Claude Sonnet 5.5", mark: <ClaudeMark /> }}
      onChange={steps => run.updateDraft(steps)}
      onKeepPlanning={() => run.suggestStep()}
      onApprove={steps => run.start(steps)}
      onPauseChange={paused => (paused ? run.pause() : run.resume())}
      onStepAction={({ type, step }) => (type === "retry" ? run.retry(step.id) : run.skip(step.id))}
    />
  );
}

// A step the agent is working on, and one it inserted.
const steps: AgentPlanStep[] = [
  { id: "store", title: "Keep request counters in Redis with a 60 second TTL", state: "active", substeps: ["Read lib/redis.ts", "Ran 6 tests"] },
  { id: "fallback", title: "Fall back to in-memory counters when Redis is down", note: "Added by agent" },
];

API reference

AgentPlan

The plan an agent writes before it acts, then works through as a live checklist. A header shows the model mark, "Plan · 6 steps" and the goal. While the plan is a draft every step can be renamed in place, dragged or moved with Alt and the arrow keys, removed, or added to, and Keep planning streams one more suggested step in before the last one. Approve plan locks it: the grips become status rings, the header counts "3 of 6" over a thin progress line, the current step shimmers beside a small spinner with its activity lines underneath, and a finished step draws its check and settles to secondary text with its time on the right. The agent can insert a step mid-run (it slides in with an "Added by agent" note), a failed step offers Retry and Skip, the run can be paused and resumed, and the footer ends with a one line summary and the total time. Without status it runs a simulated agent so the whole journey can be tried in place.

PropTypeDefaultDescription
stepsAgentPlanStep[]sampleStepsThe plan. Each step has an id and a title, and optionally a state ("pending", "active", "done", "failed" or "skipped"), substeps (short activity lines; the first word, such as Read, Edited, Created, Searched or Ran, picks the icon), a note ("Added by agent"), an error for a failed step, and a duration in seconds for a done step. A new array replaces the plan on screen.
status"draft" | "running" | "paused" | "done"–Where the plan stands. Pass it to drive the plan from your agent: the component then never changes status or steps on its own and reports every action through the callbacks. Leave it out to run the built-in simulation.
goalstring"Add rate limiting to the public API"What the plan is for, shown under the header and used in the plan's accessible name.
model{ name: string; mark?: ReactNode }{ name: "Claude Opus 5.5", mark: <ClaudeBrandMark /> }The model that wrote the plan. The 16px mark sits in the header and before agent notes; the name shows in the header while the plan is a draft.
summarystring–One line shown after "Done in 4m 35s." when the plan finishes. It streams in. The total time is the sum of the done steps' durations.
onApprove(steps: AgentPlanStep[]) => void–Called by Approve plan with the steps in their final order, titles trimmed and empty steps removed. Start your agent here and set status to "running".
onChange(steps: AgentPlanStep[]) => void–Called after each draft edit: a rename (on Enter or blur), a reorder (on drop or key press), a removal, an added step, or a suggested step that finished streaming.
onStepAction(action: { type: "retry" | "skip"; step: AgentPlanStep }) => void–Called when someone retries or skips a failed step. Focus is handled for you; update the step's state in steps.
onKeepPlanning() => void–Called by Keep planning. Ask the agent for one more step and add it to steps.
onPauseChange(paused: boolean) => void–Called by Pause (true) and Resume (false). Pause your agent and set status to "paused", or back to "running".
classNamestring–Class on the root element.

Keyboard interactions

KeysAction
TabIn a draft, moves through each step's grip, title and remove button, then Add step, Keep planning and Approve plan. While running, reaches Retry and Skip on a failed step and Pause or Resume.
Alt + Arrow up / Arrow downIn a step title, moves that step up or down and keeps the caret in place.
Arrow up / Arrow downOn a step's grip, moves that step up or down.
EnterIn a step title, saves the rename without leaving the field.
EscapeIn a step title, undoes the rename since the field was focused.
BackspaceIn an empty step title, removes the step and moves focus to the step above.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in ai

Guidance for AI tools

Agent plan: The plan an agent writes before it acts: edit, reorder or add steps while it is a draft, then watch it work through them as a live checklist. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components