· Updated

Multi-Agent Orchestration in Hermes: How Mixture-of-Agents Produces Better Results

Hermes Agent#multi-agent#moa#architecture#hermes#guide#orchestration

Most AI assistants follow a simple pattern: user asks, model answers. Hermes Agent uses Mixture-of-Agents (MOA) — multiple specialist agents collaborating on complex tasks, producing results no single model could achieve alone.

The MOA Pattern

In MOA, a task is decomposed into perspectives, each handled by a specialized advisor agent, and then synthesized by an aggregator:

User Goal: "Is this codebase production-ready?"

Advisor 1 (Security)     → finds 3 CVEs, 2 hardcoded secrets
Advisor 2 (Performance)  → finds 2 bottlenecks, N+1 queries
Advisor 3 (Architecture) → questions the schema, suggests CQRS
Advisor 4 (Testing)      → notes 40% coverage, missing integration tests
Advisor 5 (Dependencies) → flags 3 deprecated packages, 1 malicious

Aggregator → synthesizes a ranked, deduplicated report with priorities

Each advisor runs with a different system prompt, toolset, and sometimes a different underlying model. They operate in parallel — no one waits for another.

Why MOA Produces Better Results

Multiple specialist perspectives outperform a single generalist because:

  1. No blind spots — A security-focused agent catches things a generalist might dismiss. Each advisor focuses its limited context window on one dimension.

  2. Disagreement is signal — If two advisors disagree, the aggregator flags the discrepancy instead of averaging it away. Advisors with stronger evidence get more weight.

  3. Parallel token efficiency — Each advisor sees only the context relevant to its specialty. A security advisor doesn’t need the full test suite; a testing advisor doesn’t need dependency manifests.

  4. Model specialization — Use the best model for each job: DeepSeek-V4 for pattern matching (security), Claude Opus for reasoning (architecture), GPT-5 for synthesis (aggregator).

Prompt Caching in MOA

Recent updates restored prompt caching for the aggregator and advisors — a critical optimization. The system prompt is shared across the entire agent tree. Caching it means each advisor pays the prompt-processing cost only once, making MOA runs up to 4x faster on repeat tasks.

# Enable caching in moa config
moa:
  enabled: true
  cache:
    enabled: true
    ttl: 3600  # seconds
    key_prefix: "moa-cache"

Without caching, a 5-advisor MOA run processes ~50K tokens of system prompts per run. With caching, subsequent runs process ~10K (just the task-specific context).

When to Use MOA (And When Not To)

✅ MOA Shines On

Task Type Why MOA Helps
Code audits Separate advisors for security, performance, style, correctness, dependencies
Architecture reviews Different perspectives on the same design (scalability, maintainability, ops)
Decision analysis Pros/cons from multiple angles (cost, risk, timeline, team fit)
Quality gates Pre-PR checks combining linting, testing, security scanning, docs
Incident response Parallel investigation: logs, metrics, traces, recent deploys
Refactoring planning Impact analysis, migration strategy, risk assessment, test strategy

❌ Use Single Agent For

Task Type Reason
Simple Q&A Overhead not worth it
Straightforward coding tasks One model + tools is faster
Low-context lookups File reads, grep, simple searches
Real-time chat Latency budget too tight

Rule of thumb: If the task benefits from “a second opinion” (or third, fourth, fifth), use MOA. If it’s a straight line from question to answer, don’t.

Configuring MOA

Basic Configuration

