mofa

Library Listed

MoFA - Modular Framework for Agents. Modular, Compositional and Programmable.

Checked · Sources

Downloads
613
Dependents
0
Stars
296
Forks
173
Contributors
72
Commits
2,438
Latest release
0.1.1 ·

About

From the project README ·

MoFA Agent Framework

English | 简体中文

Website | Quick Start | GitHub | Hackathon | Community

📋 Table of Contents

  • Overview
  • Why MoFA?
  • Core Architecture
  • Core Features
  • Quick Start
  • Roadmap
  • Ecosystem & Related Repos
  • Documentation
  • Security
  • Contributing
  • Community
  • License

Overview

MoFA (Modular Framework for Agents) is not just another entry in the crowded agent framework landscape. It is the first production-grade framework to achieve "write once, run everywhere" across languages, built for extreme performance, boundless extensibility, and runtime programmability. Through its revolutionary microkernel architecture and innovative dual-layer plugin system (compile-time + runtime), MoFA strikes the elusive balance between raw performance and dynamic flexibility.

What Sets MoFA Apart:
✅ Rust Core + UniFFI: Blazing performance with native multi-language interoperability
✅ Dual-Layer Plugins: Zero-cost compile-time extensions meet hot-swappable runtime scripts
✅ Microkernel Architecture: Clean separation of concerns, effortless to extend
✅ Cloud-Native by Design: First-class support for distributed and edge deployments

Read the full README

Why MoFA?

Performance
  • Zero-cost abstractions in Rust
  • Memory safety without garbage collection
  • Orders of magnitude faster than Python-based frameworks
Polyglot by Design
  • Auto-generated bindings for Python, Java, Go, Kotlin, Swift via UniFFI
  • Call Rust core logic natively from any supported language
  • Near-zero overhead compared to traditional FFI
Runtime Programmability
  • Embedded Rhai scripting engine
  • Hot-reload business logic without recompilation
  • Runtime configuration and rule adjustments
  • User-defined extensions on the fly
Dual-Layer Plugin Architecture
  • Compile-time plugins: Extreme performance, native integration
  • Runtime plugins: Dynamic loading, instant effect
  • Support plugin hot loading and version management
Distributed by Nature
  • Built on Dora-rs for distributed dataflow
  • Seamless cross-process, cross-machine agent communication
  • Edge computing ready
Actor-Model Concurrency
  • Isolated agent processes via Ractor
  • Message-passing architecture
  • Battle-tested for high-concurrency workloads

Core Architecture

Microkernel + Dual-Layer Plugin System

MoFA adopts a layered microkernel architecture, achieving extreme extensibility through a dual-layer plugin system:

block-beta
    columns 1
    block:business["🧩 Business Layer"]
        A["User-defined Agents, Workflows, Rules"]
    end
    space
    block:runtime["⚡ Runtime Plugin Layer (Rhai Scripts)"]
        B["Dynamic tool registration"]
        C["Rule engine & Scripts"]
        D["Hot-load logic"]
    end
    space
    block:compile["🔧 Compile-time Plugin Layer (Rust/WASM)"]
        E["LLM plugins"]
        F["Tool plugins"]
        G["Storage & Protocol"]
    end
    space
    block:kernel["🏗️ Microkernel (mofa-kernel)"]
        H["Lifecycle management"]
        I["Metadata & Communication"]
        J["Task scheduling"]
    end

    business --> runtime
    runtime --> compile
    compile --> kernel
Advantages of Dual-Layer Plugin System

Compile-time Plugins (Rust/WASM)

  • Extreme performance, zero runtime overhead
  • Type safety, compile-time error checking
  • Support complex system calls and native integration
  • WASM sandbox provides secure isolation

Runtime Plugins (Rhai Scripts)

  • No recompilation needed, instant effect
  • Business logic hot updates
  • User-defined extensions
  • Secure sandbox execution with configurable resource limits

