Skip to main content

Crate molo_agent

Crate molo_agent 

Source
Expand description

Agent runtime, memory, channels, and tool registry for molo.

Re-exports§

pub use agent::Agent;
pub use agent::AgentConfig;
pub use agent::AgentError;
pub use agent::AgentEvent;
pub use agent::AgentKernel;
pub use agent::MessageChunk;
pub use agent::ReActAgent;
pub use agent::ReActAgentBuilder;
pub use agent::ReActEvent;
pub use agent::StructuredOutcome;
pub use agent::StructuredValidator;
pub use agent::TypedAgent;
pub use event_channel::BroadcastEventChannel;
pub use event_channel::EventChannel;
pub use event_channel::EventChannelStats;
pub use event_channel::EventReceiver;
pub use event_channel::MpscEventChannel;
pub use memory::Budget;
pub use memory::CharTokenCounter;
pub use memory::InMemoryMemory;
pub use memory::Memory;
pub use memory::MemoryError;
pub use memory::SummarizeStrategy;
pub use memory::TokenCounter;
pub use memory::TrimResult;
pub use memory::TrimStrategy;
pub use memory::WindowDrop;
pub use memory::WindowMemory;
pub use message_channel::CliMessageChannel;
pub use message_channel::BroadcastChannel;
pub use message_channel::BroadcastReceiver;
pub use message_channel::ChannelError;
pub use message_channel::IncomingMessage;
pub use message_channel::MessageChannel;
pub use message_channel::MpscChannel;
pub use message_channel::WatchChannel;
pub use message_channel::WatchReceiver;
pub use tool::MissingTools;
pub use tool::RegistryError;
pub use tool::ToolRegistry;

Modules§

agent
Agents: reasoning loops.
effect
Effect protocol: side-effect requests and observations.
event_channel
Observation channels: the Agent publishes process events internally, and the environment / UI side subscribes.
memory
Memory: manages the agent’s context.
message
Conversation messages.
message_channel
MessageChannel: a message transport channel between an Agent and the outside world (a human or another Agent).
observability
Lightweight observability record types.
provider
Provider: the interface for communicating with an LLM.
run
Structured run protocol shared by agent implementations and callers.
tool
Tool registry support for agent runtimes.

Macros§

react_agent
Convenience assembly macro: registers a list of tools (possibly heterogeneous) with automatic boxing, creating a ToolRegistry internally. The system prompt is optional (omitted = no system prompt). Six arms:

Structs§

Artifact
A handle to an artifact produced by a run.
CancellationToken
A token which can be used to signal a cancellation request to one or more tasks.
ChatRequest
A single conversation request.
ChatResponse
The reply to one conversation.
DisplayOutput
Output intended for host/UI display.
EffectObservation
Observation returned to an agent after an effect request is governed and executed by an outer harness.
EffectOutput
Output produced by an executed effect.
EffectRequest
Request for an outer harness to govern and execute a side effect.
EffectSource
Source tool call that produced an effect request.
FakeProvider
A programmable fake Provider — a script is a sequence of per-turn replies, consumed in order by chat / stream_chat.
ImageContent
Raw image data carried in a ContentBlock::Image.
ModelObservation
Successful provider response observed by a step-wise agent kernel.
ModelOptions
Model options for one conversation.
ModelRequest
Provider request emitted by a step-wise agent kernel.
ProviderCapabilities
Provider capability metadata used by hosts and conformance tests.
ProviderRequestContext
Request-scoped provider context.
RetryPolicy
Retry policy (with defaults; Default is “exponential backoff + jitter, 3 attempts”).
RetryProvider
Retry wrapper: implements Provider and retries inner failures per RetryPolicy.
RunContext
Execution controls and host-owned metadata for one run.
RunOutput
Structured result of one non-streaming run.
RunRequest
Input and model parameters for one run.
RunSummary
Execution summary for one run.
SharedState
Shared state: a heterogeneous container accessed by type.
ToolCall
A tool call requested by the model.
ToolContext
Context passed to a tool call.
ToolNamespace
Namespace assigned to a tool by the host application or extension layer.
ToolOutput
Model-visible output produced by a tool.
ToolPolicy
Tool policy metadata declared by the tool author.
ToolSchema
The definition of a tool.
ToolSource
Host-facing metadata describing where a provider-visible tool came from.
TypedRunOutput
Typed-output result paired with the raw structured run output.
Usage
Token usage for one conversation.

Enums§

AgentAction
Next action requested by a step-wise agent kernel.
Backoff
Backoff strategy: how long to wait after each failure before the next attempt.
ContentBlock
A content block within a message.
DisplayFormat
Display output format.
EffectKind
Kind of side effect requested by an agent.
EffectStatus
Terminal status of an executed effect.
FakeReply
One turn of reply from the script.
FinishReason
Why the model ended its reply.
Message
A single message in a conversation.
Observation
Observation fed back to a step-wise agent kernel.
ProviderError
Why a Provider call failed.
Retryable
Retry judgment: which errors are worth retrying.
RiskLevel
Request-declared risk level.
SideEffectLevel
Declared side-effect level for a tool.
StreamEvent
An event in a streamed conversation reply.
ToolError
Reasons a tool call fails.
ToolMemoryPolicy
Memory handling policy for model-visible tool/effect output.
ToolNamespaceKind
Kind of tool namespace.
ToolResult
Result of a tool call.
ToolTrustLevel
Trust level assigned to a tool source.
UserInput
User input accepted by a run.

Traits§

Provider
The interface for chatting with an LLM.
Tool
A tool an agent can invoke.

Type Aliases§

RunMetadata
Request, context, or output metadata for one run.

Attribute Macros§

async_trait