# .hermes/moa.yaml
moa:
  enabled: true
  advisors:
    security:
      model: deepseek-v4
      temperature: 0.2
      system_prompt: |
        You are a security auditor. Find vulnerabilities, secrets, auth flaws,
        injection risks, and supply chain issues. Output SARIF format.
      tools: [grep, read, semgrep, osv-scanner]
      max_tokens: 16384
    
    performance:
      model: claude-haiku-4.5
      temperature: 0.3
      system_prompt: |
        You are a performance engineer. Find bottlenecks, N+1 queries,
        memory leaks, inefficient algorithms, and scaling limits.
      tools: [grep, read, explain-analyze, flamegraph]
      max_tokens: 16384
    
    architecture:
      model: claude-sonnet-4.5
      temperature: 0.5
      system_prompt: |
        You are a software architect. Evaluate design decisions, coupling,
        cohesion, domain modeling, and evolutionary architecture.
      tools: [read, grep, tree-sitter, dependency-graph]
      max_tokens: 32768
    
    testing:
      model: gpt-4o-mini
      temperature: 0.3
      system_prompt: |
        You are a test engineer. Assess coverage, find missing tests,
        suggest test strategies, identify flaky test patterns.
      tools: [read, grep, coverage-report, mutation-test]
      max_tokens: 16384
  
  aggregator:
    model: claude-opus-4.1
    temperature: 0.3
    system_prompt: |
      You synthesize multi-perspective analyses into a prioritized,
      actionable report. Deduplicate findings. Rank by severity + effort.
      Output: executive summary, findings table, recommended next steps.
    max_tokens: 32768

Advanced: Dynamic Advisor Selection

For tasks where you don’t know which advisors are needed upfront:

moa:
  enabled: true
  dynamic_advisors: true
  advisor_selector:
    model: gpt-4o-mini
    prompt: |
      Given this task: {{task}}
      Select 3-5 advisors from: security, performance, architecture,
      testing, dependencies, docs, accessibility, ux, data, infra.
      Return JSON: {"advisors": ["security", "performance", ...]}

The selector runs first, then spawns only the chosen advisors. This saves tokens on simple tasks.

Advanced: Weighted Aggregation

Not all advisors are equal. Weight their input:

moa:
  aggregator:
    weights:
      security: 1.5      # Security findings count more
      performance: 1.2
      architecture: 1.0
      testing: 0.8
      dependencies: 0.9

The aggregator sees weighted evidence. A security finding with weight 1.5 needs less evidence to appear in the final report than a testing finding with weight 0.8.

Real-World MOA Workflows

1. Pre-Merge Quality Gate

# .github/workflows/moa-quality-gate.yml
name: MOA Quality Gate
on: [pull_request]
jobs:
  moa-review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: hermes-agent/action@v1
        with:
          task: |
            Comprehensive review of this PR. Focus on:
            1. Security vulnerabilities introduced
            2. Performance regressions
            3. Architectural consistency
            4. Test coverage adequacy
            5. Dependency risks
          moa_enabled: true
          moa_config: .hermes/moa-pr-review.yaml
          output_format: github-pr-review

2. Nightly Codebase Health Report

