Orchestrator Module - Technical Specification
Version: v1.3.0 | Status: Active | Last Updated: May 2026
Version: v1.1.9 | Last Updated: March 2026
Overview
The Orchestrator module provides script discovery, DAG-based workflow execution, parallel/async runners, retry policies, and CI/CD integration. It supports both lightweight orchestration (thin API) and full workflow management with dependency resolution and cycle detection.
Design Principles
- Zero-Mock Policy: Tests use real function execution and actual script discovery.
- Explicit Failure:
CycleError,StepError,OrchestratorTimeoutErrorfor all failure modes. - DAG-First Execution: Workflows validate dependency graphs before execution via topological sort.
Architecture
orchestrator/
__init__.py # 60+ exports
core.py # Entry point, argument parsing
config.py # Configuration loading
discovery.py # Script discovery
exceptions.py # Exception hierarchy
thin.py # Lightweight API (run, pipe, batch, step)
integration.py # External system bridges
mcp_tools.py # 2 MCP tools
execution/
runner.py # run_script, run_function
parallel_runner.py # ParallelRunner, BatchRunner
async_runner.py # AsyncParallelRunner
async_scheduler.py # AsyncScheduler, SchedulerMetrics
resilience/
retry_policy.py # with_retry decorator
workflows/
workflow.py # Workflow, Task, chain, parallel, fan_out_fan_in
observability/
reporting.py # Report generation
engines/ # Engine implementations
monitors/ # Execution monitors
pipelines/ # Pipeline definitions
scheduler/ # Scheduler implementations
state/ # State management
templates/ # Workflow templates
triggers/ # Event triggers
Functional Requirements
- Discover Python scripts in configurable directory trees.
- Execute scripts with configurable timeouts and progress reporting.
- Build and execute DAG-based workflows with topological ordering.
- Detect cyclic dependencies and raise
CycleError. - Run tasks in parallel via
ParallelRunnerorBatchRunnerwith worker pools. - Schedule async jobs with
AsyncSchedulerand track metrics. - Apply retry policies with configurable max retries, delay, and backoff.
- Integrate with CI/CD systems via
CICDBridgeandcreate_pipeline_workflow. - Provide lightweight orchestration via thin API (run, pipe, batch).
- Expose scheduler metrics and DAG validation as MCP tools.
Interface Contracts
class Workflow:
def __init__(self, name: str): ...
def add_task(self, task: Task) -> None: ...
def add_dependency(self, task_id: str, depends_on: str) -> None: ...
def execute(self) -> dict[str, TaskResult]: ...
class Task:
id: str
func: Callable
retry_policy: RetryPolicy | None
timeout: float | None
class AsyncScheduler:
metrics: SchedulerMetrics
async def schedule(self, job: AsyncJob) -> str: ...
class ParallelRunner:
def __init__(self, max_workers: int = 4): ...
def run(self, targets: list) -> list[ExecutionResult]: ...
def with_retry(max_retries: int = 3, delay: float = 1.0) -> Callable: ...
Dependencies
Internal: codomyrmex.logging_monitoring, codomyrmex.utils.cli_helpers, codomyrmex.model_context_protocol.decorators, codomyrmex.validation.schemas (optional)
External: concurrent.futures (stdlib), asyncio (stdlib), argparse (stdlib)
Constraints
- Workflow execution is single-process by default;
ParallelRunneruses threads. AsyncSchedulerrequires an event loop; metrics are per-instance.- Script discovery filters by
.pyextension and excludes__pycache__.
Navigation
- extended_readme.md -- Module overview
- AGENTS.md -- Agent coordination
- Source Module
Related Documents
- Readme: README.md