Skip to content

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 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 AgentRunner you 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.

Start from the task, not the type.

I want to…Page
connect to a providerProviders & Clients
send one request without the agent loopCompletions
let the model call tools over several turnsAgents
configure one agent runAgentRunner
observe or steer the loopHooks
step, pause for approval, or resume a runDurable runs
let the model call my codeTools
get typed data out of textStructured Output
stream tokens as they arriveStreaming
hold a conversationMemory
embed textEmbeddings
answer from my documentsVector Stores & RAG
load files (text, PDF, EPUB)Loaders
generate images, audio, or transcriptsMedia
orchestrate known steps in codeWorkflows
coordinate several agentsMulti-agent systems
trace runs and token usageObservability
record a run and replay it offlineRecording & Replay
test without a live modelTesting
handle and retry failuresError Handling