Reasoning

Enable step-by-step reasoning

Reasoning mode shows the agent’s thought process.

Diagram

Reasoning

❓ Question

💭 Think

Step 1

Step 2

💬 Answer

Quick Start

  1. Create Reasoning Agent
    rust
    use praisonai::Agent;
    
    // Build step-by-step reasoning into instructions
    let agent = Agent::new()
        .name("Thinker")
        .instructions("When solving problems:
        1. Break down the problem into smaller parts
        2. Think through each part step by step
        3. Show your reasoning before the final answer
        4. Provide a clear conclusion")
        .build()?;
    
    let response = agent.chat("What causes rain?").await?;
    // Agent shows step-by-step reasoning in response
  2. Use Reasoning-Optimized Models
    rust
    use praisonai::Agent;
    
    // Use models designed for reasoning
    let agent = Agent::new()
        .name("Analyst")
        .model("o1-preview")  // OpenAI reasoning model
        .instructions("Analyze this complex problem thoroughly")
        .build()?;

When to Use

TaskUse Reasoning?
Math problems✅ Yes
Complex analysis✅ Yes
Simple questions❌ No
Quick lookups❌ No

Related