Skip to main content

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

PlanningEngineConfig

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

IPlanningEngine.decomposeTask


executeStep()

executeStep(step, context?): Promise<PlanStepResult>

Defined in: packages/agentos/src/core/planning/PlanningEngine.ts:513

Executes a single plan step.

Parameters

step

PlanStep

Step to execute

context?

StepExecutionContext

Execution context

Returns

Promise<PlanStepResult>

Step execution result

Implementation of

IPlanningEngine.executeStep


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?

PlanningContext

Additional context for planning

options?

PlanningOptions

Planning configuration options

Returns

Promise<ExecutionPlan>

Generated execution plan

Implementation of

IPlanningEngine.generatePlan


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

ExecutionPlan

Original plan to refine

feedback

ExecutionFeedback

Feedback from execution

Returns

Promise<ExecutionPlan>

Refined execution plan

Implementation of

IPlanningEngine.refinePlan


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

ExecutionPlan

Current plan

executionState

ExecutionState

Current execution state

Returns

Promise<ReflectionResult>

Reflection insights and suggested adjustments

Implementation of

IPlanningEngine.reflect


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?

AutonomousLoopOptions

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

ExecutionPlan

Plan being executed

state

ExecutionState

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

ExecutionPlan

Plan to validate

Returns

Promise<PlanValidationResult>

Validation result with any issues found

Implementation of

IPlanningEngine.validatePlan