Skip to main content
Configure agents with sensible defaults and easy customization.

Configuration Pattern

Every feature follows the same pattern - start simple, add detail as needed:
1

Level 1: Minimal

use praisonai::Agent;

// Uses all defaults - just provide name
let agent = Agent::new()
    .name("Assistant")
    .build()?;
2

Level 2: Basic Settings

use praisonai::Agent;

// Common configuration options
let agent = Agent::new()
    .name("Assistant")
    .instructions("You are a helpful assistant")
    .model("gpt-4o")
    .memory(true)      // Enable memory
    .verbose(true)     // Enable verbose output
    .build()?;
3

Level 3: Full Configuration

use praisonai::{Agent, MemoryConfig};

// Complete configuration with all options
let agent = Agent::new()
    .name("Research Assistant")
    .instructions("You research topics thoroughly")
    .model("gpt-4o")
    .api_key("sk-...")
    .base_url("https://api.openai.com/v1")
    .temperature(0.7)
    .max_tokens(4096)
    .memory_config(MemoryConfig::new().max_messages(100))
    .max_iterations(15)
    .stream(true)
    .verbose(true)
    .build()?;

All Configurations

ConfigPurposeDefault
MemoryConfigConversation memoryShort-term enabled
PlanningConfigPlanning modeDisabled
ExecutionConfigLimits and timeouts10 iterations, 300s
OutputConfigOutput formatVerbose
KnowledgeConfigRAG settingsAuto-retrieve
GuardrailConfigSafety validationDisabled

Environment Variables

Configure via environment:
export OPENAI_API_KEY="your-key"
export PRAISONAI_MODEL="gpt-4o"
export PRAISONAI_VERBOSE="true"
export PRAISONAI_TIMEOUT="60"

Best Practices

Defaults are chosen for common use cases. Customize only when needed.
Never hardcode API keys in source code.
Use Config classes when you need fine-grained control.