Core Concepts
Rig is built from a small set of composable pieces. Once you see how they layer, everything else is a variation on the same pattern. This page is the map; each piece has its own page.
The mental model
Section titled “The mental model”The building blocks stack from the bottom up:
- Provider clients hold a vendor’s configuration (OpenAI, Anthropic, Gemini, Ollama, and more) and a transport.
- Models come from a client: completion models for text generation,
embedding models for vectors, plus transcription, image, and audio models where
the provider has them. You can call a model directly with a
CompletionRequest. - Agents wrap a completion model with a preamble, tools, and context, and run
the tool-calling loop for you. Each prompt is an
AgentRunneryou can tune per run; hooks observe or steer the loop. - Tools, RAG, and memory extend an agent: tools let it call your code, RAG pulls in relevant documents from a vector store, and memory loads and saves conversation history.
- Workflows compose all of the above into multi-step programs with plain Rust.
flowchart TD Client["Provider client"] --> Model["Model"] Model --> Agent["Agent"] Tools["Tools"] -.-> Agent RAG["RAG<br/>(Embeddings + Vector Store)"] -.-> Agent Memory["Memory"] -.-> Agent Agent --> Output["Text or structured output"]The Quickstart builds the first three layers (provider client, model, agent) as a complete program.
Which piece do I need?
Section titled “Which piece do I need?”Start from the task, not the type.
| I want to… | Page |
|---|---|
| connect to a provider | Providers & Clients |
| send one request without the agent loop | Completions |
| let the model call tools over several turns | Agents |
| configure one agent run | AgentRunner |
| observe or steer the loop | Hooks |
| step, pause for approval, or resume a run | Durable runs |
| let the model call my code | Tools |
| get typed data out of text | Structured Output |
| stream tokens as they arrive | Streaming |
| hold a conversation | Memory |
| embed text | Embeddings |
| answer from my documents | Vector Stores & RAG |
| load files (text, PDF, EPUB) | Loaders |
| generate images, audio, or transcripts | Media |
| orchestrate known steps in code | Workflows |
| coordinate several agents | Multi-agent systems |
| trace runs and token usage | Observability |
| record a run and replay it offline | Recording & Replay |
| test without a live model | Testing |
| handle and retry failures | Error Handling |
Explore each concept
Section titled “Explore each concept”Next steps
Section titled “Next steps”- New to Rig? Start with the Quickstart.
- Want the big picture? See Architecture.
- Ready to build something? Head to the Guides.
