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
[]
= "0.25"
To disable default features:
[]
= { = "0.25", = false, = ["llm"] }
Quick Start
use ;
async
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 |
mcp-server |
No | Built-in MCP server (implies file) |
test-utils |
No | Testing utilities |
External Agent Editing (MCP Server)
With the mcp-server feature, a host application can expose its running ModularAgent over a localhost MCP endpoint, so external AI agents such as Claude Code can inspect agent definitions, build and edit presets, and verify running flows through natural language.
= { = "0.25", = ["mcp-server"] }
use ;
// Serves streamable HTTP at http://127.0.0.1:8765/mcp (localhost only).
let handle = start_mcp_server
.await?;
// ...
handle.stop.await;
Connect from Claude Code:
Then ask, for example:
Create a flow that listens to a Slack channel, sends each message to a Chat agent, and posts the reply back to the channel.
The external agent typically calls list_agent_definitions to discover the catalog, then create_preset → add_agent ×4 (Slack Listener, Slack To Message, Chat, Slack Post) → add_connection ×3 → save_preset. It can then verify the flow end to end: start_preset, feed a test value with write_external_input, and poll get_external_outputs / get_agent_errors. Both polling tools return latest_seq — the seq of the last record returned — which the agent passes back as since_seq on the next call to receive only new records; dropped > 0 means the event collector fell behind the broadcast stream and some events were never captured. Separately, the capture buffer keeps only the most recent 200 records per kind, so records not polled in time can age out without affecting dropped. Structure changes emit ModularAgentEvent::PresetStructureChanged so hosts (e.g. modular-agent-desktop) can refresh their UI live. The full tool list (17 tools) covers definitions, preset CRUD, agent/connection editing, config updates, start/stop, and runtime verification.
The server binds 127.0.0.1 only. When token is set, every request must carry an Authorization: Bearer <token> header and is rejected with 401 otherwise; without a token the server is unauthenticated, so enable it deliberately. modular-agent-desktop exposes it via Settings → Core (with an auto-generated token); modular-agent-cli via the --mcp-port <PORT> and --mcp-token <TOKEN> flags.
Documentation
Full API documentation is available at docs.rs/modular-agent-core.
Related Repositories
Applications
- modular-agent-desktop - Visual presets editor (Tauri 2 + Svelte 5)
Agent Libraries — General
- modular-agent-std - Standard utility agents (50+)
- modular-agent-llm - OpenAI, Ollama integration
Agent Libraries — Data Sources
- modular-agent-lifelog - Screen capture, window tracking agents
- modular-agent-slack - Slack messaging agents
- modular-agent-web - HTTP, scraping, YouTube agents
Agent Libraries — Databases
- modular-agent-duckdb - DuckDB analytics agents
- modular-agent-lancedb - Vector database agents
- modular-agent-mongodb - MongoDB CRUD agents
- modular-agent-sqlx - SQLite, MySQL, PostgreSQL agents
- modular-agent-surrealdb - SurrealDB graph DB agents
Plugins
- tauri-plugin-modular-agent - Tauri plugin bridge
License
Dual-licensed under Apache 2.0 or MIT.