HIVE

Swarm Management

Agent Coordination

Communication Patterns

Effective communication is what transforms a collection of individual agents into a coordinated team. This guide explores the communication patterns available in HIVE Protocol, teaching you how agents exchange information, coordinate work, and collaborate to achieve exceptional results.

Understanding these patterns allows you to design swarms that communicate efficiently, avoid confusion, and leverage each agent's strengths at the right moment.

How Agent Communication Works

When agents communicate in a swarm, every message flows through a central router that maintains conversation state, routes messages appropriately, and ensures all agents have access to shared context.

┌─────────────────────────────────────────────────────────────────────┐
│                    COMMUNICATION ARCHITECTURE                        │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│                        ┌─────────────────┐                          │
│                        │  MESSAGE ROUTER │                          │
│                        │  ─────────────  │                          │
│                        │  • Routing      │                          │
│                        │  • History      │                          │
│                        │  • Context      │                          │
│                        └────────┬────────┘                          │
│                                 │                                   │
│         ┌───────────────────────┼───────────────────────┐          │
│         │                       │                       │          │
│         ▼                       ▼                       ▼          │
│  ┌─────────────┐         ┌─────────────┐         ┌─────────────┐  │
│  │   Agent A   │ ◄─────► │   Agent B   │ ◄─────► │   Agent C   │  │
│  │  (Writer)   │         │  (Editor)   │         │ (Reviewer)  │  │
│  └─────────────┘         └─────────────┘         └─────────────┘  │
│         │                       │                       │          │
│         └───────────────────────┼───────────────────────┘          │
│                                 │                                   │
│                        ┌────────▼────────┐                          │
│                        │   USER / YOU    │                          │
│                        └─────────────────┘                          │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

Key Principles:

  1. All messages are visible - Every agent can see all messages in the conversation
  2. Context is shared - Agents draw from the same context blocks and history
  3. Addressing is explicit - Using @mentions directs attention but doesn't restrict visibility
  4. Order matters - Message sequence affects how agents interpret the conversation

Core Communication Patterns

Pattern 1: Broadcast

The simplest pattern—a message goes to all agents, and any can respond.

┌─────────────────────────────────────────────────────────────┐
│                      BROADCAST PATTERN                       │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  User: "What are the key considerations for our launch?"    │
│                         │                                   │
│           ┌─────────────┼─────────────┐                    │
│           ▼             ▼             ▼                    │
│     ┌──────────┐  ┌──────────┐  ┌──────────┐              │
│     │ Marketing│  │ Technical│  │  Legal   │              │
│     └──────────┘  └──────────┘  └──────────┘              │
│           │             │             │                    │
│           ▼             ▼             ▼                    │
│     "Brand          "Scalability    "Compliance           │
│      awareness"      concerns"       requirements"        │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Example Conversation:

User: "We're launching a new mobile app. What should we consider?"

Marketing Agent: "From a marketing perspective, we should focus on:
• App store optimization (ASO) for discoverability
• Launch promotion strategy across social channels
• User acquisition costs and early user incentives"

Technical Agent: "Technical considerations include:
• Performance benchmarks for different devices
• API rate limiting for launch traffic
• Crash reporting and monitoring setup"

Legal Agent: "Legal requirements to address:
• Privacy policy compliance (GDPR, CCPA)
• Terms of service for app stores
• Age restriction declarations if applicable"

When to Use:

  • Gathering diverse perspectives
  • Brainstorming sessions
  • Getting comprehensive coverage of a topic
  • When you want multiple agents to weigh in

Pattern 2: Direct Addressing

Use @mentions to direct a message to a specific agent.

┌─────────────────────────────────────────────────────────────┐
│                   DIRECT ADDRESS PATTERN                     │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  User: "@Security-Expert Is this code vulnerable?"          │
│                         │                                   │
│           ┌─────────────┼─────────────┐                    │
│           │             ▼             │                    │
│     ┌──────────┐  ┌──────────┐  ┌──────────┐              │
│     │Developer │  │ Security │  │ Reviewer │              │
│     │ (waiting)│  │ (active) │  │ (waiting)│              │
│     └──────────┘  └──────────┘  └──────────┘              │
│                         │                                   │
│                         ▼                                   │
│                  "Here's my analysis..."                    │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Syntax:

@AgentName [your message]

Examples:
@Writer Please draft an introduction for this article
@Code-Reviewer Check this function for edge cases
@Data-Analyst Run the Q4 numbers through your analysis

Example Conversation:

User: "@Code-Reviewer Please review this authentication function:"

[Code snippet provided]

Code Reviewer: "I've analyzed the authentication function.

**Security Issues Found:**
1. **High**: Password comparison vulnerable to timing attacks
   - Use constant-time comparison instead
2. **Medium**: No rate limiting on login attempts
3. **Low**: Consider adding 2FA support

**Recommendations:**
[Detailed code suggestions follow]"

When to Use:

  • You need specific expertise
  • Following up on a specific agent's previous work
  • Assigning clear responsibility
  • Reducing noise from other agents

Pattern 3: Sequential Handoff

Agents pass work from one to another in a defined sequence.

┌─────────────────────────────────────────────────────────────┐
│                   SEQUENTIAL HANDOFF                         │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────┐      ┌──────────┐      ┌──────────┐         │
│  │Researcher│ ───► │  Writer  │ ───► │  Editor  │         │
│  └──────────┘      └──────────┘      └──────────┘         │
│       │                 │                 │                │
│       ▼                 ▼                 ▼                │
│  "Research         "Draft based      "Polished             │
│   complete.         on findings.      final version.       │
│   Key facts:        @Editor ready     Ready for            │
│   ..."              for review."      publication."        │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Example Conversation:

User: "Create a blog post about AI trends in healthcare"

Researcher: "I've gathered the key trends:

**Research Summary:**
1. AI-powered diagnostics (30% accuracy improvement)
2. Drug discovery acceleration (40% faster trials)
3. Personalized treatment plans
4. Administrative automation

**Sources compiled** with relevant statistics.

@Writer, I've completed the research. Ready for drafting."

Writer: "Based on the research, here's the draft:

**Title: 5 Ways AI is Revolutionizing Healthcare in 2024**

[Full draft content...]

@Editor, draft complete. Please review for clarity and flow."

Editor: "I've reviewed and polished the draft:

**Changes made:**
• Strengthened the opening hook
• Simplified technical jargon
• Added transition sentences
• Fixed minor grammatical issues

**Final version attached.** Ready for publication."

When to Use:

  • Content creation workflows
  • Quality assurance processes
  • Multi-stage analysis
  • When each step builds on previous work

Pattern 4: Collaborative Discussion

Agents engage in back-and-forth dialogue to explore ideas.

┌─────────────────────────────────────────────────────────────┐
│                  COLLABORATIVE DISCUSSION                    │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│     Agent A ◄────────────────────────────► Agent B          │
│        │                                      │             │
│        │      "What about approach X?"        │             │
│        │      ◄─────────────────────────      │             │
│        │                                      │             │
│        │      "X is good, but consider Y"     │             │
│        │      ─────────────────────────►      │             │
│        │                                      │             │
│        │      "Combining X+Y could work"      │             │
│        │      ◄─────────────────────────      │             │
│        │                                      │             │
│        └──────────────┬───────────────────────┘             │
│                       ▼                                     │
│               [Synthesized Output]                          │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Example Conversation:

User: "Debate the pros and cons of microservices vs monolith"

Architect A (Pro-Microservices): "Microservices offer significant advantages:
• Independent scaling of components
• Technology flexibility per service
• Fault isolation
• Smaller, more manageable codebases

For a growing team, this architecture enables parallel development."

Architect B (Pro-Monolith): "I'd push back on some points:
• Microservices add operational complexity
• Network latency between services
• Data consistency challenges
• Requires mature DevOps practices

For many teams, a well-structured monolith is more practical."

Architect A: "Fair points. The complexity is real. However:
• Managed Kubernetes reduces operational burden
• Most latency can be optimized
• Event sourcing handles consistency

