# Module 8: Capstone — Production Multi-Agent System ## Overview Build, deploy, and evaluate a complete production-grade multi-agent system. Choose from three project options, or propose your own. --- ## Project Options ### Option 1: Brand Monitor (Intermediate) Build a multi-agent system that monitors how LLMs mention a brand across multiple AI services. **Agents**: - **Scanner Agent** — queries ChatGPT, Gemini, Grok, Perplexity for brand mentions - **Analyzer Agent** — classifies mentions as positive/negative/neutral - **Reporter Agent** — generates daily summary reports **Requirements**: - Each agent has domain-locked permissions - Each agent maintains a mental model - Scanner uses cascade routing (Flash for scrape, Sonnet for analysis) - Daily automated runs via heartbeat - Cost tracking per scan ### Option 2: Code Review Pipeline (Intermediate-Advanced) A plan → build → review → verify chain with CI/CD integration. **Agents**: - **Planner** — reads spec, creates implementation plan - **Builder** — writes code per plan - **Reviewer** — reviews code for bugs, style, security - **Verifier** — read-only agent that checks all claims **Requirements**: - YAML-defined agent chain pipeline - Golden dataset for regression testing - Verifier agent with confidence ladder - GitHub PR integration - Cost analysis per review cycle ### Option 3: Strategic Decision Board (Advanced) An 8-agent CEO board with adversarial debate, fact verification, and execution planning. **Agents**: - CEO (orchestrator) - 6 board members with distinct perspectives - Verifier (fact-checker) - Tracker (quarterly review) **Requirements**: - Each board member has distinct persona + mental model - Fact verification (2+ sources per claim) - Contrarian position tracked at 3x weight - Structured memo output - Audio summary (TTS) - Cost tracking per deliberation --- ## Capstone Phases ### Phase 1: System Design (60-90 min) Deliverable: One-page architecture document including: - System diagram (agents + data flow + tool surface) - Agent roster (names, personas, domain permissions) - Data model (what state is shared, how) - Security architecture (what L-level, what hooks) - Cost estimate per session **Template**: ```markdown # System Design: [Project Name] ## Architecture [ASCII diagram or mermaid] ## Agent Roster | Agent | Model | Tools | Domain | Memory | |-------|-------|-------|--------|--------| ## Data Flow [How agents communicate, what state they share] ## Security [L-level, hooks, verifier, damage-control rules] ## Cost Estimate [Per-session estimate with model pricing] ``` ### Phase 2: Agent Implementation (2-4 hours) Build each agent: - System prompt with persona + behavioral rules - Tool definitions with reasoning parameter - Mental model file (agent-owned expertise) - Skills for composable behavior ### Phase 3: Integration (1-2 hours) Wire agents together: - Chain (if pipeline pattern) - Team (if dispatcher pattern) - P2P (if flat pattern) - Shared context (conversation log) ### Phase 4: Security Hardening (1-2 hours) Apply security layer: - Minimum L3 (blacklist hook) - Target L4 (whitelist hook) - Optional L5 (no bash) - Damage-control rules - Verifier agent (read-only checks) ### Phase 5: Testing & Evaluation (1-2 hours) - Create golden dataset (10+ test cases) - Run pass@k evaluation (k=3, k=5) - Calculate cost per task - Identify optimization opportunities ### Phase 6: Deployment (1-2 hours) - CI/CD pipeline with golden dataset gate - Shadow deployment vs baseline - Observability: every tool call + cost logged - Monitoring dashboard ### Phase 7: Review & Iterate (1 hour) - Red-team your own system (try to break it) - Document lessons learned - Create retrospective --- ## Deliverables Checklist ``` [ ] Architecture document (one page, with diagram) [ ] All agent source code with system prompts [ ] Mental model files for each agent [ ] Security configuration (damage-control rules) [ ] Verifier agent (if applicable) [ ] Golden dataset (10+ test cases) [ ] Test results (pass@k at k=1, k=3, k=5) [ ] Cost analysis ($/task, optimization opportunities) [ ] Security audit (which L-level, what gaps remain) [ ] Retrospective (max 1 page) ``` --- ## Pass Criteria | Criterion | Minimum | Target | |-----------|---------|--------| | System runs without manual intervention | ✓ | ✓ | | All agents have domain-locked permissions | ✓ | ✓ | | Each agent has mental model file | ✓ | ✓ | | pass@k (k=3) on golden dataset | >60% | >80% | | Cost analysis within 2x of optimal | ✓ | ✓ | | Security audit identifies ≥2 improvements | ✓ | ✓ | | Observability captures all tool calls | ✓ | ✓ | | Architecture document submitted | ✓ | ✓ | --- ## Grading Rubric | Area | Weight | Poor (0) | Good (1) | Excellent (2) | |------|--------|---------|----------|---------------| | Architecture | 20% | No diagram, unclear design | Diagram present, mostly clear | Clear diagram, justified choices | | Implementation | 25% | Agents don't work | Agents work on happy path | Agents handle errors gracefully | | Security | 20% | L1 only | L3+ with damage-control | L4+ with verifier | | Testing | 15% | No eval | pass@k computed | pass@k + cost analysis + grind detection | | Documentation | 10% | Minimal | Architecture + setup | Architecture + setup + retrospective | | Cost Optimization | 10% | Single model | Cascade routing | Cascade + verified savings |