Combined Power

  • Use Rust plugins for performance-critical paths (e.g., LLM inference, data processing)
  • Use Rhai scripts for business logic (e.g., rule engines, workflow orchestration)
  • Seamless interoperability between both, covering 99% of extension scenarios

Core Features

1. Microkernel Architecture

MoFA adopts a layered microkernel architecture with mofa-kernel at its core. All other features (including plugin system, LLM capabilities, multi-agent collaboration, etc.) are built as modular components on top of the microkernel.

Core Design Principles
  • Core Simplicity: The microkernel contains only the most basic functions: agent lifecycle management, metadata system, and dynamic management
  • High Extensibility: All advanced features are extended through modular components and plugins, keeping the kernel stable
  • Loose Coupling: Components communicate through standardized interfaces, easy to replace and upgrade
Integration with Plugin System
  • The plugin system is developed based on the Plugin interface of the microkernel. All plugins (including LLM plugins, tool plugins, etc.) are integrated through the AgentPlugin standard interface
  • The microkernel provides plugin registration center and lifecycle management, supporting plugin hot loading and version control
  • LLM capabilities are implemented through LLMPlugin, encapsulating LLM providers as plugins compliant with microkernel specifications
Integration with LLM
  • LLM exists as a plugin component of the microkernel, providing standard LLM access capabilities through the LLMCapability interface
  • All agent collaboration patterns (chain, parallel, debate, etc.) are built on the microkernel's workflow engine and interact with LLMs through standardized LLM plugin interfaces
  • Secretary mode is also implemented based on the microkernel's A2A communication protocol and task scheduling system
2. Dual-Layer Plugins
  • Compile-time plugins: Extreme performance, native integration
  • Runtime plugins: Dynamic loading, instant effect
  • Seamless collaboration between both, covering all scenarios
3. Agent Coordination
  • Priority Scheduling: Task scheduling system based on priority levels
  • Communication Bus: Built-in inter-agent communication bus
  • Workflow Engine: Visual workflow builder and executor
4. LLM and AI Capabilities
  • LLM Abstraction Layer: Standardized LLM integration interface
  • OpenAI Support: Built-in OpenAI API integration
  • ReAct Pattern: Agent framework based on reasoning and action
  • Multi-Agent Collaboration: LLM-driven agent coordination, supporting multiple collaboration modes:
    • Request-Response: One-to-one deterministic tasks with synchronous replies
    • Publish-Subscribe: One-to-many broadcast tasks with multiple receivers
    • Consensus: Multi-round negotiation and voting for decision-making
    • Debate: Agents alternate speaking to iteratively refine results
    • Parallel: Simultaneous execution with automatic result aggregation
    • Sequential: Pipeline execution where output flows to the next agent
    • Custom: User-defined modes interpreted by the LLM
  • Secretary Mode: Provides end-to-end task closed-loop management, including 5 core phases: receive ideas → record todos, clarify requirements → convert to project documents, schedule dispatch → call execution agents, monitor feedback → push key decisions to humans, acceptance report → update todos
    Features:
    • 🧠 Autonomous task planning and decomposition
    • 🔄 Intelligent agent scheduling and orchestration
    • 👤 Human intervention at key nodes
    • 📊 Full process observability and traceability
    • 🔁 Closed-loop feedback and continuous optimization
5. Gateway & Distributed Control Plane
  • HTTP Proxy: Server-side proxy for mofa-local-llm with OpenAI-compatible API
  • Health Checking: Automatic backend health monitoring and circuit breakers
  • Load Balancing: Round-robin, least-connections, weighted, and random algorithms
  • Rate Limiting: Token bucket and sliding window strategies
  • Distributed Consensus: Raft-based consensus for cluster coordination
  • Observability: Prometheus metrics, OpenTelemetry tracing, structured logging
6. Persistence Layer
  • Multiple Backends: Support PostgreSQL, MySQL, and SQLite
  • Session Management: Persistent agent session storage
  • Memory System: Stateful agent memory management
6. Monitoring & Observability
  • Dashboard: Built-in web dashboard with real-time metrics
  • Metrics System: Prometheus-compatible metrics system
  • Tracing Framework: Distributed tracing system
7. Rhai Script Engine

MoFA integrates the Rhai embedded scripting language, providing runtime programmability without recompilation.

Script Engine Core
  • Safe Sandbox Execution: Configurable operation limits, call stack depth, loop control
  • Script Compilation Cache: Pre-compile scripts for improved repeated execution performance
  • Rich Built-in Functions: String manipulation, math functions, JSON processing, time utilities
  • Bidirectional JSON Conversion: Seamless conversion between JSON and Rhai Dynamic types
Scripted Workflow Nodes
  • Script Task Nodes: Execute business logic via scripts
  • Script Condition Nodes: Dynamic branch decisions
  • Script Transform Nodes: Data format transformation
  • YAML/JSON Workflow Loading: Define workflows through configuration files
Dynamic Tool System
  • Script-based Tool Definition: Register tools at runtime
  • Parameter Validation: Type checking, range validation, enum constraints
  • Auto JSON Schema Generation: Compatible with LLM Function Calling
  • Hot Loading: Dynamically load tools from directories
Rule Engine
  • Priority Rules: Critical > High > Normal > Low
  • Multiple Match Modes: First match, all match, ordered match
  • Composite Actions: Set variables, trigger events, goto rules
  • Rule Group Management: Support default fallback actions
Typical Application Scenarios
ScenarioDescription
Dynamic Business RulesDiscount strategies, content moderation rules, no redeployment needed
Configurable WorkflowsUser-defined data processing pipelines
LLM Tool ExtensionsRegister new tools at runtime for LLM calls
A/B TestingControl experiment logic through scripts
Expression EvaluationDynamic condition checking, formula calculation

Roadmap

Short-term Goals
  • [ ] Dora-rs runtime support for distributed dataflow
  • [ ] Complete distributed tracing implementation
  • [ ] Python binding generation
  • [ ] More LLM provider integrations
Long-term Goals
  • [ ] Visual workflow designer UI
  • [ ] Cloud-native deployment support
  • [ ] Advanced agent coordination algorithms
  • [ ] Agent platform
  • [ ] Cross-process/cross-machine distributed agent collaboration
  • [ ] Multi-agent collaboration standard protocol
  • [ ] Cross-platform mobile support
  • [ ] Evolve into agent operating system

Quick Start

Installation

Add MoFA to your Cargo.toml:

[dependencies]
mofa-sdk = "0.1.0"

See Quick Start for the full guide!

The runtime mode is most suitable for scenarios that require building complete agent workflows, specifically including:


  1. Multi-agent collaboration scenarios

The runtime provides a message bus (SimpleMessageBus/DoraChannel) and agent registration system, supporting communication between agents:

  • Point-to-point communication (send_to_agent)
  • Broadcast messages (broadcast)
  • Topic pub/sub (publish_to_topic/subscribe_topic)
  • Role management (get_agents_by_role)

When you need multiple agents to collaborate on complex tasks (such as master-slave architecture, division of labor), the runtime's communication mechanism can significantly simplify development.


  1. Event-driven agent applications

The runtime has a built-in event loop (run_with_receiver/run_event_loop) and interrupt handling system, automatically managing:

  • Event reception and dispatch
  • Agent state lifecycle
  • Timeout and interrupt handling

Suitable for building applications that need to respond to external events or timers (such as real-time dialogue systems, event response robots).


  1. Distributed agent systems

When the dora feature is enabled, the runtime provides Dora adapters (DoraAgentNode/DoraDataflow), supporting:

  • Distributed node deployment
  • Cross-node agent communication
  • Data flow management

Suitable for production scenarios requiring large-scale deployment and low-latency communication.


  1. Structured agent building

The runtime provides AgentBuilder fluent API, simplifying agent:

  • Configuration management
  • Plugin integration
  • Capability declaration
  • Port configuration

