Welcome to the SimpleAgents documentation! This guide will help you understand, use, and contribute to SimpleAgents.
SimpleAgents is a Rust framework for building LLM-powered applications with a focus on:
use simple_agents_types::prelude::*;
use simple_agents_providers::openai::OpenAIProvider;
#[tokio::main]
async fn main() -> Result<()> {
// Create a provider
let api_key = ApiKey::new("sk-...")?;
let provider = OpenAIProvider::new(api_key)?;
// Build a request
let request = CompletionRequest::builder()
.model("gpt-4")
.message(Message::user("Hello, world!"))
.temperature(0.7)
.build()?;
// Execute the request
let provider_request = provider.transform_request(&request)?;
let provider_response = provider.execute(provider_request).await?;
let response = provider.transform_response(provider_response)?;
println!("{}", response.content().unwrap_or(""));
Ok(())
}
SimpleAgents is organized into multiple crates:
simple-agents-types - Core types, traits, and interfacessimple-agents-providers - Provider implementations (OpenAI, Anthropic, etc.)simple-agents-cache - Caching implementations (in-memory, Redis, etc.)MIT OR Apache-2.0