Expand description
Public facade for Rig.
The rig crate is the user-facing entry point for Rig. It re-exports the
portable contracts from rig_core at their familiar rig::... paths and the
classic runtime from rig_agent under rig::agent.
rig::tool keeps the classic contextual tool API (Tool, ToolContext,
…) with the default agent feature — the same surface as before the runtime
split — and always exposes the runtime-independent contracts explicitly as
PortableTool, PortableToolEmbedding, and PortableDynamicTool. The
classic API also lives at crate::agent::tool. Classic construction
methods such as client.agent(...) come from
crate::client::AgentClientExt; use rig::prelude::*; brings it in
alongside the canonical CompletionClient, the same surface as before the
split.
§Companion integrations
Companion provider and vector-store crates are exposed as feature-gated modules on this facade. Enable only the integrations your application uses:
[dependencies]
rig = { version = "*", features = ["lancedb", "fastembed"] }This enables modules such as rig::lancedb and rig::fastembed. Other
companion integrations follow the same pattern, with feature names aligned to
their facade module paths wherever Rust module naming allows it.
§When to use rig-core directly
Depend on the rig-core package directly when you only need the core Rig
implementation crate, including provider abstractions, built-in core
providers, tools, memory traits, and vector-store traits, without the root
facade’s companion integration feature surface.
Modules§
- agent
agent - Classic agent orchestration and lifecycle APIs.
- audio_
generation audio - Everything related to audio generation (ie, Text To Speech). Rig abstracts over a number of different providers using the AudioGenerationModel trait.
- bedrock
bedrock - candle
candle - Local CPU inference with validated Llama/SmolLM2 and native tool-capable Qwen3 models.
- client
- Provider clients plus classic agent/extractor constructors.
- completion
- Low-level completion contracts plus classic prompting traits and errors.
- core
- Direct access to the portable provider and data contracts.
- embeddings
- Provider-agnostic embedding abstractions.
- extractor
agent - Classic typed extraction.
- fastembed
fastembed-hf-huborfastembed-ort-download-binariesorfastembed - gemini_
grpc gemini-grpc - helixdb
helixdb - http_
client - id
- Lightweight generation of short, unique, URL-safe identifiers.
- image_
generation image - Everything related to core image generation abstractions in Rig. Rig allows calling a number of different providers (that support image generation) using the ImageGenerationModel trait.
- integrations
agent - Classic runtime integrations.
- lancedb
lancedb - loaders
- File loading utilities for preparing local documents as model or embedding input.
- markers
- Common marker traits and structs for type-safe builders.
- memory
- Conversation memory APIs and optional memory policy helpers.
- message
- milvus
milvus - model
- Model metadata returned by providers with model listing support.
- mongodb
mongodb - neo4j
neo4j - one_
or_ many - postgres
postgres - prelude
- Common portable imports plus additive classic-runtime conveniences.
- providers
- Provider integrations included in
rig-core. - qdrant
qdrant - rerank
- Provider-agnostic reranking abstractions.
- s3vectors
s3vectors - schemars
- Schemars
- scylladb
scylladb - serde
- Serde
- sqlite
sqlite - streaming
- Low-level streaming values plus classic streaming traits.
- surrealdb
surrealdb - telemetry
- This module primarily concerns being able to orchestrate telemetry across a given pipeline or workflow. This includes tracing, being able to send traces to an OpenTelemetry collector, setting up your agents with the correct tracing style so you can emit the right traces for platforms like Langfuse, and more.
- test_
utils test-utils - tool
- Tools for the default (classic) runtime.
- transcription
- This module provides functionality for working with audio transcription models. It provides traits, structs, and enums for generating audio transcription requests, handling transcription responses, and defining transcription models.
- vector_
store - Vector store abstractions for semantic search and retrieval.
- vectorize
vectorize - vertexai
vertexai - wasm_
compat
Macros§
- completion_
parent_ span - Declare a completion-parent span conforming to the adoption contract.
- if_
not_ wasm - if_wasm
Structs§
- Agent
agent - Struct representing an LLM agent. An agent is an LLM model combined with a preamble (i.e.: system prompt) and a static set of context documents and tools. All context documents and tools are always provided to the agent when prompted.
- Agent
Builder agent - A builder for creating an agent
- Agent
Run agent - The sans-IO agent loop state machine. See the module docs for the driving protocol.
- Agent
Runner agent - A hook-aware driver over
AgentRun. - Empty
List Error - Error type for when trying to create a OneOrMany object with an empty vector.
- Extraction
Response agent - Response from an extraction operation containing the extracted data and usage information.
- OneOr
Many - Struct containing either a single item or a list of items of type T.
If a single item is present,
firstwill contain it andrestwill be empty. If multiple items are present,firstwill contain the first item andrestwill contain the rest. IMPORTANT: this struct cannot be created with an empty vector. OneOrMany objects can only be created using OneOrMany::from() or OneOrMany::try_from(). - Provider
Response Error - A raw error response preserved from a provider.
Traits§
- Embed
- Derive this trait for objects that need to be converted to vector embeddings. The Embed::embed method accumulates string values that need to be embedded by adding them to the TextEmbedder. If an error occurs, the method should return EmbedError.
Attribute Macros§
- rig_
tool derive - A procedural macro that transforms a function into a portable
rig_core::tool::PortableTool, or into the classic contextualrig::tool::Toolwhen the function accepts classic runtime context. - tool_
macro derive - A procedural macro that transforms a function into a portable
rig_core::tool::PortableTool, or into the classic contextualrig::tool::Toolwhen the function accepts classic runtime context.
Derive Macros§
- Embed
- A macro that allows you to implement the
rig::embedding::Embedtrait by deriving it. Usage can be found below: