mofa-org/mofa
Enterprise-grade LLM infrastructure: agent runtime → token metering & audit → credits → billing → recharge. Rust microkernel with dual-layer plugins — modular, compositional, programmable agents.
What it solves
MoFA solves the problem of delivering AI agent capabilities as a product. Enterprises that want to offer agents to their own users typically have to stitch together separate pieces: an agent framework, token metering, billing, and payment systems. MoFA provides the entire chain in one piece of infrastructure: agent runtime, token metering and audit, credits, billing, and recharge. It also addresses two common pain points: performance (Python-based frameworks are often slow) and extensibility (most frameworks are either fast but rigid, or flexible but slow). MoFA's microkernel and dual-layer plugin system aim to get both.
How it works
MoFA is built around a microkernel (called mofa-kernel) that handles only the most basic functions: agent lifecycle management, metadata, and communication. Everything else is added as modular plugins. There are two types of plugins: compile-time plugins (written in Rust or WASM) that give extreme performance and native integration, and runtime plugins (Rhai scripts) that can be hot-loaded and changed without recompiling. This dual-layer approach lets developers use Rust for performance-critical paths and Rhai scripts for business logic like rules and workflows.
The core is written in Rust, and bindings for other languages (Python, Java, Go, Kotlin, Swift) are auto-generated via UniFFI, so you can call the same logic natively from many languages. MoFA also includes a runtime that supports multi-agent collaboration patterns (request-response, publish-subscribe, consensus, debate, parallel, sequential, and custom). It has a built-in gateway with load balancing, health checks, rate limiting, and observability (Prometheus and OpenTelemetry).
For enterprise use, MoFA already tracks every LLM call, storing token usage per user and per tenant in PostgreSQL, MySQL, or SQLite. It has a model pricing registry and a cost summary dashboard. Future plans include durable ledgers, credit systems, plan billing, and recharge channels.
Who it's for
- Enterprises building AI agent products for their own end users, especially those who need usage metering and billing built in.
- Developers who want a high-performance agent framework with support for multiple programming languages.
- Teams that need to change business logic at runtime without redeploying, using Rhai scripts.
- Cloud‑native and distributed deployments that need horizontal scaling and fault tolerance.
Highlights
- Complete enterprise chain: agent runtime → token metering → credits → billing → recharge, all in one system.
- Microkernel architecture: core stays simple and stable; all features are pluggable.
- Dual-layer plugins: Rust/WASM for speed, Rhai scripts for instant, no-recompile changes.
- Polyglot by design: Rust core with auto-generated bindings for Python, Java, Go, Kotlin, and Swift.
- Actor-model concurrency: isolated agent processes and message passing for high‑concurrency workloads.
- Multi-agent collaboration modes: request-response, publish-subscribe, consensus, debate, parallel, sequential, and custom LLM-driven modes.
- Built-in gateway: health checks, load balancing, rate limiting, and distributed consensus (Raft).
- Observability: Prometheus metrics, OpenTelemetry tracing, and a web dashboard.
- Runtime scripting: embed Rhai for dynamic rules, workflows, and tool registration without recompilation.
Related
- Project
- Project
- Project
- Project