PlanningConfig

Configure planning mode for agents to create and execute structured plans

Enable agents to create step-by-step plans before executing tasks, with optional approval workflows.

Diagram

Planning Mode

πŸ“‹ Task

πŸ—ΊοΈ Plan

βœ… Approve

⚑ Execute

Quick Start

  1. Simple Enable

    Enable planning with defaults:

    python
    from praisonaiagents import Agent
    
    agent = Agent(
        name="Planning Agent",
        instructions="You plan before acting",
        planning=True
    )
  2. With Configuration

    Configure planning behavior:

    python
    from praisonaiagents import Agent
    from praisonaiagents.config import PlanningConfig
    
    agent = Agent(
        name="Planning Agent",
        instructions="You plan before acting",
        planning=PlanningConfig(
            llm="gpt-4o",
            reasoning=True,
            auto_approve=False
        )
    )

Configuration Options

python
from praisonaiagents.config import PlanningConfig

config = PlanningConfig(
    # Planning LLM (if different from main)
    llm=None,

    # Tools available during planning
    tools=None,

    # Enable reasoning during planning
    reasoning=False,

    # Auto-approve plans without confirmation
    auto_approve=False,

    # Read-only mode (only read operations)
    read_only=False
)
ParameterTypeDefaultDescription
llm`str \None`NoneModel for planning (defaults to agent’s model)
tools`List[Any] \None`NoneTools available during planning phase
reasoningboolFalseEnable chain-of-thought reasoning
auto_approveboolFalseSkip approval step for plans
read_onlyboolFalseRestrict to read-only operations

Common Patterns

Pattern 1: Planning with Tools

python
from praisonaiagents import Agent
from praisonaiagents.config import PlanningConfig

def search(query: str) -> str:
    """Search for information."""
    return f"Results for: {query}"

agent = Agent(
    name="Research Planner",
    instructions="Plan and execute research",
    planning=PlanningConfig(
        tools=[search],
        reasoning=True
    )
)

Pattern 2: Auto-Approved Planning

python
from praisonaiagents import Agent
from praisonaiagents.config import PlanningConfig

agent = Agent(
    name="Auto Planner",
    instructions="Execute plans automatically",
    planning=PlanningConfig(
        auto_approve=True,
        reasoning=True
    )
)

Pattern 3: Read-Only Planning

python
from praisonaiagents import Agent
from praisonaiagents.config import PlanningConfig

agent = Agent(
    name="Safe Planner",
    instructions="Only read operations allowed",
    planning=PlanningConfig(
        read_only=True,
        auto_approve=False
    )
)

Best Practices

Enable Reasoning for Complex Tasks

Use reasoning=True for tasks that benefit from chain-of-thought planning.

Review Plans Before Execution

Keep auto_approve=False for critical operations to review plans before execution.

Use Read-Only for Safety

Enable read_only=True when agents should only analyze but not modify data.


Related