Skip to main content

Crate rig_agent

Crate rig_agent 

Source
Expand description

Rig’s classic agent runtime: builders, serializable run state, hooks, tools, and typed extraction.

Portable contracts live in rig_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.

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.
completion
Runtime errors for the classic agent runtime, plus the portable completion contracts.
extractor
Typed extraction through an agent’s submit output tool, with configurable retries.
handlers
The handler table an agent dispatches its effects through, served inline.
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_utilstest-utils
Test utilities for the classic runtime and its provider-facing acceptance tests.
tool
Tool authoring, ordered registrations, and structured execution results.

Structs§

ModelRef
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_toolderive
Generates a tool type, parameter struct, and uppercase static from a function returning Result<T, E>, implementing rig_core::tool::Tool. The function may take the call’s &mut ToolContext. Imported context names need #[rig(context)]; qualified Rig paths are recognized directly. The context is excluded from model arguments.