UI

Plan

Present a draftable, reorderable agent plan that locks on approval into a live executing checklist with progress, activity substeps, failure recovery, and a completion summary.

import { AgentPlan } from '@uthereal/ui/agent-plan'

Agent plan playground

Plan5 steps

Claude Sonnet 5.5

Add rate limiting to the public API

Alt plus Arrow up or down moves a step. Escape undoes a rename.

Loading interactive preview…

Overview

AgentPlan displays the multi-step plan an AI agent proposes before it edits code, runs commands, or modifies production state. While in the draft phase, the user can rename steps inline, reorder them by dragging or with the keyboard, remove steps, add new steps, or request another suggestion with Keep planning. Selecting Approve plan locks the list into a live checklist with a header progress bar, shimmering active step, activity substeps, pause and resume controls, failure recovery, and a final completion summary.

Use AgentPlan when the user reviews and edits an ordered plan up front, then tracks execution on the same surface. For a multi-agent execution timeline with handoffs and token metrics, use Agent timeline. For individual tool call inputs, outputs, and single-action approvals, use Tool call. For a formatted, cited final response, use Answer.

Usage

'use client'
import { AgentPlan, type AgentPlanStep } from '@uthereal/ui/agent-plan'

export function ReleasePlan({
  steps,
  status,
  summary,
  onUpdateDraft,
  onSuggestStep,
  onStartRun,
  onPauseChange,
  onStepAction,
}: {
  steps: AgentPlanStep[]
  status: 'draft' | 'running' | 'paused' | 'done'
  summary?: string
  onUpdateDraft: (steps: AgentPlanStep[]) => void
  onSuggestStep: () => void
  onStartRun: (steps: AgentPlanStep[]) => void
  onPauseChange: (paused: boolean) => void
  onStepAction: (action: {
    type: 'retry' | 'skip'
    step: AgentPlanStep
  }) => void
}) {
  return (
    <AgentPlan
      goal="Add rate limiting to the public API"
      modelName="Claude Sonnet 5.5"
      modelBrand="anthropic"
      status={status}
      steps={steps}
      summary={summary}
      onChange={onUpdateDraft}
      onKeepPlanning={onSuggestStep}
      onApprove={onStartRun}
      onPauseChange={onPauseChange}
      onStepAction={onStepAction}
    />
  )
}

Pass status to drive the plan deterministically from your agent host; the component never mutates status on its own and reports every user interaction through React callbacks or named onAction events. Omit status to render the interactive draft with a built-in simulated run after approval.

Examples

Live execution and agent-inserted steps

Drive status="running" or status="paused" from the host to track active progress. Completed steps settle to secondary text with their duration on the trailing edge and expand on click to inspect past substeps. Steps added mid-run display an attribution note with the model mark.

Plan3 steps

2 of 3

Add rate limiting to the public API

Alt plus Arrow up or down moves a step. Escape undoes a rename.
  1. Done:
    21s
  2. In progress:
    Fall back to in-memory counters when Redis is down

    Added by agent

    • Read lib/redis.ts
    • Edited middleware/rate-limit.ts
  3. Pending:
    Return 429 with Retry-After and RateLimit headers
Working on step 2

Failure recovery and completion summary

Set a step's state to "failed" with an error message to pause execution and show inline Retry and Skip controls. When all steps settle and status="done", the footer sums completed durations and displays the summary.

Plan3 steps

2 of 3

Add rate limiting to the public API

Alt plus Arrow up or down moves a step. Escape undoes a rename.
  1. Done:
    42s
  2. Failed:
    Write tests for limits, bursts and window resets
    • Created rate-limit.test.ts
    • Ran 12 tests

    Failed 2 of 12 tests failed: the window resets one second late

  3. Pending:
    Document the limits in the API reference
Step 2 failed

Plan3 steps

3 of 3

Add rate limiting to the public API

Alt plus Arrow up or down moves a step. Escape undoes a rename.
  1. Done:
    21s
  2. Done:
    48s
  3. Skipped:
    Run optional k6 load test against staging

Done in 1m 09s.

Step lifecycle and substeps

Each step uses a distinct geometric glyph so status never relies on color alone.

StateGlyphBehavior
pendingOpen ringQueued work waiting to start.
activeSpinning arcTitle shimmers and activity substeps stay open. Shows pause bars when status="paused".
doneFilled check discDraws its check stroke, settles to secondary text, shows durationSec, and toggles substeps on click when present.
failedExclamation discShows error detail with Retry and Skip buttons and keeps substeps visible.
skippedDashed ringMuted title with Skipped label in the trailing column.

Substep lines automatically choose an icon from their leading past-tense verb:

Leading verbIcon
Readfile-text
Edited, Updatedpencil
Created, Wrote, Addedfile
Searched, Foundsearch
Ranterminal
Measuredsignal-high
Other verbscircle-dot

API reference

These serializable arguments and defaults come directly from the component schema.

