Bounded Planning Depth: Complexity Control

Bounded Planning Depth: Complexity Control

Learn how to limit the foresight of autonomous agents. Master the art of 'Incremental Execution' to prevent expensive, over-engineered agent plans.

Bounded Planning Depth: Complexity Control

When an agent "Plans" (Module 9.4), it is essentially trying to predict the future. Some agents will generate a 12-step plan for a 2-step problem. "First, I will research the history of the internet. Second, I will look at the Wikipedia page for servers. Third, I will check the status of your specific URL..."

This is Planning Bloat. Not only are you paying for those output tokens, but every subsequent turn the agent has to re-read that massive plan, wasting thousands of input tokens.

In this lesson, we learn Bounded Planning. We’ll move from "Full Strategy" to "One-Step-Ahead" execution. We will learn how to keep the agent's focus narrow to maximize efficiency.


1. The 3-Step Constraint

A powerful heuristic for token efficiency is the "Rule of Three." Never allow an agent to plan more than three steps in advance. If a task requires 10 steps, the agent should complete the first 3, then "Check In" and plan the next 3.

Why? Because Step 1 often changes the reality of Step 4. Planning Step 4 before Step 1 is finished is Speculative Waste.


2. Implementation: The Shallow Planner (Python)

You can enforce this bound through your system prompt and your schema validation.

Python Code: Enforcing Planning Constraints

from pydantic import BaseModel, conlist

class BoundedPlan(BaseModel):
    # conlist enforces a Max Length of 3 at the TYPE level
    steps: conlist(str, min_items=1, max_items=3)
    reasoning: str

def get_next_steps(task_status):
    # The model is FORCED to be concise because the 
    # JSON schema only allows for 3 items.
    pass

3. The "Horizontal" vs. "Vertical" Plan

  • Vertical (Iterative): Agent does Step 1 -> Evaluates -> Does Step 2.
  • Horizontal (Batch): Agent generates 10 code files in one turn.

Efficiency Insight: For complex logic, Vertical is more token-efficient because you catch errors early. For simple data tasks, Horizontal is more efficient because you save on "Instruction Overhead" between turns.


4. Reducing the "Reasoning-to-Action" Ratio

In a bounded plan, you should also limit the Reasoning Length for each step. An agent doesn't need to justify "Why" it is opening a file for 200 words.

Constraint: "Max 10 words of reasoning per planned step."

graph LR
    A[Task: Fix Bug] --> B[Plan: 3 Steps Max]
    B --> C[Step 1: Read Log]
    B --> D[Step 2: Patch File]
    B --> E[Step 3: Verify]
    
    style B fill:#f96
    subgraph "Token Savings"
        Constraint[No planning for Step 4-10]
    end

5. Bounding Depth in Multi-Agent Handoffs

In a multi-agent system, when the Supervisor (Module 9.2) hands off to a Searcher, it should only give the Searcher One Specific Objective. Don't say: "Search for the weather, then the stock price, then the news." Say: "Search for the weather." When that is done, the Supervisor gives the next task. This keeps the "Sub-Agent" context extremely thin and focused.


6. Summary and Key Takeaways

  1. Incrementalism is Efficiency: Don't plan what you haven't started.
  2. Rule of Three: Limit plans to 3 steps to prevent speculative token waste.
  3. Reasoning Caps: Use word counts to stop the agent from over-explaining its plan.
  4. Context Reset: Use small, focused plans to keep the total prompt size manageable for the agent's attention mechanism.

In the next lesson, Reasoning Conciseness, we look at چگونه to audit and prune the agent's internal monologue.


Exercise: The Planner Benchmark

  1. Ask an agent to "Plan a move from NYC to Austin."
  2. Record the number of tokens in its initial output.
  3. Now, add this constraint: "Constraint: Max 3 steps. Focus ONLY on Phase 1 (Packing). Leave the rest for later."
  4. Compare the Output Token Count.
  5. Analyze: Did the quality of the "Packing" plan increase?
  • (Usually, Yes, because the model's focus was not diluted by the complexities of "Unpacking").

Congratulations on completing Module 10 Lesson 2! You are now a master of bounded logic.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn