|
| 1 | +# Architecture |
| 2 | + |
| 3 | +## Worker fan-out + telemetry boundary + critic gate |
| 4 | + |
| 5 | +```mermaid |
| 6 | +flowchart TD |
| 7 | + subgraph Manager["Manager-led workflow (entities/repo_team/workflow.py)"] |
| 8 | + Plan[Planner<br/>gemini-2.5-pro] --> Research[Researcher<br/>gemini-2.5-flash] |
| 9 | + Research --> Impl[Implementer<br/>gemini-2.5-pro] |
| 10 | + Impl --> Review[Reviewer<br/>gemini-2.5-pro] |
| 11 | + end |
| 12 | + subgraph Boundary["Worker boundary (maf_starter/worker_boundary.py)"] |
| 13 | + WB[WorkerBoundary<br/>async dispatch, run_id, status polling] |
| 14 | + end |
| 15 | + subgraph Telemetry["Telemetry (in progress, PR #12)"] |
| 16 | + T[emit_failure_telemetry<br/>structured JSON on stderr] |
| 17 | + end |
| 18 | + subgraph Critic["Peer critic gate (in progress, PR #14)"] |
| 19 | + C[Deterministic pattern-scan<br/>engine] |
| 20 | + end |
| 21 | + subgraph Fallback["Provider fallback (maf_starter/provider_fallback.py)"] |
| 22 | + F[Gemini -> Anthropic -> local CLI] |
| 23 | + end |
| 24 | + Manager --> Boundary |
| 25 | + Impl --> Fallback |
| 26 | + Fallback -.->|on failure| Telemetry |
| 27 | + Review --> Critic |
| 28 | + Critic -.->|gates| Manager |
| 29 | +``` |
| 30 | + |
| 31 | +<!-- codex:generate-image prompt="A factory floor with a manager robot dispatching four numbered worker robots (Planner, Researcher, Implementer, Reviewer) through a glass boundary wall; failed work items trigger a small telemetry beacon; a fifth robot with a magnifying glass (the critic) inspects finished work at a gate before it passes through; isometric, enterprise blue/graphite palette" style="isometric, enterprise, clean" replaces="mermaid-above" --> |
| 32 | + |
| 33 | +## Worker fan-out (landed on `main`) |
| 34 | + |
| 35 | +`entities/repo_team/workflow.py` wires the canonical `planning -> research -> implementation -> |
| 36 | +review -> validation` sequence via `agent_framework_orchestrations.SequentialBuilder`. Each |
| 37 | +specialist is built in `maf_starter/team_factory.py` with a distinct model tier. Long-running |
| 38 | +executions are dispatched through `WorkerBoundary` (`maf_starter/worker_boundary.py`), which |
| 39 | +returns a `run_id` immediately and exposes `pending` / `running` / `done` / `error:<msg>` |
| 40 | +status polling instead of blocking HTTP ingress on the full execution path. |
| 41 | + |
| 42 | +This matches the direction Microsoft is now pushing more explicitly in Agent Framework 1.0: |
| 43 | +workflow-native orchestration with richer graphical operator surfaces instead of a single opaque |
| 44 | +chat loop. Today this repo uses a sequential builder plus a custom dashboard. The intended next |
| 45 | +step is to keep the current specialist topology but surface it through first-party MAF UI |
| 46 | +primitives such as DevUI or AG-UI endpoints when the repo is ready. |
| 47 | + |
| 48 | +## Telemetry boundary — in progress (PR #12) |
| 49 | + |
| 50 | +`main` today does not have a `maf_starter/telemetry.py` module. PR #12 |
| 51 | +(`feat(28-02): structured JSON failure telemetry + CLI fallback size guards`) adds |
| 52 | +`emit_failure_telemetry(event, **fields)` — a stdlib-only, never-raising function that writes |
| 53 | +one flushed JSON line to stderr — wired into `provider_fallback.py`'s fallback middleware at |
| 54 | +`provider_failed`, `fallback_step_failed`, `fallback_succeeded`, and `fallback_exhausted` |
| 55 | +points, plus a 1MB CLI output/prompt size guard. Until merged, provider-fallback failures are |
| 56 | +still caught (existing `except Exception` boundaries in `provider_fallback.py` and |
| 57 | +`worker_boundary.py`) but not emitted as structured telemetry. |
| 58 | + |
| 59 | +## Critic gate — in progress (PR #14) |
| 60 | + |
| 61 | +No critic module exists on `main` yet. PR #14 |
| 62 | +(`feat(29-01): deterministic peer critic pattern-scan engine`) introduces a deterministic |
| 63 | +pattern-scan reviewer intended to sit after the Reviewer specialist as an additional gate. |
| 64 | +Until merged, review is limited to the LLM-based Reviewer agent's own assessment. |
| 65 | + |
| 66 | +## Provider routing and fallback (landed on `main`) |
| 67 | + |
| 68 | +`maf_starter/routing_policy.py` selects a model tier by task depth; `maf_starter/ |
| 69 | +provider_fallback.py` retries across the Gemini API, optional Anthropic API, and local CLI |
| 70 | +providers (`gemini.cmd`, `claude`, `codex.cmd`) on heuristic quota/rate-limit errors, recording |
| 71 | +route-attempt history. |
| 72 | + |
| 73 | +## Approvals and bounded repo tools (landed on `main`) |
| 74 | + |
| 75 | +`maf_starter/tools.py` enforces repo-root path boundaries and blocks writes to sensitive |
| 76 | +targets (e.g. `.env`). `maf_starter/approval_policy.py` classifies file operations and |
| 77 | +validation commands so destructive or externally visible actions pause for operator approval |
| 78 | +via the dashboard's approval surface. |
| 79 | + |
| 80 | +<!-- docs-verified: 91d12d3 2026-07-08 --> |
0 commit comments