# .hermes/cron-codebase-health.yaml
cron: "0 3 * * *"  # 3 AM daily
moa:
  task: |
    Analyze the entire codebase for:
    - Security debt (CVEs, secrets, outdated crypto)
    - Performance debt (slow queries, missing indexes, memory growth)
    - Architectural drift (circular deps, god classes, boundary violations)
    - Test debt (coverage gaps, flaky tests, missing integration tests)
    - Dependency debt (outdated, vulnerable, unmaintained packages)
  advisors: [security, performance, architecture, testing, dependencies]
  aggregator:
    model: claude-opus-4.1
    output_format: markdown
    deliver_to: [slack:#engineering-alerts, github:issue, email:team@company.com]

3. Incident Investigation

# During an outage
hermes moa run \
  --task "Investigate: API latency spiked to 5s at 14:32 UTC. Find root cause." \
  --advisors logs,metrics,traces,deploys,config \
  --aggregator-model claude-opus-4.1 \
  --timeout 300

Advisors run in parallel:

  • Logs advisor: Greps error patterns, correlates timestamps
  • Metrics advisor: Checks dashboards, finds correlated spikes
  • Traces advisor: Analyzes distributed traces for bottleneck spans
  • Deploys advisor: Checks recent deployments, config changes
  • Config advisor: Reviews feature flags, env vars, secrets rotation

Aggregator produces a timeline with root cause hypothesis and evidence.

4. Architecture Decision Records (ADR) Generation

hermes moa run \
  --task "We're deciding between event-driven vs. request-response for the new payments service. Produce an ADR." \
  --advisors architecture,security,performance,ops,cost \
  --output adr-payments-service.md

Produces a structured ADR with context, decision, consequences, and trade-off matrix from multiple perspectives.

MOA Performance Numbers (July 2026)

Configuration Avg Latency Token Cost Quality Score*
Single agent (Claude Opus) 8.2s $0.45 7.2/10
MOA 3 advisors (no cache) 12.1s $0.68 8.6/10
MOA 3 advisors (cached) 4.3s $0.22 8.6/10
MOA 5 advisors (cached) 6.8s $0.31 9.1/10

*Quality scored by human evaluation on 50 code audit tasks (security + perf + arch)

Key insight: With caching, MOA is faster and cheaper than single Opus while producing better results.

Debugging MOA Runs

When MOA output seems off:

# See each advisor's raw output
hermes moa run --task "..." --debug --save-advisor-outputs ./moa-debug/

# Check routing decisions
hermes moa explain --task "..." --show-selection

# Inspect aggregator prompt
hermes moa inspect --show-aggregator-prompt

Common issues:

  • Advisors repeating each other → Make system prompts more distinct, add “focus exclusively on X” instructions
  • Aggregator missing findings → Lower aggregator temperature, add “include all findings even if minor” to prompt
  • High latency → Enable caching, reduce max_tokens, use faster models for advisors

Extending MOA: Custom Advisors

You can write custom advisors as skills:

<!-- SKILL.md -->
---
name: "custom-advisor"
version: "1.0.0"
description: "Custom MOA advisor for domain-specific analysis"
moa_advisor: true
---

# Custom Advisor: Compliance

## System Prompt
You are a compliance auditor for FINRA/SOX/GDPR. Check for:
- Audit trail completeness
- Data retention compliance
- Access control documentation
- Encryption at rest/in transit
- PII handling

## Tools
- read
- grep
- compliance-checklist (custom script)

## Output Format
JSON: {"findings": [...], "compliance_score": 0-100}

Register it:

hermes skill install ./custom-compliance-advisor
hermes moa add-advisor compliance --skill custom-compliance-advisor

Now compliance is available as an advisor in any MOA run.

MOA vs. Other Multi-Agent Approaches

Approach Coordination Use Case
Hermes MOA Parallel advisors + aggregator Analysis, review, decision support
AutoGen Conversational agents Code generation, collaborative writing
LangGraph State machine workflows Complex multi-step pipelines
CrewAI Role-based crews Business process automation
OpenAI Swarm Handoff-based Customer support, routing

MOA is purpose-built for parallel perspective gathering + synthesis. It’s not a general agent framework — it’s a specific pattern for “get multiple expert opinions, then decide.”

The Future: MOA v2 (Preview)

Coming in Hermes 0.22 (Q4 2026):

  • Hierarchical MOA — Advisors can spawn sub-advisors for deep dives
  • Streaming aggregation — See partial results as advisors complete
  • Advisor memory — Advisors remember previous runs on same codebase
  • Cross-run learning — Aggregator learns which advisors are reliable for which tasks
  • Visual MOA builder — Drag-and-drop in desktop app


The smartest developers don’t pick one AI — they use them all. aiFiesta brings 9+ premium models into one chat for $12/mo. Your AI toolkit, simplified.

FREE RESOURCE

Get the AI Agent Cheat Sheet

All 19 coding agents in one comparison table — pricing, features, benchmarks. Updated weekly. Delivered to your inbox.

k
kira_bug_hunter
Security & Bug Hunter
Former pen tester. Finds the bugs nobody wants to exist. Skeptical of everything, especially status indicators.

Related articles