Skip to main content
Planning mode lets agents break complex tasks into steps before executing.

Quick Start

1

Create a Plan

use praisonai::{Plan, PlanStep};

// Create a plan with steps
let mut plan = Plan::new("Write Blog Post")
    .description("Write a blog post about AI safety");

plan.add_step(PlanStep::new("Research topic"));
plan.add_step(PlanStep::new("Create outline"));
plan.add_step(PlanStep::new("Write draft"));
plan.add_step(PlanStep::new("Review and edit"));

println!("Plan has {} steps", plan.step_count());
2

Execute Plan Steps

use praisonai::{Plan, PlanStep};

let mut plan = Plan::new("Project");
plan.add_step(PlanStep::new("Step 1"));
plan.add_step(PlanStep::new("Step 2"));

// Get next ready step
while let Some(step) = plan.next_step() {
    println!("Executing: {}", step.description);
    // Execute the step...
    if let Some(s) = plan.get_step_mut(&step.id) {
        s.complete(Some("Done".to_string()));
    }
}

println!("Progress: {}%", plan.progress());
3

Step Dependencies

use praisonai::PlanStep;

// Step 2 depends on Step 1
let step1 = PlanStep::new("Research")
    .estimated(60);  // 60 seconds

let step2 = PlanStep::new("Write")
    .depends_on("research")  // Wait for research
    .estimated(120);

How It Works


Plan Methods

MethodSignatureDescription
new(name)fn new(impl Into<String>) -> SelfCreate plan
description(desc)fn description(impl Into<String>) -> SelfSet description
add_step(step)fn add_step(&mut self, PlanStep)Add a step
get_step(id)fn get_step(&self, &str) -> Option<&PlanStep>Get step
next_step()fn next_step(&self) -> Option<&PlanStep>Get next ready step
progress()fn progress(&self) -> f64Get progress %
is_complete()fn is_complete(&self) -> boolCheck if done
has_failed()fn has_failed(&self) -> boolCheck for failures
step_count()fn step_count(&self) -> usizeNumber of steps

PlanStep Methods

MethodSignatureDescription
new(description)fn new(impl Into<String>) -> SelfCreate step
depends_on(step_id)fn depends_on(impl Into<String>) -> SelfAdd dependency
estimated(seconds)fn estimated(u64) -> SelfSet estimated time
start()fn start(&mut self)Mark in progress
complete(output)fn complete(&mut self, Option<String>)Mark done
fail(error)fn fail(&mut self, impl Into<String>)Mark failed
skip()fn skip(&mut self)Mark skipped
is_ready(completed)fn is_ready(&self, &[String]) -> boolCheck if ready

When to Use Planning

Task TypeUse Planning?
”What’s 2+2?”❌ No
”Summarize this doc”❌ No
”Write a business plan”✅ Yes
”Build a website”✅ Yes

Best Practices

Planning helps with research papers, code projects, business plans.
Don’t enable planning for quick questions - adds unnecessary overhead.
Turn on reasoning to see the agent’s thought process.