In multi-agent systems, the way agents share information is as important as the agents themselves. Poor communication patterns lead to lost context, infinite loops, and token explosions.
| Pattern | How It Works | Pros | Cons | Best For |
|---|---|---|---|---|
| Direct Messaging | Agent A sends a message directly to Agent B | Simple, low latency | Tight coupling, hard to scale | 2-3 agent systems |
| Shared Blackboard | All agents read/write to a shared state | Decoupled, easy to add agents | Race conditions, coordination needed | Collaborative research |
| Message Bus | Agents pub/sub to named channels | Scalable, async | Complex setup, ordering issues | Enterprise orchestration |
| Hierarchical | Manager agent delegates to worker agents | Clear authority, structured | Manager as bottleneck | Task decomposition |
| Debate/Adversarial | Agents argue opposing positions, a judge decides | High-quality decisions | 3x token cost | Critical decisions, safety |
// Shared Blackboard Architecture
const blackboard = {
goal: "Write a technical blog post about RAG",
research: null, // ResearcherAgent writes here
outline: null, // PlannerAgent writes here
draft: null, // WriterAgent writes here
feedback: null, // ReviewerAgent writes here
status: "researching"
};
// Each agent reads the blackboard, does its job, writes back:
while (blackboard.status !== "complete") {
const activeAgent = selectAgent(blackboard.status);
await activeAgent.process(blackboard);
}
Every time agents communicate, you're burning tokens. A naive 4-agent system that passes full context between agents can use 10-50x more tokens than a single agent. Mitigation strategies: