Agent-to-Agent Interoperability
You've built orchestration within a single system, a router that delegates to specialists, all running in one process under one graph. That covers most code assistant use cases. But as agent-based systems grow in organizations, a new question emerges: what happens when agents built by different teams, running in different processes, or even operated by different organizations need to collaborate?
This lesson introduces the protocol landscape for agent interoperability. Our goal here isn't to build a complex cross-system architecture. We can build all sorts of interesting solutions once we master this concept. Our goal here is to understand the distinction between MCP, A2A, handoffs, and orchestration so you can make the right choice when the need arises.
What you'll learn
- Distinguish four coordination patterns: MCP (agent-to-capability), A2A (agent-to-agent), handoffs (control transfer), and orchestration (routing logic)
- Identify when cross-system agent communication solves a real problem that simpler patterns can't
- Understand what the A2A protocol provides and where it fits in the agent interoperability stack
- Apply a decision framework for choosing between internal orchestration and cross-boundary protocols
Concepts
MCP (Model Context Protocol) — a protocol for connecting an agent to external capabilities: tools, data sources, and resources exposed by a server. We've been using MCP implicitly throughout this curriculum whenever our agent calls tools. The key mental model: MCP is agent-to-capability. The agent is the actor; the MCP server provides functions the agent can call. The server doesn't have its own goals, plans, or state — it's a capability surface.
A2A (Agent-to-Agent protocol) — a protocol for connecting one agented system to another as a peer. Unlike MCP, both sides of an A2A connection are agents with their own goals, context, and decision-making. A2A defines how agents discover each other, exchange tasks, negotiate capabilities, and stream results. Where MCP says "here are the tools you can call," A2A says "here's another agent you can delegate to or collaborate with."
Handoff — a control transfer between agents inside one application or runtime. We built handoffs in the previous two lessons: the orchestrator passes control to a specialist, the specialist does its work, and control returns to the orchestrator. Handoffs happen within a single trust boundary and a shared state space. The orchestrator can see the specialist's full state and output.
Orchestration — the broader control logic that decides routing, delegation, state management, retries, and synthesis. Orchestration encompasses handoffs but is bigger: it includes the routing decision, the state that persists across steps, the retry logic when a specialist fails, and the synthesis step that combines outputs. You can have orchestration without A2A (everything runs locally) or A2A without a central orchestrator (agents collaborate as peers).
The four-way distinction
These four patterns operate at different levels:
| Pattern | What it connects | Trust boundary | State sharing | Example |
|---|---|---|---|---|
| MCP | Agent to capability server | Agent trusts the server's tools | Agent controls all state | Your agent calling search_code via an MCP server |
| Handoff | Agent to agent within one runtime | Shared trust, shared process | Full state visibility | Orchestrator passing control to the code specialist |
| Orchestration | Overall control flow | One system owns the flow | Centralized state graph | LangGraph routing to specialists and synthesizing |
| A2A | Agent to agent across boundaries | Separate trust domains | Negotiated exchange | Your code assistant delegating a security review to a separate team's security agent |
The most common confusion is between MCP and A2A. The distinguishing question: does the other side have its own goals and decision-making? If it's a tool server that exposes functions, that's MCP. If it's an autonomous agent that interprets your request, plans its own approach, and returns results on its own terms, that's A2A.
Walkthrough
When cross-system agent communication matters
Most systems don't need A2A. Internal orchestration with handoffs covers the majority of multi-agent use cases. A2A becomes valuable in three specific situations:
1. Organizational boundaries. Your team's code assistant needs to delegate a security review to the security team's agent. You can't (and shouldn't) fold their agent into your system. They maintain it, they control its policies, and they update its rules independently. A2A lets your agent send a task and receive results without coupling to their implementation.
2. Capability boundaries. Your agent needs to interact with a system that has its own autonomy, like a CI/CD agent that decides how to run tests, a deployment agent that manages its own rollback policies, or a monitoring agent that interprets alerts according to its own rules. These aren't tools you call; they're systems that make their own decisions based on your request.
3. Scale boundaries. When the number of specialists grows beyond what one orchestrator can manage, or when specialists need to discover each other dynamically rather than being hardcoded in a graph, A2A's discovery and negotiation protocols provide structure that static orchestration can't.
If none of these situations apply (all your agents run in one process, under one team's control, with shared state), internal orchestration and handoffs are simpler and more debuggable.
What A2A provides
The A2A protocol defines several key capabilities:
Agent discovery. Agents publish "agent cards," structured descriptions of what they can do, what inputs they accept, and what outputs they produce. Other agents can discover these cards and decide whether to delegate work. This is analogous to how MCP servers publish tool schemas, but at the agent level.
Task exchange. A2A defines a task lifecycle: one agent creates a task, sends it to another agent, and receives updates as the task progresses. Tasks can be synchronous (wait for a result) or asynchronous (get a notification when it's done). The protocol handles the messaging, and your code handles the business logic.
Capability negotiation. Before sending a task, agents can negotiate what's possible. "Can you review Python code for security vulnerabilities?" "Yes, I can review Python 3.8+ code for OWASP Top 10 categories." This prevents wasted work on tasks the receiving agent can't handle.
Streaming results. For long-running tasks, A2A supports streaming partial results. Your agent can show the user progress while the peer agent works, rather than blocking until the full result is ready.
What A2A doesn't replace
A2A isn't a replacement for MCP, handoffs, or orchestration. It's a complement for specific boundary-crossing situations:
- MCP still handles tool access. Your agents still use MCP to call tools, read files, and query databases. A2A sits above the tool layer.
- Handoffs still handle internal routing. Within your orchestration graph, specialists still pass control via handoffs. A2A is for when you're crossing a process or organizational boundary.
- Orchestration still handles control flow. Your orchestrator still decides routing, manages state, and synthesizes results. A2A is a communication channel, not a replacement for your control logic.
A decision framework
When you're deciding how to connect agents, work through this sequence:
-
Can a single agent handle it? If yes, don't split. (We covered this in the first lesson of this module.)
-
Can internal handoffs handle it? If all the agents run in your process, under your control, with shared state, handoffs within your orchestration graph will cover most situations you'll encounter.
-
Do you need tool access across a boundary? If you need another system's functions but not its decision-making, use MCP. Expose the tools via an MCP server and call them from your agent.
-
Do you need another system's autonomous decision-making? If the other side has its own goals, policies, and reasoning, and you can't or shouldn't fold that into your system, A2A is the right fit.
Most code assistants will stop at step 2 for a long time. A2A becomes relevant when the system grows beyond a single team's scope or when integration with autonomous external agents is a real requirement, not a speculative one.
A lightweight A2A example
To make this concrete, here's a minimal example of what an A2A interaction looks like. Your code assistant wants to delegate a security review to a separate security agent:
# This is a conceptual example showing the A2A interaction pattern.
# The actual A2A protocol implementation depends on the SDK/library you use.
# 1. Discover the security agent
security_agent_card = {
"name": "security-reviewer",
"description": "Reviews code for security vulnerabilities",
"capabilities": ["python-security-review", "dependency-audit"],
"endpoint": "https://internal.example.com/agents/security-reviewer",
"input_schema": {
"type": "object",
"properties": {
"code_snippet": {"type": "string"},
"language": {"type": "string"},
"review_type": {"type": "string", "enum": ["owasp", "dependency", "full"]},
},
},
}
# 2. Create a task
task = {
"type": "security-review",
"input": {
"code_snippet": "def handle_upload(file_path: str): ...",
"language": "python",
"review_type": "owasp",
},
"callback": "https://your-agent.example.com/tasks/callback",
}
# 3. Send the task and receive results (async)
# In a real implementation, this would use the A2A SDK client
# result = a2a_client.send_task(security_agent_card["endpoint"], task)
# 4. The security agent processes independently and returns:
result = {
"status": "completed",
"findings": [
{
"severity": "high",
"category": "path-traversal",
"description": "file_path parameter is not validated against directory traversal",
"recommendation": "Use pathlib and validate against an allowed base directory",
}
],
"summary": "1 high-severity finding: path traversal vulnerability in handle_upload",
}The key difference from a tool call: the security agent decided how to review the code, what rules to apply, and how to structure its findings. Your agent sent a request; the security agent exercised its own judgment. That's the agent-to-agent boundary that A2A formalizes.
Exercises
-
Review your current orchestration graph. For each specialist, decide: is this a handoff (internal, shared state) or could it ever become an A2A boundary (separate team, separate policies)? Most will be handoffs, and that's expected.
-
Identify one hypothetical scenario where your code assistant would benefit from communicating with an external agent. Write an agent card for that external agent describing its capabilities, input schema, and what it would return.
-
Take one of your existing MCP tool calls and ask: what would change if this tool were replaced by an A2A agent? What decisions would the agent make that the tool currently doesn't? When would the tool be the better choice?
-
Draw a diagram of your system showing which connections are MCP (agent-to-tool), which are handoffs (internal control transfer), which are orchestration edges, and where A2A boundaries might exist in the future.
Completion checkpoint
You have:
- A clear understanding of the four-way distinction: MCP, A2A, handoffs, and orchestration
- The ability to identify which pattern fits a given integration scenario
- At least one concrete scenario where A2A would add value over simpler alternatives
- A diagram showing the protocol boundaries in your current system
Reflection prompts
- In your current system, is there any integration that's awkward as a tool call (MCP) but would be more natural as an agent interaction (A2A)?
- What are the debugging and observability challenges of A2A compared to internal handoffs? How would you trace a task that crosses an agent boundary?
- The A2A protocol is still evolving. What's the risk of building on it now vs. waiting for it to mature? How would you manage that risk?
What's next
Thread and Workflow Memory. Coordination is one axis; persistence is the next. The next lesson gives the system memory inside a session and across a workflow.
References
Start here
- A2A Protocol — the current Agent-to-Agent protocol documentation and specification overview
Build with this
- Model Context Protocol specification — the MCP spec, useful for understanding the boundary between tool access (MCP) and agent collaboration (A2A)
- MCP specification — practical MCP implementation guides
Deep dive
- Anthropic: Building effective agents — orchestration patterns — the orchestration continuum from simple handoffs to multi-agent systems
- OpenAI Agents SDK: Handoffs — OpenAI's approach to internal agent-to-agent control transfer