How 0xplaygrounds/rig works
Rig is a Rust library for building LLM-powered applications. A host configures a model, then uses the classic agent runtime to turn prompts into model requests, dispatch tool calls, and return results; alternatively, it can call the shared model abstraction directly. The core also provides provider and vector-store integrations, embeddings, multimodal operations, and an ECS runtime with checkpointing. Relationships below are limited to those documented in the README or visible in sampled source/index references; unsampled subsystems are represented by their listed directories without speculative internal flows.
Main entry points: engine.rs Agent Engine · driver.rs Model Adapter · lib.rs Rig Facade · builder.rs Agent Builder
Components 22
Library Surface
- Rig Facade
src/lib.rs
Agent Runtime
- Agent Builder
crates/rig-agent/src/agent/builder.rs - Agent Engine
crates/rig-agent/src/agent/engine.rs - Run State Machine
crates/rig-agent/src/run/mod.rs - Lifecycle Hooks
crates/rig-agent/src/agent/hook.rs - Agent Streaming
crates/rig-agent/src/agent/streaming.rs - Tool Registry
crates/rig-agent/src/tool/server.rs - Effect Bus
crates/rig-agent/src/bus/mod.rs
Model Core
- Model Adapter
crates/rig-core/src/driver.rs - Model Operations
crates/rig-core/src/operation.rs - Provider Wire
crates/rig-core/src/wire.rs - Completion Contract
crates/rig-core/src/completion/mod.rs - Provider Responses
crates/rig-core/src/provider_response.rs
Providers And Stores
- Provider Mappings
crates/rig-core/src/providers - Vector Stores
crates/rig-core/src/vector_store - Embeddings
crates/rig-core/src/embeddings - Media Operations
crates/rig-core/src - Bedrock Runtime
crates/rig-bedrock/src/client.rs
Stateful Execution
- ECS Runtime
crates/rig-ecs/src - Effect Replay
crates/rig-cassette/src
Other components
- Application Host
- Model Provider
Connections 23
- Application Host → Rig Facade: uses
README.md - Rig Facade → Agent Builder: re-exports
README.md - Rig Facade → Model Adapter: re-exports
README.md - Application Host → Agent Builder: configures
README.md - Agent Builder → Agent Engine: starts runtime
- Agent Engine → Run State Machine: advances state
crates/rig-agent/src/agent/engine.rs - Agent Engine → Lifecycle Hooks: fires hooks
crates/rig-agent/src/agent/engine.rs - Agent Engine → Agent Streaming: streams turns
crates/rig-agent/src/agent/engine.rs - Agent Engine → Tool Registry: dispatches tools
crates/rig-agent/src/agent/engine.rs - Agent Engine → Effect Bus: uses dispatch
crates/rig-agent/src/agent/engine.rs - Agent Engine → Model Adapter: executes model
README.md - Model Adapter → Provider Wire: encodes and decodes
crates/rig-core/src/driver.rs - Model Adapter → Model Operations: runs operation
crates/rig-core/src/driver.rs - Model Adapter → Provider Responses: returns response
crates/rig-core/src/driver.rs - Model Operations → Completion Contract: defines completion
crates/rig-core/src/operation.rs - Provider Wire → Model Provider: sends request
- Provider Mappings → Provider Wire: implements mappings
README.md - Bedrock Runtime → Model Provider: calls AWS Bedrock
crates/rig-bedrock/src/client.rs - Application Host → Vector Stores: uses integrations
README.md - Application Host → Embeddings: requests embeddings
README.md - Application Host → Media Operations: uses modalities
README.md - Application Host → ECS Runtime: selects runtime
README.md - ECS Runtime → Effect Replay: supports replay