Skip to content
GitHub (opens in a new tab)

AgentPlan

What an agent intends to do, before or during a run. People edit, accept, run, skip, stop, or retry steps.

stableOrganismcontracts/agentplan.json

Preview

AgentPlan

What the agent intends to do. Not AgentTrail. Not ProgressSteps.

Master

A draft you can edit, accept and run. Variants shows each status and its footer.

Fix invoice rounding

Running

5 steps · 0 done · 1 running

  1. Read invoice moduleRunning

    read_filesrc/billing/invoice.ts

  2. Find rounding call sitesQueued

    search_files"Math.round" in src/billing

  3. Patch totals to integer centsApprovalQueued

    edit_fileinvoice.ts, tax.ts

  4. Run unit testsQueued

    run_testsinvoice.test.ts

  5. Open pull requestApprovalQueued

    gh pr createto main, draft

Step 1 of 5 running: Read invoice module

Usage

AgentPlan is the agent's intent: people edit and accept it before it runs. Accept plan is the one solid primary; Run is outline. AgentTrail logs what already happened.

Do's

  • an agent proposes several steps and the person should accept or edit them first
  • show which planned step runs now and which need approval
  • a compact plan summary in a chat
  • say how risky each planned step is (steps[].risk) and why the agent takes it (steps[].why)
  • let people change the step order by keyboard before they accept (reorderable)
  • a long plan inside a chat answer: fold it (maxVisibleSteps), keep Accept in reach (stickyFooter) and link to the step that needs approval (approvalLinks)

Don'ts

  • what already happened in a run — AgentTrail
  • a single action that needs an OK — ApprovalCard
  • wizard steps a person fills in — ProgressSteps
  • a to-do list without an agent — ListView
<AgentPlan
  title="Fix invoice rounding"
  status="draft"
  steps={steps}
  onChange={setSteps}
  onAccept={() => setStatus("accepted")}
  onEdit={() => setStatus("draft")}
  onRun={() => setStatus("running")}
/>

When to use

  • an agent proposes several steps and the person should accept or edit them first
  • show which planned step runs now and which need approval
  • a compact plan summary in a chat
  • say how risky each planned step is (steps[].risk) and why the agent takes it (steps[].why)
  • let people change the step order by keyboard before they accept (reorderable)
  • a long plan inside a chat answer: fold it (maxVisibleSteps), keep Accept in reach (stickyFooter) and link to the step that needs approval (approvalLinks)

When not to use

  • what already happened in a run — AgentTrail
  • a single action that needs an OK — ApprovalCard
  • wizard steps a person fills in — ProgressSteps
  • a to-do list without an agent — ListView

What an agent reads

