Installation
Install the PraisonAI Rust SDK in your project
Get started with PraisonAI in Rust in under a minute.
Quick Start
- Add to Cargo.toml
toml [dependencies] praisonai = "0.1" tokio = { version = "1", features = ["full"] } - Set API Key
bash export OPENAI_API_KEY="your-key" - Create Your First Agent
rust 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(()) } - Run
bash cargo run
Requirements
| Requirement | Version |
|---|---|
| Rust | 1.70+ |
| Tokio | 1.x |
Optional Features
Enable additional capabilities in Cargo.toml:
[dependencies]
praisonai = { version = "0.1", features = ["mcp", "knowledge"] }| Feature | Description |
|---|---|
mcp | Model Context Protocol support |
knowledge | RAG and knowledge base |
full | All features enabled |
Best Practices
Use environment variables for API keys
Never hardcode API keys in your code. Use environment variables.
Start with minimal features
Add features incrementally as needed for smaller binary size.