AI Action Plan
Agent-specific component for displaying planned AI actions before execution. Shows steps, progress, estimated times, and allows users to approve, pause, or modify the execution plan.
Preview
Action plan with steps in various states
Document Analysis Plan
Analyzing documents and generating a report
Pending Plan with Approvals
Plan requiring user approval for sensitive steps
Data Migration Plan
Migrate user records to new database schema
Failed Execution
Plan with a failed step and retry option
User Authentication
Authentication token expired. Please refresh and try again.
Compact Variant
Minimal progress display for sidebars or headers
Processing...
1/4 steps
Inline Variant
Text-based progress indicator
Interactive Demo
Try the execution controls
Interactive Demo
Click the buttons to simulate execution
Props
AIActionPlan component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | 'Action Plan' | Plan title |
description | string | — | Plan description |
steps* | ActionStep[] | — | Array of action steps |
status | 'idle' | 'running' | 'paused' | 'completed' | 'failed' | 'idle' | Current execution status |
onExecute | () => void | — | Callback when execution starts |
onPause | () => void | — | Callback when execution pauses |
onResume | () => void | — | Callback when execution resumes |
onCancel | () => void | — | Callback when execution cancels |
onRetry | (stepId: string) => void | — | Callback when retrying a failed step |
onApprove | (stepId: string) => void | — | Callback when approving a step |
onSkip | (stepId: string) => void | — | Callback when skipping an optional step |
onEdit | () => void | — | Callback when editing the plan |
showEstimates | boolean | true | Show estimated times for pending steps |
variant | 'card' | 'compact' | 'inline' | 'card' | Display variant |
ActionStep Type
Structure for individual action steps
interface ActionStep { id: string // Unique identifier title: string // Step title description?: string // Detailed description status: ActionStatus // 'pending' | 'in_progress' | 'completed' | 'failed' | 'skipped' type?: ActionType // 'search' | 'read' | 'write' | 'analyze' | 'api' | 'code' | 'email' | 'custom' icon?: LucideIcon // Custom icon estimatedDuration?: number // Estimated duration in seconds actualDuration?: number // Actual duration in seconds subSteps?: ActionStep[] // Nested sub-steps error?: string // Error message if failed output?: string // Output/result preview requiresApproval?: boolean // Requires user approval optional?: boolean // Step is optional}Usage
Import and implementation example
import { AIActionPlan, type ActionStep } from '@/blocks/ai-tools/ai-action-plan'
const steps: ActionStep[] = [ { id: '1', title: 'Search documents', type: 'search', status: 'completed', actualDuration: 3, }, { id: '2', title: 'Analyze results', type: 'analyze', status: 'in_progress', estimatedDuration: 15, }, { id: '3', title: 'Generate report', type: 'write', status: 'pending', estimatedDuration: 10, requiresApproval: true, },]
export default function Example() { const [status, setStatus] = useState<'idle' | 'running'>('idle')
return ( <AIActionPlan title="Document Analysis" description="Analyze and summarize documents" steps={steps} status={status} onExecute={() => setStatus('running')} onPause={() => console.log('Paused')} onApprove={(stepId) => console.log('Approved:', stepId)} onRetry={(stepId) => console.log('Retry:', stepId)} /> )}Built With
2 componentsThis block uses the following UI components from the design system:
Features
Built-in functionality
- Three variants: Card, compact, and inline display modes
- Step status tracking: Pending, in-progress, completed, failed, and skipped states
- Sub-steps support: Nested steps for complex actions
- Time estimates: Show estimated and actual durations
- Execution controls: Play, pause, resume, and cancel actions
- Approval workflow: Require user approval for sensitive steps
- Optional steps: Mark steps as skippable
- Error handling: Display errors and retry failed steps
- Progress tracking: Visual progress bar and step counts
- Type-based icons: Automatic icons for common action types
Accessibility
Accessibility considerations
ARIA Attributes
Status changes announced to screen readersProgress conveyed through text and visual indicatorsError messages associated with failed stepsKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Navigate between interactive elements |
| Enter / Space | Activate buttons and expand details |
Notes
- Loading states use aria-busy
- Step status conveyed through icons and text labels
- Consider adding live region for status updates