Build LLM agents in Rust
Aquaregia gives you the agent loop — think → call tools → observe → repeat — so you don't write it yourself. One API. Any provider.
$ cargo add aquaregiause aquaregia::providers::openai;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let agent = openai::Client::from_env()?
.agent("gpt-5.5")
.build()?;
let response = agent
.prompt("Explain Rust ownership in 3 bullet points.")
.await?;
println!("{response}");
Ok(())
}What you can build
Agent Loop
The model thinks, calls tools, sees results, and repeats until the job is done. You describe the tools and stopping rule; Aquaregia runs the loop.
Multi-Provider
Use OpenAI, Anthropic, Google, or an OpenAI-compatible endpoint through provider-specific clients with the same high-level agent API.
Typed Tools
A tool is a typed async function. Derive JsonSchema on the args, return any serializable value, and let Aquaregia handle schema and JSON plumbing.
Structured Output
Call generate_object::<T>() or stream_object::<T>() and receive typed Rust values with schemas derived from your own structs.
Streaming
Stream a single model call with StreamEvent, or stream a full agent run with AgentStreamEvent including model deltas, tools, steps, and final output.
Production Ready
CancellationToken checked at every boundary. Exponential backoff with Retry-After honoured. Typed ErrorCode for control flow — never match on strings.
Runs on any provider
Same agent, same code. Swap the constructor to change provider.
Ready to build?
One dependency. Any provider. Start building agents in minutes.
$ cargo add aquaregia