Expand description
molo — an embeddable Rust agent runtime and harness framework.
The molo crate is the facade over the molo workspace crates. It keeps
the ergonomic molo::... import path while the implementation is split
into focused crates:
molo-core: message, run, provider, tool, and effect protocols.molo-agent: agent runtime, memory, channels, and tool registry.molo-harness: governed effect execution.molo-coding: coding-workload primitives.molo-mcp: MCP adapter.molo-skills: Agent Skills protocol.molo-openai: OpenAI-compatible provider.
§Feature Flags
The default surface stays lightweight. Enable optional layers explicitly:
openai:OpenAiProviderand OpenAI-compatible HTTP/SSE support.structured: typed output and JSON Schema validation.macros: the#[molo::tool]attribute macro; also enablesstructured.skills: Agent Skills protocol support.mcp: MCP client/tool adapter support.harness: governed effect execution.coding: coding-workload primitives on top ofharness.cli-channel: stdin/stdout message channel.tracing: internal tracing spans and logs.full: all optional capabilities above.
§Quick Start
A minimal agent needs a Provider, memory, and an optional
ToolRegistry. The react_agent! macro assembles the default ReAct
runtime while keeping the familiar molo::... path:
use molo::{react_agent, Agent, FakeProvider, FakeReply};
let mut agent = react_agent!(
FakeProvider::new([FakeReply::Text("Hello".into())]),
"You are a helpful assistant",
);
let answer = agent.run("Are you there?").await?;
assert_eq!(answer, "Hello");Applications can keep using the facade crate, or depend on focused crates
such as molo-core, molo-agent, and molo-harness when they need a
smaller dependency surface.
Modules§
- agent
- Agent runtime facade.
- coding
- Coding-workload primitives facade.
- effect
- Effect protocol facade.
- event_
channel - Event channel facade.
- harness
- Harness runtime facade.
- mcp
- MCP adapter facade.
- memory
- Memory facade.
- message
- Message model facade.
- message_
channel - Message channel facade.
- observability
- Observability facade.
- provider
- Provider facade.
- run
- Run protocol facade.
- skill
- Agent Skills facade.
- tool
- Tool protocol and registry facade.
Macros§
- react_
agent - Convenience assembly macro: registers a list of tools (possibly
heterogeneous) with automatic boxing, creating a
ToolRegistryinternally. The system prompt is optional (omitted = no system prompt). Six arms:
Structs§
- Agent
Change Tracker - Tracks files changed by the agent layer.
- Agent
Config - Optional behavior configuration for an Agent.
- Agent
Event Record - Serializable, redacted event record for out-of-process observers.
- Allowed
Tool - Tool dependencies declared by a skill: tool name + optional scope (execution belongs to the application layer; this struct only parses and matches).
- Always
Allow Approval Broker - Approval broker that always allows requests.
- Always
Deny Approval Broker - Approval broker that always denies requests.
- Apply
Patch Payload - Typed payload for applying a structured patch.
- Apply
Patch Tool - Model-visible adapter that requests a governed structured patch.
- Approval
Request - Approval request passed to an
ApprovalBroker. - Artifact
- A handle to an artifact produced by a run.
- Basic
Harness - Minimal in-process harness implementation.
- Broadcast
Channel - A one-to-many broadcast channel: messages are broadcast to all subscribers (
BroadcastChannel::subscribe). - Broadcast
Event Channel - A broadcast event channel: multiple subscribers, each consuming independently; slow subscribers drop the oldest.
- Broadcast
Receiver - The receive end of a broadcast channel: one per subscriber, each consuming independently.
- Budget
- Window budget: token and round limits (both optional; when both are set, the smaller window wins).
- Cancellation
Token - A token which can be used to signal a cancellation request to one or more tasks.
- Char
Token Counter - Default counter: CJK characters count as 1 token each, other characters count as 1 token per 4 characters (rounded up).
- Chat
Request - A single conversation request.
- Chat
Response - The reply to one conversation.
- Classified
Effect - Classified effect request.
- CliGit
Inspector - Git inspector implemented by invoking read-only git commands.
- CliMessage
Channel - A command-line message channel: prints messages to the terminal and reads one line from stdin as the reply.
- Coding
Context Bundle - Context bundle returned by a
CodingContextProvider. - Coding
Context Include - Flags controlling which context sources are gathered.
- Coding
Context Request - Coding context request.
- Coding
Effect Executor - Effect executor that routes typed coding payloads to coding primitives.
- Coding
Executor Config - Configuration for
CodingEffectExecutor. - Coding
Policy Engine - Conservative coding policy wrapper around a host policy engine.
- Coding
Policy Input - Typed input produced for coding policy evaluation.
- Command
Executor Capabilities - Executor capability report.
- Command
Executor Identity - Executor identity included in capability and execution reports.
- Command
Output - Command output.
- Command
Output Limit - Per-stream output limit.
- Command
Pattern - Prefix pattern used by
CommandTaxonomyallowlists. - Command
Payload - Typed payload for command execution.
- Command
Request - Command execution request.
- Command
Taxonomy - Command taxonomy and host-provided allowlists for coding policy.
- Command
Test Runner - Test runner backed by a
CommandExecutor. - Content
Digest - Stable content digest used in file version preconditions.
- Context
Budget - Context budget for repository context gathering.
- Default
Coding Context Provider - Baseline context provider that combines workspace, search, git, and instruction primitives.
- Default
Instruction Resolver - Default resolver that searches for
AGENTS.md-style files from root to target parent directories. - Default
Policy Engine - Risk-based default policy.
- Default
Risk Classifier - Conservative default risk classifier.
- Dependency
Metadata - Dependency manifest metadata discovered by context gathering.
- Diff
Request - Request to diff two snapshots.
- Display
Output - Output intended for host/UI display.
- Effect
Observation - Observation returned to an agent after an effect request is governed and executed by an outer harness.
- Effect
Output - Output produced by an executed effect.
- Effect
Request - Request for an outer harness to govern and execute a side effect.
- Effect
Source - Source tool call that produced an effect request.
- Event
Channel Stats - Diagnostic counters for best-effort event channels.
- Execution
Policy - Execution policy passed to an
EffectExecutor. - Execution
Policy Summary - Serializable summary of an execution policy.
- Fake
Provider - A programmable fake
Provider— a script is a sequence of per-turn replies, consumed in order bychat/stream_chat. - File
Content - File content returned by a workspace read.
- File
Patch - Patch for one file.
- File
Read Options - Options for workspace file reads.
- File
Version - File version used to detect stale writes and patch conflicts.
- File
Write Result - Result of a successful workspace write.
- GitChanged
File - Changed git file.
- GitChanged
Files Request - Changed-files request.
- GitDiff
Request - Git diff request.
- GitHead
- Current git head.
- GitPayload
- Typed payload for read-only git inspection.
- GitStatus
- Parsed git status.
- GitStatus
Request - Git status request.
- GitStatus
Tool - Model-visible adapter that requests read-only git status.
- Harness
Config - Harness configuration.
- Harness
Runtime - Outer runtime that drives an
AgentKernelwith aProviderand governedHarness. - Harness
Runtime Config - Runtime loop configuration.
- Image
Content - Raw image data carried in a
ContentBlock::Image. - InMemory
Memory - In-memory implementation: stores all messages verbatim.
- Incoming
Message - A message received from the channel: the text content, plus a reply slot that only questions have.
- Instruction
Bundle - Resolved project instructions.
- Instruction
File - One resolved instruction file.
- Instruction
File Spec - Instruction file candidate.
- Instruction
Request - Instruction resolution request.
- Limited
Output - Output after limiting and redaction.
- List
Files Payload - Typed payload for listing workspace files.
- List
Files Query - Query for deterministic workspace listing.
- List
Files Tool - Model-visible adapter that requests a governed workspace listing.
- Load
Skill Reference Tool - Tool that loads text references for already active skills.
- Load
Skill Tool - Skill loading tool: reads the SKILL.md body by name; the second step of progressive disclosure.
- Local
Command Executor - Local non-PTY, one-shot command executor backed by host process spawning.
- Local
Workspace - Local filesystem implementation of
Workspace. - Local
Workspace Config - Local filesystem workspace configuration.
- McpCache
Hint - Cache hint for an MCP tool catalog.
- McpCall
Payload - Payload carried inside an
EffectKind::Mcprequest. - McpClient
- MCP client adapter: connects to an MCP server and converts its tools into molo tools.
- McpDirect
Tool - Direct adapter tool produced by
McpClient::tools: implements molo’sTooltrait and proxies calls to the MCP server. - McpEffect
Executor - Effect executor for
EffectKind::Mcprequests. - McpEffect
Tool - MCP tool wrapper for harness-governed execution.
- McpPermission
Bridge - MCP permission bridge usable as a harness
PolicyEngine. - McpServer
Id - Stable host-assigned MCP server id.
- McpServer
Policy - Policy for one MCP server.
- McpTool
Call Output - Output returned by a host-owned MCP client provider.
- McpTool
Catalog - Snapshot of a server’s MCP tool catalog.
- McpTool
Descriptor - Description of one MCP tool discovered from a server.
- McpTool
Id - MCP tool id scoped to one server.
- Missing
Tools - Tool names in a
ToolRegistry::subsetallowlist that do not exist in the main registry. - Model
Observation - Successful provider response observed by a step-wise agent kernel.
- Model
Options - Model options for one conversation.
- Model
Request - Provider request emitted by a step-wise agent kernel.
- Model
Summary - Summary of a model observation.
- Mpsc
Channel - A one-to-one dialogue channel between two Agents (or a program and a human).
- Mpsc
Event Channel - A single-queue event channel: one subscriber, strictly ordered and lossless within capacity, dropping new events when full.
- Noop
Audit Sink - Explicit opt-out audit sink.
- Noop
Effect Executor - Executor that refuses every effect without performing side effects.
- Noop
Redactor - Redactor that leaves output unchanged.
- Noop
Transcript Store - Transcript store that drops all records.
- Open
AiProvider - Provider implementation for OpenAI-compatible APIs.
- Output
Limit - Output size limits.
- Output
Text - Text output with truncation metadata.
- Patch
- Structured patch containing one or more file patches.
- Patch
Conflict - Patch conflict with model-safe details.
- Patch
Hunk - Text hunk used by the local workspace patch applier.
- Patch
Request - Request to apply or dry-run a patch.
- Patch
Result - Result from applying or dry-running a patch.
- Pattern
Redactor - Secret-pattern redactor for examples and tests.
- Policy
Enforcement Report - Report describing which policies were enforced by the command executor.
- Provider
Capabilities - Provider capability metadata used by hosts and conformance tests.
- Provider
Request Context - Request-scoped provider context.
- RawEffect
Output - Raw executor output before limiter/redactor processing.
- ReAct
Agent - The classic ReAct reasoning loop: conversation → tool execution fed back → until the model answers directly.
- ReAct
Agent Builder - Builder for assembling a
ReActAgentfrom the same components used byReActAgent::new, plus optional runtime configuration. - Read
File Payload - Typed payload for reading a workspace file.
- Read
File Tool - Model-visible adapter that requests a governed workspace file read.
- Redacted
Text - Redacted text and metadata.
- Redaction
Record - A redaction that was applied to an exported record or text field.
- Repo
Search Request - Repository search request.
- Repo
Search Results - Repository search results.
- Resolved
Path - Resolved workspace path with canonicalization metadata.
- Retry
Policy - Retry policy (with defaults;
Defaultis “exponential backoff + jitter, 3 attempts”). - Retry
Provider - Retry wrapper: implements
Providerand retries inner failures perRetryPolicy. - Ripgrep
Searcher - Repository searcher that invokes
rgthrough aCommandExecutor. - Router
Effect Executor - Executor that dispatches by
EffectKind. - RunCommand
Tool - Model-visible adapter that requests governed command execution.
- 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.
- Search
Match - One repository search match.
- Search
Payload - Typed payload for repository search.
- Search
Repo Tool - Model-visible adapter that requests governed repository search.
- Shared
State - Shared state: a heterogeneous container accessed by type.
- Skill
- A parsed SKILL.md (a data packet, immutable;
Clonecopies by value). - Skill
Activation State - Session activation state for a skill layer.
- Skill
Layer - Optional Agent Skills extension layer.
- Skill
Layer Assembly - Assembled output of a
SkillLayer. - Skill
Layer Config - Configuration for
SkillLayerassembly. - Skill
Layer Manifest - Skill layer manifest for transcript/debug use.
- Skill
Registry - Skill registry: holds a collection of skills, responsible for lookup and disclosure by name.
- Skill
Resource Store - Skill resource loading limits.
- Snapshot
Request - Request for a lightweight workspace snapshot.
- Static
Approval Broker - Static approval broker configured with a single decision.
- Static
Effect Executor - Test executor that returns preconfigured outputs by effect id.
- Structured
Validator - Structured output validator: schema validation of the model’s answer + independent retry budget + feedback messages.
- Summarize
Strategy - Summarization trim strategy: over-budget old messages → summarizer → one System summary message.
- Test
RunRequest - Test run request.
- Tool
Call - A tool call requested by the model.
- Tool
Context - Context passed to a tool call.
- Tool
Namespace - Namespace assigned to a tool by the host application or extension layer.
- Tool
Output - Model-visible output produced by a tool.
- Tool
Policy - Tool policy metadata declared by the tool author.
- Tool
Registry - Tool registry: holds tools, responsible for lookup and dispatch by name.
- Tool
Schema - The definition of a tool.
- Tool
Source - Host-facing metadata describing where a provider-visible tool came from.
- Trim
Result - Output of a trim strategy: the trimmed message sequence + how the result is handled.
- Typed
RunOutput - Typed-output result paired with the raw structured run output.
- Usage
- Token usage for one conversation.
- VecAudit
Sink - In-memory audit sink useful for tests.
- VecTranscript
Store - In-memory transcript store useful for tests.
- Verification
Result - Structured verification result.
- Watch
Channel - Observes changes of the latest state value: holds and updates one value, and all observers
(
WatchChannel::subscribe) are notified when it changes. - Watch
Receiver - The receive end of a watch channel: observes value changes.
- Window
Drop - Default trim strategy: drops the earliest complete rounds until the remaining sequence fits the budget.
- Window
Memory - Window memory: stores all messages;
context()trims to the budget on retrieval. - Workspace
Diff - Workspace diff summary.
- Workspace
Entry - Workspace entry returned by listing.
- Workspace
Path - A root-relative path validated for workspace operations.
- Workspace
Root - Canonical root directory that bounds workspace filesystem access.
- Workspace
Searcher - In-process fallback searcher based on
Workspacereads. - Write
File Payload - Typed payload for writing a workspace file.
- Write
File Request - Request to write a workspace file.
Enums§
- Agent
Action - Next action requested by a step-wise agent kernel.
- Agent
Action Summary - Summary of an agent action for transcript records.
- Agent
Error - Reasons an Agent run can fail.
- Approval
Decision - Approval decision.
- Approval
Error - Approval errors.
- Audit
Error - Audit errors.
- Audit
Event - Reliable effect-governance audit event.
- Backoff
- Backoff strategy: how long to wait after each failure before the next attempt.
- Channel
Error - The reason a message channel failed.
- Coding
Context Error - Coding context errors.
- Coding
Error - Errors returned by typed coding payload adapters and executor routing.
- Coding
Policy Class - Coding-specific operation class used by conservative policy presets.
- Command
Error - Command execution errors.
- Command
Executor Backend - Command executor backend family.
- Command
Status - Terminal command status.
- Content
Block - A content block within a message.
- Display
Format - Display output format.
- Effect
Kind - Kind of side effect requested by an agent.
- Effect
Status - Terminal status of an executed effect.
- EnvPolicy
- Environment variable handling for command execution.
- Event
Severity - Severity for a serializable agent event record.
- Execution
Error - Executor errors.
- Fake
Reply - One turn of reply from the script.
- File
Body - File body with text and binary separated explicitly.
- File
Write Content - Content to write into a workspace file.
- Finish
Reason - Why the model ended its reply.
- GitError
- Git inspection errors.
- GitOperation
- Read-only git operation for typed git effects.
- Harness
Error - Errors returned by a harness.
- Harness
Runtime Error - Errors returned by
HarnessRuntime. - Instruction
Error - Instruction resolver errors.
- McpError
- Assembly-time errors (connect / list tools); call-time errors go through
ToolError::Execution. - McpTool
Mode - MCP tool execution mode.
- Memory
Error - Context access failed.
- Message
- A single message in a conversation.
- Message
Chunk - Message chunks for a streaming run — the streaming output of one run, sliced into pieces.
- Network
Policy - Network access policy requested of an executor.
- Observation
- Observation fed back to a step-wise agent kernel.
- Patch
Operation - File patch operation.
- Policy
Capability Mode - How strictly policy/capability mismatches are handled.
- Policy
Decision - Policy decision for a classified effect.
- Policy
Enforcement Status - Structured enforcement status for a policy dimension.
- Provider
Error - Why a Provider call failed.
- PtyMode
- PTY mode requested for a command.
- ReAct
Event - A single event from ReActAgent (application level; the event name is
provided per variant via
AgentEvent::name). - Registry
Error - Reasons a tool execution fails (registry level, defined by the framework).
- Resolved
Path Kind - Filesystem kind observed when resolving a workspace path.
- Retryable
- Retry judgment: which errors are worth retrying.
- Risk
Level - Request-declared risk level.
- Sandbox
Policy - Filesystem/process sandbox policy requested of an executor.
- Search
Error - Search errors.
- Search
Mode - Repository search mode.
- Side
Effect Level - Declared side-effect level for a tool.
- Skill
Error - Reasons a skill parse / load fails.
- Skill
Mode - Skill assembly mode.
- Skill
Source Trust - Trust assigned by the host to skill packages.
- Stream
Event - An event in a streamed conversation reply.
- Structured
Outcome - The outcome of a single validation
(
StructuredValidator::validatereturn value). - Structured
Output Mode - Transport shape for structured output (an OpenAiProvider construction
setting): decides how
response_formatis sent. - Symlink
Policy - Symlink behavior for local workspace operations.
- Test
RunError - Test run errors.
- Text
Encoding - Encoding of text file content.
- Tool
Error - Reasons a tool call fails.
- Tool
Memory Policy - Memory handling policy for model-visible tool/effect output.
- Tool
Namespace Kind - Kind of tool namespace.
- Tool
Result - Result of a tool call.
- Tool
Trust Level - Trust level assigned to a tool source.
- Transcript
Error - Transcript errors.
- Transcript
Record - Transcript record for run replay and debugging.
- User
Input - User input accepted by a run.
- Workspace
Access - Requested workspace access mode.
- Workspace
Error - Workspace operation errors.
Traits§
- Agent
- Reasoning-loop interface: one
runtakes the user input, drives the reasoning loop, and returns the final answer. - Agent
Event - Application-level event abstraction.
- Agent
Kernel - Step-wise agent kernel boundary.
- Approval
Broker - Broker that obtains approval from an application-specific authority.
- Audit
Sink - Reliable audit sink.
- Coding
Context Provider - Provides repository context outside chat memory.
- Command
Executor - Executes approved command requests.
- Effect
Executor - Executes an already approved effect.
- Event
Channel - The observation channel abstraction: the Agent publishes events internally, and the environment side subscribes.
- Event
Receiver - The unified receive-end interface: the environment side takes subscribed events out one by one.
- GitInspector
- Read-only git inspector.
- Harness
- Governs and executes one or more effect requests.
- Instruction
Resolver - Resolves project instruction files.
- McpClient
Provider - Host-owned MCP client provider used by
McpEffectExecutor. - Memory
- Manages the agent’s context: decides which messages the model sees on each turn.
- Message
Channel - Sends a question to the outside world and waits for a reply, or sends a one-way notification.
- Policy
Engine - Evaluates host policy for a classified effect.
- Provider
- The interface for chatting with an LLM.
- Redactor
- Redacts executor output before model/audit/transcript use.
- Repo
Searcher - Search implementation for repositories.
- Test
Runner - Convenience adapter for test commands.
- Token
Counter - Counts the token number of a text.
- Tool
- A tool an agent can invoke.
- Transcript
Store - Transcript store for resumable run traces.
- Trim
Strategy - Trim strategy: decides “how to trim” — window dropping, summarization, LLM compaction, etc. Users can inject custom implementations.
- Typed
Agent - Optional capability: typed output (opt-in — implementations that don’t need it don’t implement it; the method doesn’t even exist at compile time).
- Workspace
- Workspace abstraction for coding workloads.
Type Aliases§
- RunMetadata
- Request, context, or output metadata for one run.
Attribute Macros§
- async_
trait - tool
- Compiles an async function into a
molo::tool::Toolimplementation.