Class: PlanningEngine
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:194
Implementation of the AgentOS Planning Engine.
Features:
- ReAct (Reasoning + Acting) pattern for interleaved planning and execution
- Plan-and-Execute for upfront planning
- Tree-of-Thought for exploring multiple reasoning paths
- Self-reflection and plan refinement
- Checkpoint and rollback support
- Human-in-the-loop integration points
Implements
Implements
Constructors
Constructor
new PlanningEngine(
config):PlanningEngine
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:212
Creates a new PlanningEngine instance.
Parameters
config
Engine configuration
Returns
PlanningEngine
Methods
decomposeTask()
decomposeTask(
task,depth?):Promise<TaskDecomposition>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:294
Decomposes a complex task into simpler subtasks.
Parameters
task
string
The task description to decompose
depth?
number = 3
Maximum decomposition depth
Returns
Promise<TaskDecomposition>
Task decomposition result
Implementation of
executeStep()
executeStep(
step,context?):Promise<PlanStepResult>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:513
Executes a single plan step.
Parameters
step
Step to execute
context?
Execution context
Returns
Promise<PlanStepResult>
Step execution result
Implementation of
generatePlan()
generatePlan(
goal,context?,options?):Promise<ExecutionPlan>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:243
Generates a multi-step execution plan from a high-level goal.
Parameters
goal
string
The high-level goal to achieve
context?
Additional context for planning
options?
Planning configuration options
Returns
Promise<ExecutionPlan>
Generated execution plan
Implementation of
getExecutionState()
getExecutionState(
planId):ExecutionState|null
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:789
Gets the current execution state for a plan.
Parameters
planId
string
Plan identifier
Returns
ExecutionState | null
Current execution state or null
Implementation of
IPlanningEngine.getExecutionState
refinePlan()
refinePlan(
plan,feedback):Promise<ExecutionPlan>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:418
Refines an existing plan based on execution feedback.
Parameters
plan
Original plan to refine
feedback
Feedback from execution
Returns
Promise<ExecutionPlan>
Refined execution plan
Implementation of
reflect()
reflect(
plan,executionState):Promise<ReflectionResult>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:465
Performs self-reflection on plan execution state.
Parameters
plan
Current plan
executionState
Current execution state
Returns
Promise<ReflectionResult>
Reflection insights and suggested adjustments
Implementation of
restoreCheckpoint()
restoreCheckpoint(
checkpointId):Promise<{plan:ExecutionPlan;state:ExecutionState; }>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:766
Restores execution state from a checkpoint.
Parameters
checkpointId
string
Checkpoint to restore
Returns
Promise<{ plan: ExecutionPlan; state: ExecutionState; }>
Restored plan and state
Implementation of
IPlanningEngine.restoreCheckpoint
runAutonomousLoop()
runAutonomousLoop(
goal,options?):AsyncGenerator<LoopProgress,ExecutionSummary,undefined>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:605
Runs an autonomous goal pursuit loop.
Parameters
goal
string
Goal to pursue
options?
Loop configuration
Returns
AsyncGenerator<LoopProgress, ExecutionSummary, undefined>
Final execution summary
Yields
Progress updates
Implementation of
IPlanningEngine.runAutonomousLoop
saveCheckpoint()
saveCheckpoint(
plan,state):Promise<string>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:747
Saves current execution state for checkpointing.
Parameters
plan
Plan being executed
state
Current execution state
Returns
Promise<string>
Checkpoint identifier
Implementation of
IPlanningEngine.saveCheckpoint
validatePlan()
validatePlan(
plan):Promise<PlanValidationResult>
Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:325
Validates a plan for feasibility and completeness.
Parameters
plan
Plan to validate
Returns
Promise<PlanValidationResult>
Validation result with any issues found