Rig

A Rust framework for building portable, modular LLM-powered applications and agents.

Framework
Cargo
v0.42.0
8,316stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
89/100Excellent
Development Activity100
Maintenance100
Community72
Maturity44
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture87
Code Quality84
Innovation88
Learning Curve66

Rig (published as the rig-core crate) is a Rust framework for building applications powered by large language models. It provides unified abstractions over many model providers, first-class agents with tools, embeddings, and retrieval-augmented generation, so you can compose sophisticated LLM workflows without wiring each provider’s API by hand.

Rig ships a common client interface across providers such as OpenAI, Anthropic, Gemini, and local models, together with a companion ecosystem of vector-store integrations (Postgres, MongoDB, Qdrant, LanceDB, SQLite, Neo4j, and more). Its agent, extractor, and pipeline APIs let you build chatbots, RAG systems, and structured-extraction tools in idiomatic, strongly typed Rust.

What You Get

  • A unified client API across LLM providers like OpenAI, Anthropic, and Gemini
  • Agents that combine a model, system prompt, tools, and context
  • Embeddings and retrieval-augmented generation with pluggable vector stores
  • An extractor API for turning unstructured text into typed Rust structs
  • A large ecosystem of integration crates for vector databases and model backends

Common Use Cases

  • Building chatbots and assistants backed by one or more LLM providers
  • Implementing retrieval-augmented generation over your own document corpus
  • Extracting structured, typed data from unstructured text
  • Orchestrating multi-step agent workflows with tool calls in Rust

Under The Hood

Architecture - The rig-core crate is organized by concern under crates/rig-core/src/: completion/ and model/ define the core request/response abstractions, providers/ and client/ implement provider-specific adapters behind a shared interface, agent/ composes models with tools and context, tool/ defines the callable-function contract, embeddings/ and vector_store/ power retrieval, and extractor.rs maps model output onto typed structs. Cross-cutting modules cover streaming, telemetry, loaders, and image/audio/transcription generation, while a prelude.rs exposes the common entry points. Database and backend integrations live in sibling workspace crates (rig-postgres, rig-mongodb, rig-qdrant, rig-lancedb, and many more).

Tech Stack - Written in Rust as a Cargo workspace, the project uses async Rust for provider I/O, supports a WASM-compatible build path (wasm_compat.rs), and pins its toolchain via rust-toolchain.toml. Releases are automated with release-plz, and a Nix flake provides a reproducible dev environment.

Code Quality - The codebase is modular and heavily featured, with a dedicated tests/ directory, in-crate test_utils, and a 226-contributor community driving very active development across 100+ releases. As an evolving pre-1.0 project it explicitly warns that breaking changes are expected between releases.

API Design - Rig’s public API favors a fluent builder style — you construct an agent or extractor, attach tools and context, and call it — which keeps common LLM patterns concise while staying strongly typed. Extensive docs at rig.rs, an API reference on docs.rs, and a large examples/ directory smooth the learning curve, though the breadth of providers and integrations means there is a lot of surface area to explore.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search