Expand description
Rig’s classic agent runtime: builders, serializable run state, hooks, tools, memory orchestration, and typed extraction.
Portable contracts are available through core; recording accepts
rig_core::serve::Recorder, with concrete replay adapters in rig-cassette.
Native and browser WASM targets are supported; WASI is not. MCP integration
is provided by the native-only rig-rmcp crate.
use rig_agent::core::{DynModel, operation::Completion};
use rig_agent::{Agent, AgentBuilder};
fn assistant(model: impl Into<DynModel<Completion>>) -> Agent {
AgentBuilder::new(model).preamble("Be concise.").build()
}Re-exports§
pub use agent::TypedPromptResponse;pub use agent::Agent;pub use agent::AgentBuilder;pub use agent::AgentHook;pub use agent::AgentRun;pub use agent::AgentRunner;pub use agent::HookContext;pub use agent::ModelHandle;pub use agent::ModelSelection;pub use agent::ModelSelectionAction;
Modules§
- agent
- Configurable agents, builders, hooks, and blocking or streaming run interfaces.
- bus
- Effect dispatch, handler registration, and serving through a host-driven bus.
- completion
- Runtime errors for the classic agent runtime, plus the portable completion contracts.
- core
- Portable provider, data, memory, and tool contracts, also used as the expansion
root for portable
#[rig_tool]functions. These exports are not forwarded to therig_agentcrate root. - extractor
- Typed extraction through an agent’s
submitoutput tool, with configurable retries. - integrations
- Ready-made integrations: the CLI chatbot. User-facing integrations for classic agents.
- prelude
- Common imports for Rig’s classic runtime.
- run
- Serializable, sans-I/O state machine for model turns, tool recovery, and history.
- streaming
- Portable streaming types re-exported for classic runtime users.
- test_
utils test-utils - Test utilities for the classic runtime and its provider-facing acceptance tests.
- tool
- Tool authoring, ordered registrations, and structured execution results.
Structs§
- Model
Ref - Model label serialized as a string. Equality compares labels without provider interpretation; resolving a label to a live handle is the runtime’s responsibility.
Attribute Macros§
- rig_
tool derive - Generates a tool type, parameter struct, and uppercase static from a function
returning
Result<T, E>. Functions with a mutable context implementrig_core::tool::Tool; others implementrig_core::tool::PortableTool. Imported context names need#[rig(context)]; qualified Rig paths are recognized directly. The context is excluded from model arguments.