Part IV: Engineering AI Products
Chapter 19.2

A2A for Agent Interoperability

"MCP connects AI to tools. A2A connects AI to AI. The difference matters when your AI product needs to coordinate multiple agents, each with their own specialization, to solve complex problems no single agent can handle alone."

Head of AI Architecture, DataForge

Introduction

While MCP standardizes how models interact with tools, the Agent-to-Agent (A2A) protocol addresses a different problem: how multiple AI agents communicate, coordinate, and collaborate to solve complex tasks. A2A is essential for building AI products that decompose problems across specialized agents, delegate work, and synthesize results.

The Multi-Agent Coordination Problem

Complex AI tasks often require multiple specialized capabilities that no single model can optimally provide. A research agent needs to coordinate with a writing agent. A code generation agent needs to coordinate with a testing agent. A planning agent needs to coordinate with execution agents.

Without standardized protocols, multi-agent coordination requires bespoke implementations that are hard to maintain, difficult to debug, and impossible to reuse across different agent combinations.

Why A2A Matters for AI Products

AI products that seem like single agents are often systems of agents. Customer service AI includes intent classification, response generation, and knowledge retrieval agents. Code generation AI includes parsing, generation, testing, and debugging agents. A2A enables these agent systems to be built from interchangeable components rather than integrated custom code.

A2A Protocol Design

A2A defines how agents discover each other, negotiate tasks, share context, and report results. The protocol is designed around several key principles.

Agent Discovery

Agents in an A2A system can discover each other through a registry. When a new agent joins the system, it registers its capabilities. Other agents can query the registry to find agents that can help with specific tasks.

+------------------------------------------------------------------+ | A2A AGENT DISCOVERY | +------------------------------------------------------------------+ | | | +----------------+ | | | Agent | | | | Registry |<---------------------------------------------+ | | +-------+--------+ | | | | | | | | 1. Register (capabilities) | | | | 2. Query (find agent) | | | | | | | v | | | +----------------+ +----------------+ +----------------+ | | | Research | | Writing | | Code | | | | Agent | | Agent | | Generation | | | | | | | | Agent | | | | - Web search | | - Edits | | - Generation | | | | - Fact check | | - Formatting | | - Testing | | | +----------------+ +----------------+ +----------------+ | | | | Use case: User asks "Research topic X and write a report" | | Research Agent -> finds Writing Agent via registry -> delegates | | | +------------------------------------------------------------------+

Task Negotiation

When one agent needs to delegate work to another, A2A defines a negotiation protocol. The delegating agent proposes a task with constraints. The receiving agent can accept, reject, or negotiate modifications based on its capabilities and current load.

Context Sharing

Agents need to share context efficiently. A2A defines standardized context formats that agents use to share partial results, intermediate findings, and task state. This standardization enables agents to pick up work where other agents left off.

Result Reporting

When an agent completes its portion of a task, it reports results in a standardized format that other agents can consume. Results include not just the output but also confidence scores, limitations, and suggestions for follow-up work.

A2A in Practice: DataForge Multi-Agent Pipeline

DataForge Code Generation Pipeline

Architecture: DataForge uses A2A to coordinate a pipeline of specialized agents for enterprise data pipeline generation.

+------------------------------------------------------------------+ | DATAFORGE A2A PIPELINE | +------------------------------------------------------------------+ | | | User: "Create pipeline joining orders to customers, output to S3" | | | | +----------------+ | | | Orchestrator | : Receives request, decomposes into tasks | | | Agent | | | +-------+--------+ | | | | | | A2A: Delegate schema_analysis | | v | | +----------------+ A2A: Delegate code_generation | | | Schema | ----------------------------------------+ | | | Agent | | | | +-------+--------+ | | | | v | | | A2A: Share schema context | | | +---------------------------------------------------+ | | | | +----------------+ A2A: Delegate | | | Code | ------------------+ | | | Generation | | | | Agent | | | +-------+--------+ | | | | | | A2A: Share generated code | | v | | +----------------+ A2A: Delegate | | | Testing | -------------------+ | | | Agent | | | +-------+--------+ | | | | | | A2A: Report test results | | v | | +----------------+ | | | Orchestrator | : Synthesize final | | | Agent | pipeline output | | +-------+--------+ | | | +------------------------------------------------------------------+

Each agent in the pipeline uses A2A to communicate with others. The orchestrator does not hard-code agent implementations. It discovers agents via A2A registry and delegates tasks based on their advertised capabilities.

Benefits for AI Product Teams

Composable Architecture

A2A enables a composable agent architecture where agents can be added, removed, or replaced without changing the rest of the system. Adding a new specialized agent requires only registering it with the A2A registry.

Scalable Processing

When one agent type becomes a bottleneck, A2A enables horizontal scaling of that specific agent. Multiple instances of a code generation agent can register with the same capabilities, and the orchestrator distributes work across them.

Debugging and Observability

Standardized agent communication enables better debugging. A2A messages can be logged, replayed, and analyzed to understand how agents collaborated on a task and where failures occurred.

A2A vs MCP: Complementary Protocols

A2A and MCP address different coordination problems and work together in production AI systems.

Purpose differs between the two protocols. A2A focuses on agent-to-agent coordination while MCP focuses on model-to-tool integration. The communication pattern also differs significantly: A2A uses negotiation, delegation, and context sharing between agents, whereas MCP uses tool discovery, invocation, and result return for connecting models to external services. In terms of typical usage, A2A powers multi-agent pipelines and orchestrators while MCP connects models to external services.

State management represents a key architectural difference. A2A maintains shared task state and intermediate results across agent interactions, while MCP uses stateless tool calls where each invocation is independent. A concrete example of A2A would be a research agent delegating to a writing agent, while an example of MCP would be a model querying a database or API.

Using Both Protocols Together

A sophisticated AI product uses both A2A and MCP. A2A coordinates the overall agent system. MCP connects individual agents to their required tools. A code generation agent uses MCP to access version control. The orchestration system uses A2A to coordinate multiple code generation agents for parallel processing.

Challenges and Considerations

Protocol Overhead

A2A adds overhead to agent communication. For simple single-agent tasks, the overhead is unjustified. Reserve A2A for complex multi-agent workflows where the coordination benefits outweigh the protocol cost.

Trust and Security

When agents delegate work to each other, security boundaries become complex. An agent that receives delegated tasks should have appropriate permission scoping. A2A implementations need careful security design to prevent privilege escalation.

Failure Modes

Multi-agent systems have more failure modes than single-agent systems. An agent might fail mid-task, return untrustworthy results, or become unresponsive. A2A systems need robust timeout handling, retry logic, and graceful degradation.

Start with Simpler Architectures

Adopting A2A before you need multi-agent coordination adds unnecessary complexity. Start with single agents or simple agent pipelines. Introduce A2A when you have a demonstrated need for dynamic agent coordination that cannot be achieved through simpler orchestration patterns.

Cross-References

For orchestration patterns that A2A enables, see Chapter 13 Prompts and Agents. For tool schemas that MCP uses, see Section 19.1 MCP as a Standard.

Section Summary

A2A (Agent-to-Agent) protocol enables multi-agent coordination in AI products. It defines how agents discover each other, negotiate tasks, share context, and report results. A2A enables composable, scalable agent architectures where agents can be added or replaced without system-wide changes. A2A and MCP are complementary: A2A handles agent coordination while MCP connects agents to tools. A2A introduces complexity and overhead, so use it when multi-agent coordination needs are demonstrated rather than theoretical.