Suitable for scenarios where you need to quickly build standardized agents, especially when you need to uniformly manage multiple agent configurations.


  1. Production-grade applications

The runtime provides comprehensive:

  • Health checks and state management
  • Logging and monitoring integration
  • Error handling mechanisms

Suitable for building production applications that need stable operation, rather than simple plugin testing or prototype development.

CLI Production Smoke Example

To verify CLI production readiness from a user perspective, MoFA includes a black-box smoke example:

  • Path: examples/cli_production_smoke
  • Runner: invokes the built mofa binary in isolated XDG_* directories
  • Validation: exit codes + stable output tokens (no brittle full snapshots)

Coverage in this smoke run:

  • Top-level commands: info, config path, config list
  • Agent commands: start, status, list, restart, stop
  • Session commands: list, show, export, delete
  • Plugin commands: list, info, uninstall
  • Tool commands: list, info

Run it:

# repo root
cargo build -p mofa-cli

# examples workspace
cd examples
cargo run -p cli_production_smoke
cargo test -p cli_production_smoke

Optional binary override:

export MOFA_BIN=/absolute/path/to/mofa

Limitations:

  • This smoke flow is manually run (not CI-gated in this PR).
  • Assertions focus on behavior and persistence effects, not exact formatting.

Documentation

Security

MoFA is designed with security-first principles. Key security features include:

  • WASM Sandboxing: Strong isolation for compile-time plugins
  • Rhai Script Limits: Configurable resource limits for runtime scripts (memory, CPU, operations)
  • Type Safety: Rust's memory safety and type system prevent entire classes of vulnerabilities
  • Credential Management: Environment variable support for secure credential handling
  • Plugin Verification: Version tracking and integrity checks for plugins

For comprehensive security documentation, including:

  • Credential management best practices
  • Runtime scripting security configuration
  • Plugin security guidelines
  • Production deployment security checklist
  • Threat model and attack surface analysis

Please see our Security Guide and Security Policy.

Reporting Vulnerabilities: If you discover a security vulnerability, please report it privately through our Security Policy.

Contributing

We welcome contributions! Please check out our contributing guide for more details.

We ❤️ first-time contributors! Check out our good-first-issue labels to get started.

🌐 Ecosystem & Related Repos

RepositoryDescriptionStatus
mofa-studioGPU-accelerated desktop voice-chat & model management app (Makepad)🚧 Prototype
GSoCGoogle Summer of Code 2026 ideas & proposal guide✅ Active
mofa-inputHigh-performance local AI voice input✅ Active
mofa-local-llmLocal LLM inference with OpenAI-compatible API (integrates with mofa-gateway)✅ Active
makepad-chartGPU-accelerated chart widgets for Makepad✅ Active
makepad-flowFlow chart widget for visual workflow editing✅ Active
makepad-d3D3-style data visualization for Makepad✅ Active
doraDistributed dataflow middleware (fork of dora-rs)✅ Active

🎓 GSoC 2026

MoFA is participating in Google Summer of Code 2026 as a first-time organization! We have 6 exciting project ideas covering plugin systems, observability dashboards, edge orchestrators, time-travel debuggers, and more.

👉 Check out our GSoC Ideas List

Community

Star History

🙏 Acknowledgments

MoFA stands on the shoulders of giants:

  • Rust - Perfect combination of performance and safety
  • UniFFI - Mozilla's multi-language binding magic
  • Rhai - Powerful embedded scripting engine
  • Tokio - Async runtime cornerstone
  • Ractor - Actor model concurrency framework
  • Dora - Distributed dataflow runtime
  • Wasmtime - WebAssembly runtime

Support

源起之道支持|Supported by Upstream Labs

License

Apache License 2.0

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
Optional
  • Binds native code: ort-sys (feature kokoro), pnet_sys (feature dora)
Python bindings
No Python binding crate found
License
Apache-2.0

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