ArgumentType / defaultDescription
goalstringDefault: "Add rate limiting to the public API"Short statement of what the plan accomplishes, shown beneath the header and used in the accessible section name.
modelNamestringDefault: "Claude Sonnet 5.5"Model name displayed in the header during the draft phase and included in the section label.
modelBrandanthropic | openai | google | mistral | xai | customDefault: "anthropic"Provider brand mark rendered in the header and beside agent-inserted step notes.
statusdraft | running | paused | done—Controlled plan phase (draft, running, paused, done). Pass to drive execution from your agent; omit to run interactive draft editing and a built-in simulation.
defaultStatusdraft | running | paused | doneDefault: "draft"Initial phase when status is omitted; edits do not reset a mounted instance.
stepsAgentPlanStep[]Default: [{"id":"map","title":"Map the public routes under api/v1","state":"pending","substeps":[]},{"id":"limiter","title":"Add a sliding window limiter to the API middleware","state":"pending","substeps":[]},{"id":"store","title":"Keep request counters in Redis with a 60 second TTL","state":"pending","substeps":[]},{"id":"headers","title":"Return 429 with Retry-After and RateLimit headers","state":"pending","substeps":[]},{"id":"tests","title":"Write tests for limits, bursts and window resets","state":"pending","substeps":[]},{"id":"docs","title":"Document the limits in the API reference","state":"pending","substeps":[]}]Ordered plan steps with unique IDs, states, optional activity substeps, notes, error reasons, and durations in seconds; arrays replace on edit.
summarystring—One-line completion summary shown after the summed duration when status is done.
editablebooleanDefault: trueAllow inline renaming, dragging or keyboard reordering, removing, adding steps, and Keep planning while in draft phase.
approveActionstring—Registered host action requested when Approve plan is pressed.
keepPlanningActionstring—Registered host action requested when Keep planning is pressed.
pauseActionstring—Registered host action requested when Pause is pressed.
resumeActionstring—Registered host action requested when Resume is pressed.
retryActionstring—Registered host action requested with the step ID when Retry is pressed on a failed step.
skipActionstring—Registered host action requested with the step ID when Skip is pressed on a failed step.
localestring—BCP 47 locale for duration and numeric formatting; inherited when omitted.
recipestudio | softDefault: "studio"Visual treatment. Both recipes preserve interaction behavior.
themeAgentPlanThemeDefault: {}Color mode, accent, and typed semantic token overrides.
motionnone | subtle | expressiveDefault: "subtle"Animation preset. System reduced-motion preferences take precedence.
motionOptionsAgentPlanMotionOptionsDefault: {}Row glide spring and streamed text chunk timing overrides in milliseconds.
dirltr | rtl—Reading direction; inherited from the page when omitted.

AgentPlanStep accepts { id, title, state?, substeps?, note?, error?, durationSec? }.

React integration

PropPurpose
onChange(steps)Called after each draft edit: rename, reorder, remove, add, or completed suggestion stream.
onApprove(steps)Called by Approve plan with trimmed, non-empty steps in their final order.
onKeepPlanning()Called when Keep planning is pressed.
onPauseChange(paused)Called by Pause (true) and Resume (false).
onStepAction({ type, step })Called when Retry or Skip is pressed on a failed step.
onAction(action, stepId?)Called for registered host actions (approveAction, keepPlanningAction, pauseAction, resumeAction, retryAction, skipAction).
renderModelMark()Custom 16px decorative model mark replacing the built-in modelBrand mark.
presetApplication defaults overridden by explicit instance arguments.
tokensCSS variables applied after the typed theme.
ref, className, styleApplied to the root <section> element.
Native attributesid, aria-*, data-*, and remaining <section> props forwarded to the root.

Keyboard & accessibility

KeyAction
TabMoves across step grips, editable titles, remove buttons, Add step, and footer controls.
Alt + ArrowUp / ArrowDownReorders the focused step up or down inside its title field while preserving the caret.
ArrowUp / ArrowDownReorders the step up or down when focused on its drag grip button.
EnterCommits a draft title edit without leaving the field.
EscapeReverts the draft title to its value before focus.
BackspaceRemoves an empty draft step and moves focus to the preceding step.

The root renders a <section> labelled by modelName and goal, and steps render inside an ordered <ol> list. Each non-draft step announces its state word (Pending, In progress, Done, Failed, Skipped) before its title. A polite role="status" live region announces draft edits, approval, inserted steps, failures, pause state, and completion. Focus follows every action: moved steps retain focus, removed steps hand focus to a neighbour, and Approve plan, Retry, and Skip hand focus to the execution control. The header rule acts as a role="progressbar" with aria-valuetext once approved. Logical CSS properties keep alignment consistent in RTL (dir="rtl"), and forced-colors: active maps progress fills, status discs, and focus outlines to system colors.

Motion and theming

Step inserts, removals, reorders, substep lists, and footer height changes move on a critically damped 260ms spring with no overshoot. Fixed lead (20px) and trail (48px) grid tracks prevent step titles from reflowing when switching from draft to execution. Completing a step draws its checkmark stroke over 220ms, the active step runs a light shimmer that pauses when offscreen or hidden, agent-inserted rows fade out a faint accent wash over 1.8s, and header counters roll in place with tabular digits. prefers-reduced-motion: reduce drops spatial travel, spinning arcs, check stroke draws, shimmer sweeps, and washes while preserving short opacity crossfades; motion="none" makes every state transition immediate (0ms).

theme accepts a mode, an accent, and semantic tokens for surfaces, borders, text, accent, success, danger, radii, elevation, and control heights. An application-wide UtherealProvider supplies defaults.

Composition

In an agent composition, AgentPlan is a leaf. Supply status and steps from host state so the card renders deterministically without running local timers. approveAction, keepPlanningAction, pauseAction, resumeAction, retryAction, and skipAction must name registered host actions. See Building with agents.

{
  "type": "AgentPlan",
  "props": {
    "goal": "Add rate limiting to the public API",
    "modelName": "Claude Sonnet 5.5",
    "modelBrand": "anthropic",
    "status": "draft",
    "approveAction": "approve_plan",
    "keepPlanningAction": "suggest_plan_step",
    "steps": [
      { "id": "map", "title": "Map the public routes under api/v1" },
      {
        "id": "limiter",
        "title": "Add a sliding window limiter to the API middleware"
      },
      {
        "id": "tests",
        "title": "Write tests for limits, bursts and window resets"
      }
    ]
  },
  "children": []
}

On this page