MoFA uses feature flags to control which functionality is included in your build.
Feature Default Description
default✓ Basic agent functionality
openai✓ OpenAI provider support
anthropicAnthropic provider support
uniffiCross-language bindings
pythonNative Python bindings (PyO3)
Feature Description
persistenceEnable persistence layer
persistence-postgresPostgreSQL backend
persistence-mysqlMySQL backend
persistence-sqliteSQLite backend
Feature Description
doraDora-rs distributed runtime
rhaiRhai scripting engine
wasmWASM plugin support
[dependencies]
# Default features
mofa-sdk = "0.1"
# Specific features only
mofa-sdk = { version = "0.1", default-features = false, features = ["openai"] }
# Multiple features
mofa-sdk = { version = "0.1", features = ["openai", "anthropic", "persistence-postgres"] }
# All features
mofa-sdk = { version = "0.1", features = ["full"] }
# Minimal setup (no LLM)
mofa-sdk = { version = "0.1", default-features = false }
# With OpenAI and SQLite persistence
mofa-sdk = { version = "0.1", features = ["openai", "persistence-sqlite"] }
# Production setup with PostgreSQL
mofa-sdk = { version = "0.1", features = [
"openai",
"anthropic",
"persistence-postgres",
"rhai",
] }
No optional features - always minimal core.
Feature Description
openaiOpenAI LLM provider
anthropicAnthropic LLM provider
persistencePersistence abstractions
Feature Description
doraDora-rs integration
monitoringBuilt-in monitoring
Feature Description
uniffiGenerate bindings via UniFFI
pythonNative Python bindings via PyO3
Configuration Binary Size Compile Time
Minimal (no LLM) ~5 MB Fast
Default ~10 MB Medium
Full features ~20 MB Slow
#![allow(unused)]
fn main() {
#[cfg(feature = "openai")]
pub fn openai_from_env() -> Result<OpenAIProvider, LLMError> {
// OpenAI implementation
}
#[cfg(feature = "persistence-postgres")]
pub async fn connect_postgres(url: &str) -> Result<PostgresStore, Error> {
// PostgreSQL implementation
}
#[cfg(not(feature = "openai"))]
compile_error!("OpenAI feature must be enabled to use openai_from_env");
}