Skip to main content
Get started with PraisonAI in Rust in under a minute.

Quick Start

1

Add to Cargo.toml

[dependencies]
praisonai = "0.1"
tokio = { version = "1", features = ["full"] }
2

Set API Key

export OPENAI_API_KEY="your-key"
3

Create Your First Agent

use praisonai::Agent;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let agent = Agent::new()
        .name("Assistant")
        .instructions("You are a helpful assistant")
        .build()?;
    
    let response = agent.chat("Hello!").await?;
    println!("{}", response);
    
    Ok(())
}
4

Run

cargo run

Requirements

RequirementVersion
Rust1.70+
Tokio1.x

Optional Features

Enable additional capabilities in Cargo.toml:
[dependencies]
praisonai = { version = "0.1", features = ["mcp", "knowledge"] }
FeatureDescription
mcpModel Context Protocol support
knowledgeRAG and knowledge base
fullAll features enabled

Best Practices

Never hardcode API keys in your code. Use environment variables.
Add features incrementally as needed for smaller binary size.