The agent's plan before it runs: edit, reorder, remove or add steps, then approve or ask for changes.
Set your access key from API keys as NEXTUI_TOKEN in .env.local and add the @nextui namespace below to components.json once. Then every item installs by name. Each install counts as a copy on a free account.
$pnpm dlx shadcn@latest add @nextui/plan-review
1{2"registries": {3"@nextui": {4"url": "https://nextui.dev/r/{name}.json",5"headers": { "Authorization": "Bearer ${NEXTUI_TOKEN}" }6}7}8}
1"use client";23import { useChat } from "@ai-sdk/react";4import { PlanReview, type PlanStep } from "@/components/nextui/plan-review";56// The agent calls a "propose_plan" tool without execute; answer it from here.7export function PlanPart({ toolCallId, input }: { toolCallId: string; input: { goal: string; steps: PlanStep[] } }) {8const { addToolResult } = useChat();910return (11<PlanReview12title={input.goal}13defaultSteps={input.steps}14onApprove={(steps) =>15addToolResult({ tool: "propose_plan", toolCallId, output: { approved: true, steps } })16}17onRequestChanges={(feedback) =>18addToolResult({ tool: "propose_plan", toolCallId, output: { approved: false, feedback } })19}20/>21);22}
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | – | What the agent was asked to do |
| steps | { id: string; text: string; detail?: string }[] | – | Controlled steps. detail shows as a chip, e.g. the tool a step will call |
| defaultSteps | PlanStep[] | – | Starting steps when uncontrolled |
| onStepsChange | (steps: PlanStep[]) => void | – | Called after an edit, removal, move or new step |
| status | "draft" | "approved" | "changes-requested" | – | Controlled status. Approved and changes-requested lock the list |
| onApprove | (steps: PlanStep[]) => void | – | Called with the final steps by Approve & run |
| onRequestChanges | (feedback: string) => void | – | Called with free-text feedback. Leave out to hide Ask for changes |
| autoPlay | boolean | false | Loop a scripted review: edit a step, drop one, approve. Stops on the first click |
| className | string | – | Extra classes on the card |
Sign in to see the code
Preview it freely. A free account copies code and prompts a few times a day.