Configuration - micgo/maf-standalone GitHub Wiki
Configuration Guide
This guide covers all configuration options for the Multi-Agent Framework.
Table of Contents
- Configuration Files
- Project Configuration
- Agent Configuration
- Model Providers
- Event Bus Configuration
- Advanced Options
- Environment Variables
- Best Practices
Configuration Files
File Locations
your-project/
├── .maf-config.json # Main configuration
├── .env # API keys and secrets
└── .maf/ # Runtime directory (auto-generated)
├── state.json # Framework state tracking
└── message_queues/ # Agent message queues
Configuration Hierarchy
- Command-line arguments (highest priority)
- Environment variables
.maf-config.json
file- Default values (lowest priority)
Project Configuration
Basic Structure
{
"project_name": "My Awesome App",
"project_type": "nextjs",
"description": "A Next.js application with AI agents",
"version": "1.0.0",
"framework_config": {
"state_file": ".maf/state.json",
"message_queue_dir": ".maf/message_queues",
"log_dir": ".maf_logs",
"temp_dir": ".maf_temp"
}
}
Project Types
Type | Description | Auto-Detection |
---|---|---|
nextjs |
Next.js applications | next.config.js , app/ or pages/ |
react |
React applications | package.json with react |
django |
Django projects | manage.py , settings.py |
fastapi |
FastAPI applications | FastAPI imports |
express |
Express.js apps | Express imports |
auto |
Auto-detect type | Default |
Technology Stack
{
"technology_stack": {
"frontend": ["react", "typescript", "tailwind"],
"backend": ["fastapi", "postgresql"],
"testing": ["pytest", "jest"],
"deployment": ["docker", "kubernetes"]
}
}
Agent Configuration
Enabling/Disabling Agents
{
"agent_config": {
"enabled_agents": [
"orchestrator", // Always required
"frontend_agent",
"backend_agent",
"db_agent",
"qa_agent",
"devops_agent", // NEW: DevOps & Infrastructure
"security_agent", // NEW: Security Auditing
"docs_agent", // NEW: Documentation
"ux_ui_agent" // NEW: Design Systems
// Omit agents you don't need
]
}
}
Agent-Specific Settings
{
"agent_config": {
"agent_settings": {
"frontend_agent": {
"framework_preference": "react",
"styling": "tailwind",
"typescript": true
},
"backend_agent": {
"framework": "fastapi",
"database": "postgresql",
"auth_method": "jwt"
},
"qa_agent": {
"test_framework": "pytest",
"coverage_threshold": 80,
"strict_mode": true
}
}
}
}
Task Assignment Rules
{
"agent_config": {
"task_routing": {
"ui_tasks": ["frontend_agent", "ux_agent"],
"api_tasks": ["backend_agent"],
"data_tasks": ["db_agent", "backend_agent"],
"test_tasks": ["qa_agent"],
"deploy_tasks": ["devops_agent"]
}
}
}
Model Providers
Provider Configuration
{
"agent_config": {
"default_model_provider": "gemini",
"default_model_name": "gemini-2.0-flash-exp",
"providers": {
"gemini": {
"api_key_env": "GEMINI_API_KEY",
"base_url": "https://generativelanguage.googleapis.com/v1beta"
},
"anthropic": {
"api_key_env": "ANTHROPIC_API_KEY",
"base_url": "https://api.anthropic.com"
},
"openai": {
"api_key_env": "OPENAI_API_KEY",
"base_url": "https://api.openai.com/v1"
}
}
}
}
Per-Agent Models
{
"agent_config": {
"agent_models": {
"orchestrator": {
"provider": "anthropic",
"name": "claude-3-sonnet-20240229",
"temperature": 0.3,
"max_tokens": 4096
},
"frontend_agent": {
"provider": "openai",
"name": "gpt-4-turbo-preview",
"temperature": 0.7,
"max_tokens": 8192
},
"qa_agent": {
"provider": "gemini",
"name": "gemini-2.0-flash-exp",
"temperature": 0.1,
"max_tokens": 4096
}
}
}
}
Model Parameters
{
"model_parameters": {
"temperature": 0.7, // Creativity (0.0-1.0)
"max_tokens": 4096, // Max response length
"top_p": 0.9, // Nucleus sampling
"frequency_penalty": 0.0, // Reduce repetition
"presence_penalty": 0.0, // Encourage new topics
"stop_sequences": [] // Stop generation triggers
}
}
Event Bus Configuration
In-Memory Event Bus (Default)
{
"event_bus": {
"type": "in_memory",
"config": {
"max_queue_size": 1000,
"event_ttl": 3600,
"cleanup_interval": 300
}
}
}
Kafka Event Bus (Scalable)
{
"event_bus": {
"type": "kafka",
"config": {
"bootstrap_servers": "localhost:9092",
"topic_prefix": "maf_",
"consumer_group": "maf_agents",
"auto_offset_reset": "earliest",
"enable_auto_commit": true
}
}
}
Event Filtering
{
"event_bus": {
"filters": {
"log_events": ["task_created", "task_completed", "task_failed"],
"persist_events": ["task_completed", "code_generated"],
"priority_events": ["task_failed", "security_alert"]
}
}
}
Advanced Options
Performance Tuning
{
"performance": {
"parallel_agents": 5, // Max concurrent agents
"task_timeout": 300, // Task timeout in seconds
"retry_attempts": 3, // Failed task retries
"retry_delay": 60, // Retry delay in seconds
"batch_size": 10, // Task batch size
"cache_enabled": true, // Enable response caching
"cache_ttl": 3600 // Cache TTL in seconds
}
}
Resource Limits
{
"resource_limits": {
"max_memory_mb": 2048, // Per-agent memory limit
"max_cpu_percent": 50, // Per-agent CPU limit
"max_file_size_mb": 100, // Max generated file size
"max_files_per_task": 20, // Max files per task
"rate_limit_per_minute": 60 // API rate limiting
}
}
Security Options
{
"security": {
"enable_code_scanning": true, // Scan generated code
"allowed_imports": [ // Whitelist imports
"react", "next", "express"
],
"blocked_operations": [ // Dangerous operations
"eval", "exec", "__import__"
],
"sanitize_inputs": true, // Input sanitization
"audit_logging": true // Security audit logs
}
}
Integration Options
{
"integrations": {
"git": {
"auto_commit": false, // Auto-commit changes
"branch_prefix": "maf/", // Branch naming
"commit_message_template": "feat: {task_description}"
},
"ci_cd": {
"provider": "github_actions", // CI/CD provider
"auto_pr": false, // Auto-create PRs
"run_tests": true // Run tests before PR
},
"monitoring": {
"provider": "datadog", // Monitoring service
"metrics_enabled": true, // Send metrics
"traces_enabled": true // Send traces
}
}
}
Environment Variables
Required Variables
# At least one LLM provider key
GEMINI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here
Optional Variables
# Framework configuration
MAF_PROJECT_DIR=/path/to/project
MAF_CONFIG_FILE=custom-config.json
MAF_LOG_LEVEL=DEBUG
MAF_TIMEOUT=600
# Model configuration
MAF_DEFAULT_PROVIDER=gemini
MAF_DEFAULT_MODEL=gemini-2.0-flash-exp
MAF_TEMPERATURE=0.7
# Performance
MAF_PARALLEL_AGENTS=10
MAF_CACHE_ENABLED=true
MAF_RETRY_ATTEMPTS=5
# Security
MAF_ENABLE_SCANNING=true
MAF_AUDIT_LOGGING=true
Provider-Specific Variables
# Gemini
GOOGLE_API_KEY=your_key_here
GEMINI_PROJECT_ID=your_project_id
# Anthropic
ANTHROPIC_API_KEY=your_key_here
ANTHROPIC_API_VERSION=2023-06-01
# OpenAI
OPENAI_API_KEY=your_key_here
OPENAI_ORG_ID=your_org_id
Best Practices
1. API Key Security
# Never commit .env files
echo ".env" >> .gitignore
# Use separate keys for different environments
GEMINI_API_KEY_DEV=dev_key_here
GEMINI_API_KEY_PROD=prod_key_here
2. Model Selection
{
"agent_models": {
// Use stronger models for planning
"orchestrator": {
"provider": "anthropic",
"name": "claude-3-opus-20240229"
},
// Use faster models for simple tasks
"doc_agent": {
"provider": "gemini",
"name": "gemini-2.0-flash-exp"
}
}
}
3. Performance Optimization
{
"performance": {
// Adjust based on your system
"parallel_agents": 3, // Lower for limited resources
"cache_enabled": true, // Reduce API calls
"batch_size": 5 // Balance speed vs resources
}
}
4. Project-Specific Config
{
// Next.js specific
"agent_settings": {
"frontend_agent": {
"use_app_router": true,
"server_components": true,
"typescript_strict": true
}
}
}
5. Environment-Based Config
// config.js
const config = {
development: {
"log_level": "DEBUG",
"retry_attempts": 1
},
production: {
"log_level": "INFO",
"retry_attempts": 3
}
};
export default config[process.env.NODE_ENV || 'development'];
Configuration Examples
Minimal Configuration
{
"project_name": "My App",
"project_type": "auto"
}
Full-Stack Application
{
"project_name": "E-Commerce Platform",
"project_type": "nextjs",
"technology_stack": {
"frontend": ["nextjs", "typescript", "tailwind"],
"backend": ["fastapi", "postgresql", "redis"],
"testing": ["jest", "pytest", "playwright"]
},
"agent_config": {
"enabled_agents": [
"orchestrator",
"frontend_agent",
"backend_agent",
"db_agent",
"qa_agent",
"security_agent"
],
"agent_models": {
"orchestrator": {
"provider": "anthropic",
"name": "claude-3-sonnet-20240229"
},
"frontend_agent": {
"provider": "gemini",
"name": "gemini-2.0-flash-exp"
}
}
},
"performance": {
"parallel_agents": 5,
"cache_enabled": true
}
}
API-Only Project
{
"project_name": "REST API Service",
"project_type": "fastapi",
"agent_config": {
"enabled_agents": [
"orchestrator",
"backend_agent",
"db_agent",
"qa_agent",
"doc_agent"
],
"agent_settings": {
"backend_agent": {
"api_style": "rest",
"auth": "oauth2",
"database": "postgresql"
}
}
}
}
Validation
Check Configuration
# Validate current config
maf config validate
# Test with specific config
maf config validate --config test-config.json
Common Validation Errors
- Missing required fields
- Invalid project type
- Unsupported model providers
- Conflicting settings
- Invalid JSON syntax
Next Steps
- Read CLI Reference for command usage
- Check Troubleshooting for config issues
- See Architecture for system design
- Explore Agent Reference for agent details