modular-agent-core 0.23.2

Modular Agent Core
Documentation

Language Crates.io Documentation License

English | 日本語

A Rust framework for building modular multi-agent systems with stream-based message orchestration.

Features

Agents

  • Stream-Based Data Flow — Real-time data streaming between agents
  • Built-in Agents — LLM, Web/HTTP, Slack, SQL databases, screen capture, and more (via agent libraries)
  • Extensible — Add agent plugins via Rust crates

Runtime

  • Local Execution — All processing happens on your machine; no cloud dependency
  • Cross-Platform — Windows, macOS, Linux
  • Embeddable — Minimal dependencies; embed into CLI tools, desktop apps, servers, or any Rust application

Overview

modular-agent-core provides an asynchronous, stream-based architecture for orchestrating multiple agents. Agents communicate through message passing and can be composed into networks using Presets. This is the core library with minimal dependencies—individual agent implementations are available separately.

Installation

[dependencies]
modular-agent-core = "0.23"

To disable default features:

[dependencies]
modular-agent-core = { version = "0.23", default-features = false, features = ["llm"] }

Quick Start

use modular_agent_core::{AgentError, AgentValue, ModularAgent, ModularAgentEvent};

#[tokio::main]
async fn main() -> Result<(), AgentError> {
    // 1. Initialize
    let ma = ModularAgent::init()?;
    ma.ready().await?;

    // 2. Subscribe to output BEFORE starting (avoid race condition)
    let mut rx = ma.subscribe_to_event(|event| {
        if let ModularAgentEvent::ExternalOutput(name, value) = event {
            if name == "output" { return Some(value); }
        }
        None
    });

    // 3. Load and start preset
    let preset_id = ma.open_preset_from_file("preset.json", None).await?;
    ma.start_preset(&preset_id).await?;

    // 4. Send input / receive output
    ma.write_external_input("input".into(), AgentValue::string("hello")).await?;
    if let Some(value) = rx.recv().await {
        println!("Output: {:?}", value);
    }

    // 5. Cleanup
    ma.stop_preset(&preset_id).await?;
    ma.quit();
    Ok(())
}

Feature Flags

Feature Default Description
file Yes File handling support for presets
image Yes Image processing via photon-rs
llm Yes LLM integration with Message and ToolCall types
mcp Yes Model Context Protocol integration
test-utils No Testing utilities

Documentation

Full API documentation is available at docs.rs/modular-agent-core.

Related Repositories

Applications

Agent Libraries — General

Agent Libraries — Data Sources

Agent Libraries — Databases

Plugins

License

Dual-licensed under Apache 2.0 or MIT.