Get Started

Artificial Intelligence · Open source · Rust

Build AI agents in Rust

A modular, high-performance library for LLM apps and agents. One unified API across 20+ providers, type-safe tools and structured output — production-ready.

$cargo add rig
8K+GitHub stars
2.6M+Downloads
230+Contributors
79K+ stars across 204+ repos
agent.rs
use rig::{completion::Prompt, providers::openai};

let openai = openai::Client::from_env()?;

let agent = openai.agent("gpt-5.5")
    .preamble("You are a helpful assistant.")
    .build();

let response = agent
    .prompt("What is Rust?")
    .await?;
output

routing: openai/gpt-5.5 · tokens: 128 · 42ms · response streamed OK

Model Providers20+ supported
OpenAIOpenAI
AnthropicAnthropic
Azure OpenAIAzure OpenAI
CohereCohere
DeepSeekDeepSeek
EternalAIEternalAI
Google GeminiGoogle Gemini
GaladrielGaladriel
GroqGroq
Hugging FaceHugging Face
HyperbolicHyperbolic
MiraMira
MoonshotMoonshot
OllamaOllama
OpenRouterOpenRouter
PerplexityPerplexity
TogetherAITogetherAI
xAIxAI
AWS BedrockAWS Bedrock
Vector Stores10+ supported
In-MemoryIn-Memory
MongoDBMongoDB
LanceDBLanceDB
SQLiteSQLite
Neo4jNeo4j
QdrantQdrant
SurrealDBSurrealDB
MilvusMilvus
AWS S3VectorsAWS S3Vectors
ScyllaDBScyllaDB
PostgreSQLPostgreSQL
View all integrations
Quick install

Add Rig in one line

Drop it into any Cargo project. Ship it as a single binary or compile to WASM for server, edge, and browser environments.

Then read the quickstart
install
bash$cargo add rig
Community

Open source, built together

Join 230+ contributors building the future of AI in Rust.

MIT licensed & free

Ready to build AI applications in Rust?

Join a growing community of Rust + AI developers building the future of AI infrastructure.