The key is team readiness."

Architect B: "Agreed on team readiness being critical. Perhaps the answer is:
• Start monolithic with clear module boundaries
• Extract services as specific scaling needs emerge
• This gives microservices benefits without upfront complexity"

Moderator: "**Synthesis:** Both architectures have merit. The recommendation is:
1. Start with a modular monolith
2. Define clear service boundaries early
3. Extract to microservices when specific needs arise
4. Ensure DevOps maturity before distributed architecture"

When to Use:

  • Complex decisions needing multiple perspectives
  • Strategic planning
  • Avoiding groupthink
  • When tradeoffs need exploration

Pattern 5: Hub and Spoke (Coordinator Pattern)

A central coordinator directs specialist agents.

┌─────────────────────────────────────────────────────────────┐
│                      HUB AND SPOKE                           │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│                    ┌──────────────┐                         │
│         ┌─────────│  Coordinator │─────────┐               │
│         │         └──────┬───────┘         │               │
│         │                │                 │               │
│         ▼                ▼                 ▼               │
│  ┌────────────┐   ┌────────────┐   ┌────────────┐         │
│  │ Specialist │   │ Specialist │   │ Specialist │         │
│  │     A      │   │     B      │   │     C      │         │
│  └────────────┘   └────────────┘   └────────────┘         │
│         │                │                 │               │
│         └────────────────┼─────────────────┘               │
│                          ▼                                  │
│                   [Integrated Output]                       │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Example Conversation:

User: "Create a complete product launch plan"

Coordinator: "I'll coordinate this launch plan. Breaking down:

@Marketing-Lead: Develop go-to-market strategy and channel plan
@Technical-Lead: Ensure infrastructure readiness checklist
@Content-Lead: Create launch content calendar

Each lead, please report back with your component."

Marketing Lead: "**Go-to-Market Strategy:**
• Target segments: Enterprise (primary), SMB (secondary)
• Channels: LinkedIn ads, industry conferences, direct outreach
• Launch messaging: 'Transform your workflow in days, not months'
• Budget allocation: [breakdown]"

Technical Lead: "**Infrastructure Readiness:**
• Load testing: Passed for 10x expected traffic
• Monitoring: Dashboards configured
• Support escalation: Tier 1-3 defined
• Rollback plan: Documented and tested"

Content Lead: "**Content Calendar:**
• Week -2: Teaser posts, influencer outreach
• Week -1: Product preview, early access signups
• Launch day: Blog post, press release, social blitz
• Week +1: Customer testimonials, how-to guides"

Coordinator: "**Integrated Launch Plan:**

I've synthesized the components into a unified timeline:
[Combined plan with dependencies and milestones]

**Key risks identified:**
1. Marketing-Technical dependency on load capacity
2. Content timing for influencer coordination

**Recommendation:** Proceed with launch date of March 15, with March 8 as go/no-go checkpoint."

When to Use:

  • Complex multi-part projects
  • When clear orchestration is needed
  • Integrating diverse specialist outputs
  • Managing dependencies between workstreams

Agent Selection Mechanism

Automatic Selection

When you don't use @mentions, the system automatically selects the most appropriate agent:

Selection Criteria (in order):

1. MESSAGE CONTENT ANALYSIS
   ├── Keywords match agent expertise
   ├── Technical terms → Technical agents
   ├── Creative requests → Creative agents
   └── Data/analysis → Analytical agents

2. CONVERSATION CONTEXT
   ├── Which agents have been active
   ├── Logical next responder based on workflow
   └── Who was mentioned or implied

3. AGENT AVAILABILITY
   ├── Response time considerations
   └── Workload balancing

4. RELEVANCE SCORING
   └── Agent most likely to provide value

Example:

User: "Can you review this Python function for performance issues?"

[System automatically selects Code Reviewer agent based on:]
  • Keywords: "review", "Python", "performance"
  • Agent expertise: Code review, performance optimization
  • Recent context: None (new request)

Code Reviewer: "I'll analyze this for performance..."

Manual Selection

