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.7M+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
Use cases

What developers build with Rig

One set of composable primitives, from a single-file script to a production agent, running on servers, at the edge, and in the browser.

  • Coding agents & terminal tools
  • RAG & document Q&A
  • Multi-agent workflows & data pipelines
  • MCP servers & tool integrations
  • Single-binary & WASM deployments
Browse projects on awesome-rig (opens in a new tab)