Pattern [15]

Inter-Agent Communication (A2A)

Message Queues (RabbitMQ/Kafka) / API Contracts (REST/gRPC)

> Agentic Definition

Protocols and formats for autonomous agents to exchange messages, tasks, and state information to collaborate on a shared goal.

> Description

Protocols and formats for autonomous agents to exchange messages, tasks, and state information to collaborate on a shared goal.

≈ How It Maps to Message Queues / API Contracts

Decoupled components exchanging information to coordinate work.

≠ Key Divergence

Agents talk in natural language or structured JSON schemas representing "Intent" and "Content." The communication is often a negotiation ("Can you help with X?" "No, I am busy, ask Agent Y") rather than a command.

> Key Takeaway

Adapt: Define communication protocols and personas, not just data schemas. You are defining how digital employees talk to each other.

The Code

Before: Structured API Payload

Structured API Payload
1// Structured API Payload
2// POST /order
3// { "id": 123, "action": "ship" }

After: Agent Protocol

Agent Protocol
1# Agent Protocol Message
2{
3 "sender": "SalesAgent",
4 "recipient": "FulfillmentAgent",
5 "content": "Client X wants the premium package. Can you verify stock?",
6 "intent": "QUERY",
7 "context_id": "session_789"
8}

Production Notes

  • Protocols like A2A (Agent-to-Agent) or Google's Agent protocols are emerging to standardize this handshake to prevent "Tower of Babel" scenarios.

Unlock code examples & production notes

Free account — no credit card required.

Sign Up Free

Already have an account? Log in

Frequently Asked Questions

When should I use the Inter-Agent Communication (A2A) pattern?

Protocols and formats for autonomous agents to exchange messages, tasks, and state information to collaborate on a shared goal.

How does Inter-Agent Communication (A2A) relate to Message Queues (RabbitMQ/Kafka) / API Contracts (REST/gRPC)?

Decoupled components exchanging information to coordinate work. However, there is a key divergence: Agents talk in natural language or structured JSON schemas representing "Intent" and "Content." The communication is often a negotiation ("Can you help with X?" "No, I am busy, ask Agent Y") rather than a command.

What are the production trade-offs of Inter-Agent Communication (A2A)?

Protocols like A2A (Agent-to-Agent) or Google's Agent protocols are emerging to standardize this handshake to prevent "Tower of Babel" scenarios.