Skip to content

Architecture

GSD Bot edited this page May 24, 2026 · 1 revision

Architecture

autogen operates as a Python multi-agent orchestration runtime. An operator submits a prompt via the DevUI workbench; the MAF runtime routes it through a provider fallback chain and a specialist agent team, producing structured output with checkpointed state.

Pipeline Diagram

flowchart LR
    Op["Operator\n(DevUI / Workbench)"] -->|"prompt"| MAF["autogen\n(MAF Runtime)"]
    MAF --> Gemini["Gemini API\n(primary)"]
    MAF --> Anthropic["Anthropic API\n(fallback)"]
    MAF --> CLI["Local CLIs\n(gemini-cli / claude)"]
    MAF --> Entities["Entities\n(repo_team, copilots)"]
    MAF --> Tools["Repo Tools\n(read / write / search)"]
    MAF --> Checkpoints["Checkpoints\n(FileCheckpointStorage)"]
    Entities --> Out["Run Output\n+ Artifacts"]
    Tools --> Out
    Checkpoints --> Out
Loading

Components

Settings / config.py

maf_starter/config.pySettings dataclass loaded via load_settings(). Reads .env for MAF_*, GEMINI_*, and ANTHROPIC_* variables. Supports context-var-based run scope for per-request repo root binding, enabling concurrent agent runs with isolated filesystem access.

AgentFactory / agent_factory.py

maf_starter/agent_factory.pybuild_agent(). Creates a MAF Agent with OpenAIChatClient pointed at Gemini's OpenAI-compatible endpoint. Repo tools are injected at agent build time, scoping the agent's filesystem access to the configured repo root.

ProviderFallback / provider_fallback.py

maf_starter/provider_fallback.py — Fallback middleware wrapping the MAF agent. Intercepts quota errors and rate-limit responses, then retries the request with the next provider in the fallback chain: Gemini API → Anthropic API → gemini-cli → claude-cli → codex-cli.

RoutingPolicy / routing_policy.py

maf_starter/routing_policy.pybuild_routing_plan(). Classifies incoming prompt complexity (simple / standard / deep) and selects the appropriate primary model and fallback order. Operators can override the routing lane via MAF_ROUTE_LANE.

TeamFactory / team_factory.py

maf_starter/team_factory.pybuild_repo_team(). Constructs a sequential specialist chain: planner → researcher → implementer → reviewer. Each specialist uses FileCheckpointStorage, enabling the full team run to be paused and resumed across process restarts.

RepoTools / tools.py

maf_starter/tools.pybuild_repo_tools(). Bounded filesystem access layer. Exposes get_repo_overview, list_repo_files, read_repo_file, search_repo, and request_human_approval as MAF tool functions. All paths are validated against the configured repo root — agents cannot read or write outside the scope.

RunOrchestrationState / orchestration.py

maf_starter/orchestration.pyRunOrchestrationState. Tracks the current execution stage (planning / research / implementation / review / validation), manages specialist handoffs, and records pause and approval events.

Entity Entry Point / entities/repo_team/workflow.py

DevUI-discoverable entry point for the multi-agent repo team workflow. The DevUI scans the entities/ directory for workflow definitions and exposes them as runnable agents in the operator workbench.

Legacy Dashboard / autogen_dashboard/

A preserved AutoGen compatibility layer (autogen_dashboard/). Contains a FastAPI session API, session lifecycle management, and a legacy static UI. The primary operator surface is now the DevUI via maf_starter/; the dashboard is retained for backward compatibility.