Plan Types Reference
Plans are multi-step sequences that the AI creates when a user's request requires multiple actions.
Most developers don't need to interact with plans directly. Plans work automatically with your Actions. These types are for advanced customization like building custom plan UI or analytics.
ExecutionPlan
The main plan object.
examples/reference/plan-types/execution-plan.ts
interface ExecutionPlan {/** Unique identifier for the plan */id: string;/** What the user is trying to accomplish */goal: string;/** Current status of the plan */status: PlanStatus;/** All steps in the plan */steps: ExecutionStep[];/** Number of completed steps */completed_steps: number;/** Total number of steps */total_steps: number;/** Whether the plan should auto-execute */auto_execute: boolean;/** Timestamp when created */created_at: string;/** Timestamp when last updated */updated_at: string;}
PlanStatus
examples/reference/plan-types/plan-status.ts
type PlanStatus =| 'awaiting_start' // User must click "Start" to begin| 'executing' // Plan is running| 'awaiting_result' // Waiting for step completion| 'completed' // All steps finished| 'cancelled' // User cancelled the plan| 'failed'; // A step failed
| Status | Description |
|---|---|
awaiting_start | Plan created, waiting for user to start |
executing | Currently executing a step |
awaiting_result | Waiting for user action (wizard, form, etc.) |
completed | All steps successfully completed |
cancelled | User cancelled the plan |
failed | A step failed and plan stopped |
ExecutionStep
Individual step in a plan.
examples/reference/plan-types/execution-step.ts
interface ExecutionStep {/** Unique identifier for the step */id: string;/** Step order (0-indexed) */index: number;/** Human-readable description */description: string;/** Action to execute */action_name: string;/** Data to pass to the action */action_data: Record<string, unknown>;/** Current status */status: StepStatus;/** Execute without user clicking */auto_run: boolean;/** Mark done immediately after executing */auto_complete: boolean;/** Pause for user confirmation before executing */requires_user_confirmation: boolean;}
StepStatus
examples/reference/plan-types/step-status.ts
type StepStatus =| 'pending' // Not yet reached| 'active' // Currently active| 'completed' // Successfully finished| 'skipped' // User skipped this step| 'failed'; // Step failed
| Status | Description |
|---|---|
pending | Step hasn't been reached yet |
active | This step is currently being executed |
completed | Step finished successfully |
skipped | User chose to skip this step |
failed | Step failed with an error |
Plan Methods
Get Active Plan
examples/reference/plan-types/get-active-plan.tsx
const { activePlan } = usePillar();if (activePlan) {console.log(`Working on: ${activePlan.goal}`);console.log(`Progress: ${activePlan.completed_steps}/${activePlan.total_steps}`);}
Start a Plan
examples/reference/plan-types/start-plan.tsx
await pillar.startPlan();
Complete a Step
For wizard actions that require user interaction, signal completion when done:
examples/reference/plan-types/complete-step.tsx
// Use completeAction() - works for both standalone and plan stepsawait pillar.completeAction('add_source', true, { sourceId: '123' });// Or by step ID (for custom UI)await pillar.markPlanStepDone(stepId);
Skip a Step
examples/reference/plan-types/skip-step.tsx
await pillar.skipPlanStep(stepId);
Cancel the Plan
examples/reference/plan-types/cancel-plan.tsx
await pillar.cancelPlan();
Plan Events
| Event | Payload | Description |
|---|---|---|
plan:start | ExecutionPlan | Plan started executing |
plan:step:active | { plan, step } | Step became active |
plan:step:complete | { plan, step, success } | Step finished |
plan:step:skip | { plan, step } | Step was skipped |
plan:complete | ExecutionPlan | All steps complete |
plan:cancel | ExecutionPlan | Plan was cancelled |
plan:error | { plan, error } | Error occurred |
See Events Reference for more details.