rig: A Rust library for building modular and scalable applications on large language models.
What problem it solves
Building LLM applications often requires connecting model providers, vector stores, tools, streaming, and agent capabilities. Rig provides a shared Rust interface for these components and includes a terminal coding agent that can be extended with plugins.
Key features
Unified model and vector-store interfaces — Use a shared interface for model providers and vector stores, with support for completion, embedding, transcription, audio, and image models.
Source: README
Agents with tools and streaming — Construct agents with preambles and tools, send prompts asynchronously, and work with streaming responses and typed hooks.
Source: README
Feature-based crate selection — Select capabilities through Cargo features, including memory, local embeddings, saved conversations, record-and-replay support, and MCP tools.
Source: README
Extensible terminal coding agent — The terminal agent organizes tools, commands, sessions, sign-in, and the terminal view as replaceable or optional plugins. Changes can be rebuilt while retaining the active session.
Source: README
Browser and native targets — The core library and agent crate support browser WebAssembly builds, while the terminal agent runs on Linux and macOS.
Source: README
Quick start
Copied verbatim from the project's README.
cargo add rig anyhow
cargo add tokio --features macros,rt-multi-threaduse 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(())
}Who it may suit
This may suit Rust developers building LLM-powered applications or extending the terminal coding agent with custom plugins.
Topics to discuss
Which provider and vector-store integrations should receive priority next?
What plugin capabilities would be most useful for the terminal coding agent?
How should examples and guides cover agent tools, streaming, and typed hooks?
Written by ReadmeX AI from the project's README, source and public GitHub data; it may contain mistakes.
Read the original README https://github.com/0xPlaygrounds/rig#readme
ReadmeX opened this community for a trending project; it is not run by the project. Maintainers can claim it from the community page.
Comments
…