0xPlaygrounds/rig
โ๏ธ๐ฆ Build modular and scalable LLM Applications in Rust
About 0xPlaygrounds/rig
0xPlaygrounds/rig is an open-source project on GitHub, mainly written in Rust. โ๏ธ๐ฆ Build modular and scalable LLM Applications in Rust It currently holds 9,189 stars and 1,026 forks with 63 open issues, and was last pushed on 2026-11-19 (repository created 2024-06-05).
Project Overview
AI Homed tracks it on the Today's Trending board, currently at rank #58 with 19 new stars today.
GitHub Repository Details
README
Rig is a Rust library for building applications on large language models.
It also ships rig, a terminal coding agent built on the library that you
extend with Bevy plugins.
The coding agent
cargo install rig
rig
This installs the launcher. Until the next release it is 0.46.0, and
its guide
is on its tag. The agent guide describes
main and how to install it from a checkout. The agent needs Rust 1.97.1 or
newer and runs on Linux and macOS.
The first rig builds the agent, which takes several minutes, and opens it.
Run /login to sign in or save an API key, or export one such as
OPENAI_API_KEY before starting. /model picks a model and /help lists
the commands. rig -p "fix the failing test" answers one prompt and exits.
Its tools, commands, sessions, sign-in and terminal view are each a plugin,
so any of them can be turned off, replaced or added to. /reload rebuilds
the agent with your changes and keeps the session.
- The agent guide covers updating, models, sessions, tools,
- The plugin guide explains the basics of a
The library
cargo add rig anyhow
cargo add tokio --features macros,rt-multi-thread
use rig::prelude::*;
use rig::providers::openai::{self, OpenAI};
[tokio::main]
async fn main() -> anyhow::Result<()> {
// Reads OPENAI_API_KEY.
let model = OpenAI::from_env()?.completion(openai::GPT_6_2_SOL);
let agent = AgentBuilder::new(model)
.preamble("You are a comedian.")
.build();
let response = agent.prompt("Entertain me!").await?;
println!("{}", response.output());
Ok(())
}
Rig puts over 20 model providers and a dozen vector stores behind one
interface. It has agents with tools, streaming and typed hooks. It covers
completion, embedding, transcription, audio and image models and follows the
OpenTelemetry GenAI conventions. rig-core and rig-agent build for browser
WASM. See examples/, the guides and the
API reference.
Crates
The rig crate re-exports rig-core. Its default features add rig-agent,
the derive macros, the reqwest HTTP client with rustls and, on native targets,
the rig launcher (feature cli, from rig-cli); default-features = false
leaves them out. Each crate in the list below is a feature named after it
without rig-:
cargo add rig --features memory,fastembed
- Agents and state:
rig-agent,
rig-memory (saved conversations),
rig-cassette (record and replay),
rig-rmcp (MCP tools).
- Models:
rig-bedrock,
rig-vertexai,
rig-gemini-grpc,
rig-candle (local models),
rig-fastembed (local embeddings),
rig-typesafeai (TypeSafe Jev judgments).
The vector stores, such as LanceDB, Qdrant and PostgreSQL, are companion crates behind features too; docs.rs lists every feature.
Internals: rig-core (messages, models, tools,
providers), rig-derive (feature derive),
rig-http (transport traits),
rig-reqwest (feature reqwest) and
rig-tungstenite (feature websocket).
Coding agent: rig-cli (feature cli, the library of the rig binary)
and, not facade features, rig-harness,
rig-harness-protocol,
rig-ecs, rig-tools,
rig-markdown, and the plugins
rig-basics, rig-tui,
rig-fold, rig-steel,
rig-mcp-client, rig-acp,
rig-inspect, rig-traffic
and rig-claude-cloak.
Community
Ask questions on Discord. CONTRIBUTING.md says how to contribute, and awesome-rig lists projects built on Rig.
Rig is pre-1.0, so releases break APIs. The changelog and migration notes say what changed. Rig is MIT licensed.
