Reasoning: Planning

At its core, planning is the process of generating a causal sequence of actions from a given starting point to achieve a desired target state.

Agentic AI Equivalent

In standard agentic AI, Chain of Thought (CoT)—prompting a model to generate step-by-step intermediate reasoning traces—serves as the primary mechanism for decision-making. However, because LLMs execute CoT through probabilistic next-token prediction, this process ultimately relies on statistical completion rather than true logic.

cognition’s implements formal, algorithmic planning. Instead of guessing the next token, the engine systematically decomposes high-level goals into valid action chains by evaluating hypothetical future states before executing any action in the operational environment.

The cognition library includes SearchPlanner, which searches an action space to find an (optimal) sequence of actions from its initial state to a goal. Thus, every planning problem within cognition is constructed using four fundamental components:

  1. Initial State The baseline state snapshot of the environment and agent context prior to plan execution. For DPs that use a WorldGraph, this is typically described using a WorldSnapshot.

  2. Action Space A Python function dictating what action(s) are available in any planning state, the state that would result from invoking that action, and the associated cost.

  3. Goal State A target logical condition that explicitly defines the criteria for a successful plan.

  4. Search Strategy General-purpose graph traversal and optimization algorithms (e.g., \(A^*\), Breadth-First Search, Depth-First Search) used to systematically explore the state-action graph and discover an optimal path from the initial state to a goal state.

Planning vs. Decision Processes

While closely related, Planning and Decision Process (DP) operate at different stages of execution:

  • Planner: Operates offline in a hypothetical state space – it searches for and outputs a static sequence of actions (a plan) without altering the live system.

  • Decision Process: Operates online cycle-by-cycle – it executes real steps, handles dynamic environment state mutations, and drives real-world actuation.

What are the scientific principles?

Automated Planning and Scheduling is an Artificial Intelligence discipline that provides a mathematically rigorous framework for autonomous decision-making through deterministic state-space search. While modern Large Language Models (LLMs) excel at natural language parsing and intuition, they struggle with multi-step search, strict constraint adherence, and provable correctness guarantees. Formal planning engines bridge this gap by serving as sound reasoning systems that guarantee valid, executable plan generation—making them essential for mission-critical, high-stakes autonomous systems like NASA JPL’s Mars Rover activity scheduling, where operational failure is unacceptable.

See also

Further Reading & References

Why Use Planning?

  • Explainability: Generates transparent action sequences where every step can be traced back to explicit state transitions and decision logic.

  • Causal Determinism: Ensures that actions are only selected if their preconditions are strictly met, eliminating hallucinations or illegal state transitions.

  • Domain Expertise Integration: Enables developers to encode domain rules and common-sense logic directly without training massive data models.

  • Guarantees & Trust: Offers mathematical guarantees regarding completeness, correctness, and cost-optimality, which are required for high-stakes, safety-critical tasks.

Implementation Details

The library provides a base implementation of graph search via the SearchPlanner class, which iteratively explores sequential action spaces until a goal is met.

Core Architecture

To initialize and run a SearchPlanner, supply the following inputs:

Input Parameter

Type

Description

Initial State (PS)

Hashable Object

Starting state of the planner. Must be immutable and hashable.

Goal Predicate

Callable

Function taking a PS and returning True when a goal state is satisfied.

Succession Function

Callable

Function producing available planner actions (PA), transition costs (lower is better), and resulting states (PS).

Frontier Factory

Object

Strategy determining state expansion order.

Note

The planner state (PS) is closely related to DP state, but must be hashable (and thus immutable) to enable efficient set-based duplicate detection in search frontiers.

Frontier Strategies

The library ships with several standard frontier factories to control search behavior:

  • Stack: Performs Depth-First Search (DFS). Useful in memory-constrained settings where deep solution paths exist.

  • Queue: Performs Breadth-First Search (BFS). Guarantees finding the solution with the fewest number of actions.

  • PriorityQueue: Performs Uniform-Cost Search (UCS) to find the absolute lowest-cost plan.

    • Heuristic Support: If supplied with an admissible heuristic, PriorityQueue executes A* search, delivering optimal cost with minimal state exploration.

Action Abstractions & Succession Functions

To simplify building custom succession functions, the library provides built-in action pattern abstractions:

  • SearchPlannerStaticOption: Represents a static planner action available across multiple planner states.

    • Helper: static_opts_succession constructs a full succession function from a set of static options.

  • SearchPlannerDynamicOption: Represents pattern-based or dynamically generated actions dependent on current state features.

    • Helper: dynamic_opts_succession constructs a succession function from dynamic option generators.

Tip

SearchPlannerStaticOption maps to operators, while SearchPlannerDynamicOption maps to operator generators within a Decision Process.