Override automatic selection with explicit addressing:

Syntax: @AgentName or @agent-name

Examples:
  @Writer                    - Address by name
  @senior-developer          - Address by slug
  @Technical-Lead           - Address by role

Pro Tips:

  1. Use @all for broadcast: When you want all agents to respond
  2. Combine addresses: "@Writer and @Editor please collaborate on this"
  3. Sequential direction: "@Researcher first, then @Analyst"

Managing Complex Conversations

Handling Disagreements

When agents present conflicting viewpoints:

┌─────────────────────────────────────────────────────────────┐
│                  CONFLICT RESOLUTION FLOW                    │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  Step 1: Each agent presents position with reasoning        │
│                          │                                  │
│                          ▼                                  │
│  Step 2: Agents acknowledge opposing points                 │
│                          │                                  │
│                          ▼                                  │
│  Step 3: Seek synthesis or compromise                       │
│                          │                                  │
│                          ▼                                  │
│  Step 4: If unresolved, escalate to human decision         │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Example:

Developer: "I recommend React for this project—mature ecosystem."

Architect: "I'd suggest Vue.js—better developer experience for our team."

Developer: "Good point on DX. However, our team has more React experience."

Architect: "True. Given existing expertise, React makes more sense
despite Vue's learning curve advantages. I support React."

[Resolution reached through discussion]

Keeping Conversations on Track

When discussions drift or become unfocused:

User: "Let's refocus. The original question was about launch timing.
@Coordinator, please summarize where we are and what we still need to decide."

Coordinator: "**Refocusing on Launch Timing**

Discussion so far:
• Marketing prefers March for trade show alignment
• Technical needs 2 more weeks for load testing
• Content can be ready by either date

**Open decision:** March 15 vs April 1

@Marketing and @Technical, can you each give your final recommendation
with key tradeoffs?"

Status Updates and Handoffs

Best practices for clear communication:

Effective Status Update:

Developer: "[STATUS UPDATE]

**Completed:**
✓ User authentication module
✓ Database schema migration
✓ API endpoints (12/12)

**In Progress:**
→ Unit tests (60% complete)
→ Integration tests (starting)

**Blocked:**
⚠ Waiting for API keys from @Integrations

**Next Steps:**
@QA-Lead - Test plan review needed by EOD
@Frontend-Dev - APIs ready for integration

ETA for completion: 2 days"

System Prompt Instructions for Communication

Configure agents to communicate effectively through their system prompts:

## Communication Guidelines

### When Responding
- Always address the specific question asked
- Reference other agents' contributions when building on their work
- Use @mentions when directing questions or handoffs

### Handoff Protocol
When completing your portion of work:
1. Summarize what you've accomplished
2. List any open questions or dependencies
3. Explicitly tag the next agent: "@AgentName, ready for your review"
4. Provide context they'll need

### Disagreement Protocol
If you disagree with another agent:
1. Acknowledge their valid points first
2. Present your alternative with reasoning
3. Suggest how to resolve (compromise, user decision, etc.)
4. Stay collaborative, not adversarial

### Status Updates
For longer tasks, provide periodic updates:
- What you've completed
- What you're working on
- Any blockers or questions
- Estimated completion

Best Practices Summary

Do's

  • Be explicit about who should respond when needed
  • Build on other agents' contributions
  • Summarize before handoffs
  • Stay focused on the objective
  • Acknowledge good points from others

Don'ts

  • Don't ignore other agents' inputs
  • Don't repeat what others have said
  • Don't create circular discussions
  • Don't contradict without reasoning
  • Don't hoard information

Next Steps

Now that you understand communication patterns:

  • [Context Blocks](/docs/swarms/context-blocks): Share persistent knowledge
  • [Human-in-the-Loop](/docs/swarms/human-in-loop): Control your involvement level
  • [Creating Agents](/docs/agents/creating-agents): Design agents that communicate well

Cookie Preferences

We use cookies to enhance your experience, analyze site traffic, and for marketing purposes. By clicking "Accept All", you consent to our use of cookies. Read our Privacy Policy for more information.