Configuration
Configure all aspects of your agent
Configure agents with sensible defaults and easy customization.
graph TB
subgraph "Configuration Levels"
D[Default] --> B[Bool]
B --> C[Config]
C --> I[Instance]
end
classDef level fill:#6366F1,stroke:#7C90A0,color:#fff
class D,B,C,I levelConfiguration Pattern
Every feature follows the same pattern – start simple, add detail as needed:
- Level 1: Minimal
rust use praisonai::Agent; // Uses all defaults - just provide name let agent = Agent::new() .name("Assistant") .build()?; - Level 2: Basic Settings
rust 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()?; - Level 3: Full Configuration
rust 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
| Config | Purpose | Default |
|---|---|---|
MemoryConfig | Conversation memory | Short-term enabled |
PlanningConfig | Planning mode | Disabled |
ExecutionConfig | Limits and timeouts | 10 iterations, 300s |
OutputConfig | Output format | Verbose |
KnowledgeConfig | RAG settings | Auto-retrieve |
GuardrailConfig | Safety validation | Disabled |
Environment Variables
export OPENAI_API_KEY="your-key"
export RUST_LOG="info" # tracing filterThere are no PRAISONAI_MODEL, PRAISONAI_VERBOSE, or PRAISONAI_TIMEOUT variables. Set the model, verbosity, and timeout in builder code (.model(...), .verbose(true), ExecutionConfig::new().timeout(...)), or pass the model with the CLI --model flag.
Best Practices
Start with defaults
Defaults are chosen for common use cases. Customize only when needed.
Use environment variables for secrets
Never hardcode API keys in source code.
Use booleans for quick toggles
Use Config classes when you need fine-grained control.