Expand description
§Modular Agent Core
A Rust framework for building modular multi-agent orchestration systems.
This crate provides tools and abstractions to create, configure, and run agents in a stream-based architecture. It supports defining agent behaviors, managing agent flows, and handling agent input/output through a channel-based messaging system.
§Core Concepts
§ModularAgent
ModularAgent is the central orchestrator that manages agent lifecycle, connections,
and message routing. It maintains agent instances, connection maps, and handles events.
§Agents
Agents are processing units that receive messages via channels and process them
asynchronously. Implement the AsAgent trait to create custom agents, or use the
#[modular_agent] macro for declarative agent definitions.
§Presets
Presets are collections of agents and their connections, defined in JSON format.
They can be loaded from files and managed via ModularAgent methods.
§Quick Start
See the CLI example for a complete working example of loading a preset and running agents from the command line.
§Feature Flags
file- File handling support (enabled by default)image- Image processing with photon-rs (enabled by default)llm- LLM integration with Message/ToolCall types (enabled by default)mcp- Model Context Protocol integration (enabled by default)test-utils- Testing utilities including TestProbeAgent
Re-exports§
pub extern crate self as modular_agent_ core; pub use llm::Message;pub use llm::ToolCall;pub use llm::ToolCallFunction;pub use photon_rs;pub use im;pub use inventory;pub use fnv;pub use indexmap;
Modules§
- llm
- LLM message types for agent-based workflows.
- mcp
- Model Context Protocol (MCP) integration for external tool servers.
- tool
- Tool registry and agents for LLM function calling.
Structs§
- Agent
Config Spec - Specification for a configuration entry.
- Agent
Configs - Configuration container for an agent.
- Agent
Context - Event-scoped context that identifies a single flow across agents and carries auxiliary metadata.
- Agent
Data - Core data structure for an agent.
- Agent
Definition - The definition (blueprint) of an agent type.
- Agent
Registration - Registration entry emitted by the
#[modular_agent]macro. - Agent
Spec - The runtime specification of an agent instance.
- Connection
Spec - A connection between two agent ports.
- Modular
Agent - The central orchestrator for the modular agent system.
- Photon
Image - Provides the image’s height, width, and contains the image’s raw pixels. For use when communicating between JS and WASM, and also natively.
- Preset
- A runtime instance of a workflow preset.
- Preset
Info - Summary information about a preset.
- Preset
Spec - The serializable specification of a preset (workflow).
Enums§
- Agent
Error - Errors that occur during agent operations.
- Agent
Status - The lifecycle status of an agent.
- Agent
Value - The value type passed between agents.
- Modular
Agent Event - Events emitted by
ModularAgentduring operation.
Traits§
- Agent
- The core trait for all agents.
- Agent
Output - Trait for sending output values and emitting events from agents.
- AsAgent
- Simplified trait for implementing custom agents.
- HasAgent
Data - Trait for types that contain
AgentData.
Type Aliases§
- Agent
Config Specs - A map of configuration keys to their specifications.
- Agent
Configs Map - Type alias for a map of agent configurations.
- Agent
Definitions - A map of agent definition names to their definitions.
- Agent
Value Map - Type alias for key-value maps used in
AgentValue::Object. - FnvIndex
Map - FnvIndex
Set - Preset
Specs - A map of preset names to their specifications.
Attribute Macros§
- async_
trait - modular_
agent - Declare agent metadata and generate
agent_definition/registerhelpers.