Multi-Agent Topologies & Communication

Lesson Content

After this lesson you'll know

  • When to use multi-agent vs single-agent (the decision framework)
  • Four multi-agent topologies (supervisor, pipeline, debate, swarm)
  • Inter-agent communication patterns
  • How the CCA exam evaluates multi-agent design decisions

When to Use Multiple Agents

The exam's most common trap: candidates choose multi-agent when single-agent is sufficient. Multi-agent adds complexity. You need to justify that complexity.

Decision Framework

USE SINGLE AGENT when:
  βœ“ Task is sequential (step 1 β†’ step 2 β†’ step 3)
  βœ“ One domain of expertise needed
  βœ“ Shared context is critical (all steps need same information)
  βœ“ Simple error recovery (retry the failed step)

USE MULTI-AGENT when:
  βœ“ Tasks are parallelizable (independent work items)
  βœ“ Different domains of expertise needed (legal + technical + creative)
  βœ“ Adversarial review required (one agent checks another's work)
  βœ“ Scale demands it (100 items to process simultaneously)
  βœ“ Isolation required (one agent's failure shouldn't crash others)
Exam rule of thumb: If you can solve it with one agent and a good tool set, do that. Multi-agent is for when single-agent genuinely can't handle the workload, expertise breadth, or safety requirements.

Four Multi-Agent Topologies

1. Supervisor Pattern

         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚SUPERVISORβ”‚ ← orchestrates, delegates, reviews
         β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
        β”Œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”
        β–Ό     β–Ό     β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”β”Œβ”€β”€β”€β”€β”€β”€β”β”Œβ”€β”€β”€β”€β”€β”€β”
    β”‚Workerβ”‚β”‚Workerβ”‚β”‚Workerβ”‚ ← specialized agents
    β”‚  A   β”‚β”‚  B   β”‚β”‚  C   β”‚
    β””β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”˜

USE WHEN: Clear hierarchy. Workers have different specializations.
          Supervisor maintains global context and quality.

EXAM EXAMPLE: Code review system
  - Supervisor: assigns files to reviewers, aggregates feedback
  - Worker A: security review
  - Worker B: performance review
  - Worker C: style/consistency review

2. Pipeline Pattern

β”Œβ”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”
β”‚Agent │───▢│Agent │───▢│Agent │───▢│Agent β”‚
β”‚  1   β”‚    β”‚  2   β”‚    β”‚  3   β”‚    β”‚  4   β”‚
β””β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”˜
Research β†’ Draft β†’ Review β†’ Publish

USE WHEN: Sequential processing where each stage transforms output.
          Each agent adds value to the previous agent's output.

EXAM EXAMPLE: Content pipeline
  - Agent 1: Research topic (web search, data gathering)
  - Agent 2: Write draft (content generation)
  - Agent 3: Review and edit (quality check)
  - Agent 4: Format and publish (deployment)

3. Debate Pattern

β”Œβ”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”
β”‚Agent │◀───────▢│Agent β”‚
β”‚  A   β”‚ debate  β”‚  B   β”‚
β””β”€β”€β”¬β”€β”€β”€β”˜         β””β”€β”€β”¬β”€β”€β”€β”˜
   β”‚                 β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚  JUDGE   β”‚ ← picks best argument
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

USE WHEN: High-stakes decisions where you want adversarial thinking.
          Reduces bias by forcing opposing viewpoints.

EXAM EXAMPLE: Investment analysis
  - Agent A: argues FOR the investment (bull case)
  - Agent B: argues AGAINST (bear case)
  - Judge: weighs both arguments, makes decision

4. Swarm Pattern

β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”
β”‚Agent β”‚ β”‚Agent β”‚ β”‚Agent β”‚ β”‚Agent β”‚
β”‚  1   β”‚ β”‚  2   β”‚ β”‚  3   β”‚ β”‚  N   β”‚
β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”˜
   β”‚        β”‚        β”‚        β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚ SHARED  β”‚ ← shared state/message bus
           β”‚  STATE  β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

USE WHEN: Many identical tasks, homogeneous agents, scale-out.
          Each agent works independently on its portion.

EXAM EXAMPLE: Processing 1000 support tickets
  - N identical agents each handle a subset
  - Shared state tracks which tickets are claimed
  - No coordination needed beyond "claim" mechanism

Inter-Agent Communication

How agents talk to each other matters. The exam tests three communication patterns:

Direct Message Passing

# Agent A sends result directly to Agent B
result_a = await agent_a.run(task)
result_b = await agent_b.run(result_a.output)  # pipeline

Pros: Simple, clear data flow. Cons: Tight coupling.

Shared Memory (Blackboard)

# Agents read/write to shared state
brain.write("research_findings", agent_research.output)
# Later...
findings = brain.read("research_findings")
draft = await agent_writer.run(findings)

Pros: Loose coupling, agents don't know about each other. Cons: Coordination complexity.

Event Bus

# Agents publish/subscribe to events
@on_event("research_complete")
async def handle_research(event):
    await agent_writer.run(event.data)

Pros: Fully decoupled, scalable. Cons: Harder to debug, eventual consistency.

Our production choice: Shared memory via brain (SQLite). All agents read/write brain keys. Loose coupling. Any agent can pick up where another left off. This is the pattern the CCA exam favors for persistent multi-agent systems.

Exam Scenario Practice

Scenario

You're building a system to process incoming legal documents. The system must: (1) classify the document type, (2) extract key entities, (3) check for compliance issues, (4) generate a summary. Documents arrive at ~100/hour. Processing each takes 30 seconds. Which multi-agent topology is most appropriate?

A) Single agent processing sequentially
B) Supervisor with 4 specialized workers
C) Pipeline: classify β†’ extract β†’ compliance β†’ summarize
D) Swarm of identical agents with shared queue

Answer: C (Pipeline).

Why: The steps are sequential (each depends on the previous), each step is a different specialization, and the throughput requirement (100/hr at 30s each = 1-2 concurrent needed) doesn't require massive parallelism. Pipeline gives clear data flow with stage-specific error handling.

Why not D: Swarm is for identical parallel work. These steps are sequential and specialized. Why not B: Supervisor adds coordination overhead for what is fundamentally a pipeline. Why not A: At 100/hr, a single agent processing at 30s/doc is borderline β€” pipeline allows stage-level parallelism if needed.

Key Takeaways

  1. Don't over-architect. Single agent with tools beats multi-agent for most problems.
  2. Match topology to problem. Supervisor for hierarchy, pipeline for stages, debate for decisions, swarm for scale.
  3. Communication pattern matters. Shared memory (brain) for persistence. Direct passing for pipelines. Events for loose coupling.
  4. The exam tests judgment. "Why this pattern?" is more important than "what does this pattern do?"

Quick Check

1A startup needs to process 10 customer emails per day. Each email needs: read β†’ classify β†’ respond. Which architecture?