import { AgentPlan } from "agentic-ds-kit";
must
  • section aria-labelledby the h3 title
  • steps are an ordered list; the current or failed step has aria-current=step
  • during a run each step shows its status as a visible word: Queued, Running, Needs you, Done, Failed
  • step changes and failures are announced in one polite live region
  • Edit and Remove are icon-only kit Buttons named with the step
  • with reorderable, Move up / Move down are icon-only kit Buttons named with the step and its position; focus stays on the arrow after a move and the new position is announced politely
  • risk is a Badge with the word (Low risk, Medium risk, High risk), never a color on its own
  • the step form is a form named "Edit step N"; Escape cancels, Enter saves
  • ⌘/Ctrl+Enter accepts a draft or runs an accepted plan while focus is in the card
  • the collapse chevron is a button with aria-expanded
  • aria-busy while drafting
  • Motion follows plan state, never a timeline: rows rise in on mount (40ms apart); the marker crossfades through kit BlurCrossfade on the tick timing when a step turns current, done or failed; the running step's marker breathes (a soft halo every 2s), not while it waits for approval; a step that fails gets one danger wash; a step that turns done or failed live draws its check or cross in once (a first load stays still). Transform, opacity, filter and that stroke draw only. Under prefers-reduced-motion nothing moves and the running step shows a still ring
  • While running, the current step shows a live time (whole seconds, aria-hidden while it ticks) that freezes on the row when the step stops; Retry restarts it. Times are kept in the component, not in steps, so they start empty on mount
  • With maxVisibleSteps, Show all N steps is a Button; it shows the rest and moves focus to the first step it showed
  • With approvalLinks, the approval count is a real link (href to the step's id) that focuses the step; each step is focusable by script (tabindex=-1)
defaults
  • status draft
  • waitingLabel Waiting for your OK
  • editable true
  • reorderable false
  • acceptLabel Accept plan
  • denyLabel Deny
  • stickyFooter false
  • approvalLinks false
  • collapsed false
stops if
  • Do not invent a local AgentPlan, PlanCard, or StepEditor
  • Accept plan is the one solid primary; Run is outline
  • Do not show Edit / Remove once the plan is accepted
  • Do not use raw hex; approval uses caution tokens
  • Do not use AgentPlan for what already happened (AgentTrail)
  • Do not show risk by color alone or with a custom badge; set steps[].risk and the Badge names it
  • Do not make reordering drag-only; reorderable gives Move up / Move down buttons
  • Do not put the why into note; note is the instruction the agent follows and shows only in the step form
  • Do not clip a long plan with a fixed height or an inner scroll; pass maxVisibleSteps and stickyFooter

From contracts/agentplan.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
titlestringYes——
stepsarrayYes—{ id, label, tool?, target?, note?, needsApproval?, risk?, why?, error?, calls?: ToolCall[] }[]. calls render under the step as one ToolCallCard group row, open on the current or failed step. risk ("low" | "medium" | "high") adds a Badge that names it in words: Low risk (neutral), Medium risk (warning), High risk (danger); nothing when unset. why is one short muted line under the tool line saying why the agent takes the step; nothing when unset.
statusenumNodraftdrafting shows skeleton rows; draft with no steps shows Empty. drafting | draft | accepted | running | complete | failed
currentStepIdstringNo—running: the step that runs now. failed: the step that stopped.
summarystringNo—Default derived: "5 steps · 2 need approval", "5 steps · 2 done · 1 waiting".
footerNotestringNo—Mono note in the footer, e.g. "accepted 14:02" or "3 of 5 · 1m 48s".
traceReactNodeNo—Header slot under the summary for a compact TraceWaterfall: time and cost so far.
waitingLabelstringNoWaiting for your OK—
editablebooleanNotrueDraft only, and only with onChange: per-step Edit / Remove and Add step.
reorderablebooleanNofalseDraft only, with editable and onChange, and two or more steps: Move up / Move down icon Buttons on each row (first row's up and last row's down are disabled). A move calls onChange with the new order, keeps focus on the arrow and announces the new position in the live region.
onChangefunctionNo—(steps) => void. Called after Save step, Remove, and Add step.
onAcceptfunctionNo—Draft footer: Accept plan, the view's one solid primary. ⌘/Ctrl+Enter inside the card.
acceptLabelstringNoAccept planDraft: the solid primary's label, like Approve plan.
onDenyfunctionNo—Draft: an outline neutral Button before the primary (denyLabel). Shown only when set.
denyLabelstringNoDeny—
maxVisibleStepsnumberNo—Fold a long plan: the first maxVisibleSteps steps, then a ghost "Show all N steps" row that shows the rest and focuses the first of them. Folds only when two or more steps would hide; the current or failed step always shows; off while a step form is open. Default every step.
stickyFooterbooleanNofalseThe footer sticks to the bottom of the nearest scroll area while the card is in view, on the card surface, so Accept plan stays reachable on a tall plan. A host whose scroll area has bottom padding sets --plan-sticky-offset to minus that padding.
approvalLinksbooleanNofalseDraft, with steps that need approval and no summary prop: the count in the summary ("1 need approval") is a link to the first such step; it opens the fold if needed, scrolls the step into view and focuses it. With no footerNote and not editable, the footer says "1 step needs your approval".
onRunfunctionNo—Accepted footer: Run (outline). ⌘/Ctrl+Enter inside the card.
onEditfunctionNo—Accepted footer: back to draft.
onSkipStepfunctionNo—(stepId) => void. Running and failed.
onStopfunctionNo—Running footer: outline danger sm Button.
onRetryStepfunctionNo—(stepId) => void. Failed footer.
onViewTrailfunctionNo—Complete footer: open the run's AgentTrail.
onDraftfunctionNo—Empty state: Draft a plan.
collapsedbooleanNofalseThe header alone: title, status and the summary line, at the open width.
onCollapsedChangefunctionNo—(collapsed) => void. Adds the show / hide chevron.
  • Component
    →

    AgentTrail

    A vertical step list for a running agent task: done steps with durations, the current step with a live timer, then pending steps.

  • Component
    →

    ApprovalCard

    The agent asks before it acts: risk, what will happen in words, an exact preview of the command or diff, and Approve (⌘/Ctrl+Enter) / Deny (Escape) with an optional auto-deny countdown.

  • Component
    →

    ProgressSteps

    Ordered wizard steps as numbered circles with a connecting line and a status word under each label: Done, Current, Upcoming, Error, or Optional.

  • Component
    →

    ListView

    A list of records, one row each: primary and optional secondary line, leading avatar or icon, trailing value, badge, actions, or chevron.