mofa beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
mofa This page Listed

MoFA - Modular Framework for Agents. Modular, Compositional and Programmable.

613 downloads over 30 days 0 296 0.1.1 GPU support unknown Binds native code: ort-sys (feature kokoro), pnet_sys (feature dora) Apache-2.0
rust-mcp-sdk Featured

An asynchronous SDK and framework for building MCP-Servers and MCP-Clients, leveraging the rust-mcp-schema for type safe MCP Schema Objects.

29,764 downloads over 30 days 51 199 2.0.0 GPU support unknown No native code found MIT
autoagents Listed

Agent Framework for Building Autonomous Agents

8,627 downloads over 30 days 4 779 0.4.0 CUDA, WebGPU, Metal, ROCm, Vulkan Binds native code: llama-cpp-sys-2, ort-sys, alsa-sys (feature audio-capture), intel-mkl-src (feature full), rquickjs-sys (feature codeact) Apache-2.0 OR MIT
adk-rust Listed

Rust Agent Development Kit - Build AI agents in Rust with modular components for models, tools, memory, and more.

5,419 downloads over 30 days 25 743 2.3.0 CUDA, Metal Binds native code: alsa-sys (feature desktop-audio), audiopus_sys (feature openai-webrtc), cxx (feature livekit), espeak-rs-sys (feature kokoro), libsqlite3-sys (feature sqlite) and 4 more Apache-2.0
chidori Listed

The agent framework where every run is durable, replayable, and resumable by default. Plain async TypeScript agents on an embedded pure-Rust JS engine.

Python bindings

257 downloads over 30 days 0 1,372 3.8.1 GPU support unknown Binds native code: aws-lc-rs, aws-lc-sys, lcms2-sys, libffi-sys, libsqlite3-sys and 4 more Apache-2.0
vestige App Listed

Think before doing, prove before saving. Vestige is the local-first cognitive operating system and deterministic safety kernel for autonomous AI agents.

41 binary downloads per release Not applicable 660 Not measured Not measured AGPL-3.0
axp App Listed

An open protocol that gives AI agents a secure, sandboxed place to run code and use tools — with lean context usage. AXP works alongside MCP

Not measured Not applicable 3 Not measured Not measured Not measured Apache-2.0
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 0 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 296 stars, 173 forks and 72 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.

What else the check found

Check notes

  • the latest release was packaged from a dirty working tree

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.1.1 base 300, capped at 2 releases = 100, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2026-07-05, 127 days ago, E = 365: active
  • rot: deprecated requirement `bincode (RUSTSEC-2025-0141, https://rustsec.org/advisories/RUSTSEC-2025-0141.html)`
  • featured: not featured: active_users 0 < 11 and new_adopters 0 < 9 and repository route stars 296 (needs 4539), forks 173 (needs 434), contributors 72 (needs 79)
  • listed: listed: no archive, new or featured rule applies
Crates8 crates

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents0crates.io database dumpYes
New dependents (365 days)0crates.io database dumpYes
Peak active dependents0crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 4 months ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-07-05GitHub repositoryYes
Latest release2026-02-21crates.io database dumpYes
First release2026-02-20crates.io database dumpYes
Latest version0.1.1crates.io database dumpYes
Days the oldest outside issue waits for a reply230GitHub repositoryYes
Maintainer replies over 365 days2GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementbincode (RUSTSEC-2025-0141, https://rustsec.org/advisories/RUSTSEC-2025-0141.html)crates.io database dumpYes
Distribution2 releases, 613 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases2crates.io database dumpYes
Downloads over 30 days613crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository296 stars, 173 forks, 72 contributors, 2,438 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars296GitHub repositoryYes — one part of the repository route
GitHub forks173GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account72GitHub contributorsYes — one part of the repository route
Commits on the default branch2438GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0crates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesBinds native code: ort-sys (feature kokoro), pnet_sys (feature dora)crates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly0crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.