Planning before acting with PlanningConfig
Let the agent draft a step-by-step plan first
Complex multi-tool tasks fail when an agent jumps straight into actions without a roadmap. Enable planning=True (or PlanningConfig) so the agent decomposes the task before executing.
Example
from praisonai import Agent, PlanningConfig
plan_cfg = PlanningConfig(reasoning=True, read_only=True, auto_approve=False)
architect = Agent(
name='MigrationPlanner',
instructions='Output a crisp 3-step zero-downtime Postgres migration plan in 3 short lines.',
output='silent',
)
print('PlanningConfig -> read_only:', plan_cfg.read_only, '| auto_approve:', plan_cfg.auto_approve)
print(architect.start('Plan adding a NOT NULL phone column to users'))Example explained
- PlanningConfig(reasoning=True, read_only=True, auto_approve=False) — Generates an inspectable plan without executing mutating tools until approved.
- planning=True — Shorthand one-line default when you want quick built-in planning.
When planning helps vs adds unnecessary latency
Use planning=True on multi-step research, migrations, and refactors; skip it on single-turn Q&A or fast classifiers where planning adds an extra LLM round-trip.
Common pitfall: enabling auto_approve=True on destructive plans
Keep auto_approve=False whenever a plan involves database migrations, file deletions, or external API writes.
Reference: documentation