AgileFlow

Multi-Expert

PreviousNext

Multi-expert orchestrator that deploys 3-5 domain experts on the same problem and synthesizes results for high-confidence answers.

Multi-Expert Agent

The Multi-Expert Agent is an orchestrator that analyzes complex questions by deploying 3-5 specialized domain experts in parallel, then synthesizes their findings into a comprehensive, confidence-scored analysis.

Capabilities

  • Spawns multiple specialized domain experts in parallel for comprehensive analysis
  • Detects relevant domains from questions (security, API, UI, database, testing, performance, CI, DevOps)
  • Synthesizes expert findings with confidence scoring (High/Medium/Low)
  • Identifies agreements between experts (high confidence) and disagreements (needs review)
  • Extracts unique insights from individual experts
  • Provides prioritized recommended actions

When to Use

Use this agent when:

  • Complex questions spanning multiple domains - "Is our authentication implementation secure?" needs security + API + testing + database perspectives
  • Security reviews - Analyze code from multiple angles (security, architecture, testing)
  • Architecture reviews - Get feedback from domain experts on design decisions
  • PR reviews - Multi-perspective code review for confidence in correctness
  • End-to-end flow analysis - Trace requests through multiple layers with expert validation
  • Debugging hard problems - Multiple possible causes that need expert analysis
  • "Best practice" questions - Need validation across multiple domains

How It Works

The agent follows a structured workflow:

USER QUESTION

┌─────────────────┐
│ 1. ANALYZE      │ → Identify 3-5 relevant domains
│ 2. DEPLOY       │ → Spawn experts IN PARALLEL
│ 3. COLLECT      │ → Wait for all results
│ 4. SYNTHESIZE   │ → Combine with confidence scoring
│ 5. REPORT       │ → High-confidence answer
└─────────────────┘

Step 1: Domain Analysis

The agent analyzes the question for domain keywords and selects 3-5 experts:

  • 1 PRIMARY expert - Most relevant domain
  • 2-4 SUPPORTING experts - Provide additional perspectives

Step 2: Deploy in Parallel

All experts are deployed simultaneously using background execution for efficiency:

Task(
  description: "Security analysis",
  prompt: "FIRST: Read packages/cli/src/core/experts/security/expertise.yaml\n\nQUESTION: ...",
  subagent_type: "agileflow-security",
  run_in_background: true
)

Step 3: Collect Results

Uses TaskOutput with block: true to wait for all expert responses.

Step 4: Synthesize with Confidence Scoring

Analyzes all responses and groups findings:

  • AGREEMENT (2+ experts) → High confidence
  • UNIQUE INSIGHT (1 expert) → Notable finding
  • DISAGREEMENT → Flagged for human review

Step 5: Report

Outputs structured analysis with sections:

  • Key Findings (High Confidence) - Agreements between 2+ experts
  • Unique Insights - Notable findings from single experts
  • Disagreements (Needs Review) - Conflicting opinions
  • Recommended Actions - Prioritized next steps

Confidence Scoring

LevelCriteria
High3+ experts agree with specific evidence cited
Medium2 experts agree with some evidence
Low1 expert only, needs verification

Domain Detection

The agent maps question keywords to domain experts:

KeywordsExpert
database, schema, table, SQL, queryagileflow-database
API, endpoint, REST, route, controlleragileflow-api
component, UI, frontend, styleagileflow-ui
test, spec, coverage, mockagileflow-testing
security, auth, JWT, vulnerabilityagileflow-security
performance, cache, optimize, slowagileflow-performance
CI, workflow, pipeline, buildagileflow-ci
deploy, infrastructure, Dockeragileflow-devops

Example

User Question: "Is our authentication implementation secure?"

Agent Response:

Analyzing for relevant domains...
 
Detected domains:
- Security (primary) - auth security analysis
- API (supporting) - implementation review
- Testing (supporting) - coverage verification
- Database (supporting) - credential storage
 
Deploying 4 experts in parallel...
 
## Multi-Expert Analysis: Authentication Security
 
**Confidence**: High (4 experts, strong agreement)
 
### Key Findings (High Confidence)
1. JWT tokens never expire - CRITICAL - Agreed by: Security, API
2. Auth middleware inconsistent - HIGH - Agreed by: Security, API
 
### Unique Insights
- Database: Password hashing is correct (bcrypt with proper salt rounds)
- Testing: Only 40% coverage on auth routes, missing integration tests
 
### Disagreements (Needs Review)
None - all experts aligned on security stance
 
### Recommended Actions
1. Add JWT expiration and refresh token rotation (CRITICAL)
2. Audit all routes for consistent middleware application (HIGH)
3. Increase test coverage to 80% for auth routes (MEDIUM)
4. Add integration tests for auth flow (MEDIUM)

Key Behaviors

  • ALWAYS deploys experts in parallel - Never sequentially (efficiency)
  • ALWAYS deploys ALL experts in a SINGLE message - Batch Task calls together
  • NEVER gives final answer without synthesizing ALL expert responses - All perspectives matter
  • ALWAYS includes expertise reading in expert prompts - "FIRST: Read packages/cli/src/core/experts/{domain}/expertise.yaml"
  • Deploys 3-5 experts total - Not fewer, not more (optimal synthesis)
  • ALWAYS uses TaskOutput with block: true - To collect all results

Tools Available

This agent has access to:

  • Read - Access agent expertise files
  • Write - Create analysis documents
  • Edit - Update existing analyses
  • Bash - Run verification commands
  • Glob - Search for relevant files
  • Grep - Search code and documentation
  • Task - Deploy expert agents in parallel
  • TaskOutput - Collect expert results

Model Configuration

  • Model: Claude Opus 4.5 (Sonnet)
  • Reasoning: Full complex analysis with multiple perspectives
  • database - Database schema and query expert
  • api - REST API endpoint expert
  • ui - Frontend component expert
  • testing - Test coverage and strategy expert
  • security - Security and authentication expert
  • performance - Performance optimization expert
  • ci - CI/CD pipeline expert
  • devops - Infrastructure and deployment expert

When NOT to Use

  • Simple single-domain questions - Use direct domain expert instead
  • Questions requiring decision-making authority - Multi-Expert provides analysis only
  • Sensitive information - Document experts involved before deploying