Configuration API
Complete API reference for the MARSYS configuration system, including execution, status, communication, and error handling configurations.
See Also
For practical configuration examples, see the Configuration Guide.
ExecutionConfig
Main configuration for orchestration execution.
Import
from marsys.coordination.config import ExecutionConfig, StatusConfig, ErrorHandlingConfig
Constructor
ExecutionConfig(# Timeoutsconvergence_timeout: float = 300.0,branch_timeout: float = 600.0,agent_acquisition_timeout: float = 240.0,step_timeout: float = 600.0,tool_execution_timeout: float = 120.0,user_interaction_timeout: float = 300.0,# Convergence behaviordynamic_convergence_enabled: bool = True,parent_completes_on_spawn: bool = True,auto_detect_convergence: bool = True,# Steeringsteering_mode: Literal["auto", "always", "error"] = "error",# User interactionuser_first: bool = False,initial_user_msg: Optional[str] = None,user_interaction: str = "terminal",# Agent lifecycle managementauto_cleanup_agents: bool = True,cleanup_scope: Literal["topology_nodes", "used_agents"] = "topology_nodes",# Sub-configurationsstatus: StatusConfig = field(default_factory=StatusConfig),error_handling: Optional[ErrorHandlingConfig] = None)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| convergence_timeout | float | 300.0 | Max wait at convergence points (seconds) |
| branch_timeout | float | 600.0 | Overall branch execution timeout |
| step_timeout | float | 600.0 | Individual step timeout |
| steering_mode | str | "error" | Retry guidance mode (auto, always, error) |
| auto_cleanup_agents | bool | True | Automatically cleanup agents after run |
| cleanup_scope | str | "topology_nodes" | Which agents to cleanup |
Example
# Production configurationconfig = ExecutionConfig(convergence_timeout=600.0,step_timeout=300.0,steering_mode="auto",status=StatusConfig.from_verbosity(1))# Development configurationdev_config = ExecutionConfig(step_timeout=30.0,steering_mode="always",status=StatusConfig.from_verbosity(2))# Interactive configurationinteractive_config = ExecutionConfig(user_first=True,initial_user_msg="Hello! How can I help?",user_interaction_timeout=300.0)
StatusConfig
Configuration for monitoring and output display.
Import
from marsys.coordination.config import StatusConfig, VerbosityLevel
Constructor
StatusConfig(enabled: bool = False,verbosity: Optional[VerbosityLevel] = None,cli_output: bool = True,cli_colors: bool = True,show_thoughts: bool = True,show_tool_calls: bool = True,show_timings: bool = True,aggregation_window_ms: int = 500,aggregate_parallel: bool = True,show_agent_prefixes: bool = True,prefix_width: int = 20,prefix_alignment: str = "left")
VerbosityLevel Enum
class VerbosityLevel(IntEnum):QUIET = 0 # Minimal outputNORMAL = 1 # Standard outputVERBOSE = 2 # Detailed output
Factory Method
# Create from verbosity level (recommended)status = StatusConfig.from_verbosity(1)# Custom configurationcustom_status = StatusConfig(enabled=True,verbosity=VerbosityLevel.NORMAL,show_thoughts=True,show_tool_calls=True,cli_colors=False # Disable colors for logs)
ErrorHandlingConfig
Advanced error handling and recovery configuration.
Import
from marsys.coordination.config import ErrorHandlingConfig
Constructor
ErrorHandlingConfig(use_error_classification: bool = True,notify_on_critical_errors: bool = True,enable_error_routing: bool = True,preserve_error_context: bool = True,auto_retry_on_rate_limits: bool = True,max_rate_limit_retries: int = 3,pool_retry_attempts: int = 2,pool_retry_delay: float = 5.0,timeout_seconds: float = 300.0,timeout_retry_enabled: bool = False,provider_settings: Dict[str, Dict[str, Any]] = field(default_factory=dict))
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| enable_error_routing | bool | True | Route errors to User node for intervention |
| auto_retry_on_rate_limits | bool | True | Automatically retry rate-limited requests |
| max_rate_limit_retries | int | 3 | Maximum retries for rate limit errors |
| pool_retry_attempts | int | 2 | Number of retries for pool exhaustion |
Example
# Aggressive retry strategyaggressive = ErrorHandlingConfig(auto_retry_on_rate_limits=True,max_rate_limit_retries=10,timeout_retry_enabled=True,pool_retry_attempts=5)# Conservative strategyconservative = ErrorHandlingConfig(auto_retry_on_rate_limits=False,max_rate_limit_retries=0,timeout_retry_enabled=False,enable_error_routing=True # Route to user)# Custom provider settingscustom = ErrorHandlingConfig(provider_settings={"openai": {"max_retries": 5, "base_retry_delay": 30},"anthropic": {"max_retries": 3, "base_retry_delay": 60}})
CommunicationConfig
Configuration for user interaction and communication channels.
Import
from marsys.coordination.config import CommunicationConfig
Constructor
CommunicationConfig(use_rich_formatting: bool = True,theme_name: str = "modern",prefix_width: int = 20,show_timestamps: bool = True,enable_history: bool = True,history_size: int = 1000,enable_tab_completion: bool = True,use_colors: bool = True,color_depth: str = "truecolor",input_timeout: Optional[float] = None,use_enhanced_terminal: bool = True,fallback_on_error: bool = True)
Theme Options
"modern"- Modern theme with gradients"classic"- Traditional terminal colors"minimal"- Minimal styling
Configuration Patterns
Development Configuration
def create_dev_config() -> ExecutionConfig:"""Development configuration with verbose output."""return ExecutionConfig(status=StatusConfig(enabled=True,verbosity=VerbosityLevel.VERBOSE,show_thoughts=True,show_tool_calls=True),step_timeout=30.0,steering_mode="always")
Production Configuration
def create_prod_config() -> ExecutionConfig:"""Production configuration with minimal output."""return ExecutionConfig(status=StatusConfig.from_verbosity(0),step_timeout=600.0,convergence_timeout=1200.0,steering_mode="auto",error_handling=ErrorHandlingConfig(auto_retry_on_rate_limits=True,max_rate_limit_retries=5))
Environment Variable Integration
import osfrom dotenv import load_dotenvload_dotenv()config = ExecutionConfig(step_timeout=float(os.getenv("MARSYS_TIMEOUT", "300")),status=StatusConfig(verbosity=int(os.getenv("MARSYS_VERBOSITY", "1"))))
Agent Lifecycle Management
The framework provides automatic agent cleanup to prevent resource leaks and registry collisions.
# Default behavior - auto-cleanup enabledresult = await Orchestra.run(task="Analyze data",topology=topology,execution_config=ExecutionConfig(auto_cleanup_agents=True # Default))# After run completes:# 1. Closes model resources (aiohttp sessions, etc.)# 2. Closes agent-specific resources (browsers, playwright, etc.)# 3. Unregisters agents from registry (frees names for reuse)
Pro Tip
Use StatusConfig.from_verbosity() for quick setup. It automatically configures all related settings appropriately for the chosen verbosity level.
Configuration Validation
Always validate custom configurations, especially when merging multiple sources. Invalid configurations can cause runtime failures.