Catalog My learning Blog
Build AI Agents with MCP: 30-Day Course · Phase 6 · Lesson 26 · 6 min read

Multi-Agent Systems and the A2A Protocol Explained

On this page
  1. Learning Objective
  2. Concept Explanation
  3. Worked Example: Subagents in Code and an A2A Agent Card
  4. Real-World Examples
  5. Review Questions & Answers

Learning Objective

Decide when several cooperating agents beat one, design the handoffs between them, and understand the Agent2Agent (A2A) protocol for agents that talk across teams and vendors, including how it complements MCP.

Concept Explanation

A multi-agent system splits work between several model-driven loops, each with its own instructions, tools and context window. The orchestrator-workers pattern from Day 7 is the most common form; others include handoffs, where one agent passes the conversation to a specialist, and pipelines, where agents work in sequence on an artifact. The appeal is real: separate contexts keep each agent focused, parallel agents cover breadth quickly, and specialists can use different models, tools and permissions.

The costs are just as real. Every agent re-reads its own instructions and context, so token usage multiplies; Anthropic reported that its multi-agent research system used about fifteen times more tokens than a chat interaction. Coordination is hard: agents duplicate work, contradict each other, or lose information at handoffs because each sees only its brief. Debugging means following several interleaved transcripts. Cognition, the company behind Devin, argued in 2025 that for tasks such as coding, where every decision depends on earlier ones, a single agent with well-managed context is usually more reliable than many agents that cannot see each other's choices.

A useful rule follows from both views. Multi-agent designs pay off when the work is broad and parallelizable, subtasks are fairly independent, and the value justifies the extra tokens: research across many sources, reviewing many files, processing many records. They fit poorly when subtasks share many dependencies and each step must build on the precise decisions of the previous one. When you do split, make handoffs explicit: the brief, the expected output format, and the facts every agent must share.

Inside one application, agents usually communicate through function calls in the same process, for example subagents in the Claude Agent SDK or handoffs in the OpenAI Agents SDK. Across organizational or vendor boundaries you need a protocol. The Agent2Agent protocol, launched by Google in April 2025, donated to the Linux Foundation in June 2025 and stable at version 1.0 since April 2026, fills that role. An A2A server publishes an Agent Card at /.well-known/agent-card.json describing its name, skills, endpoints, supported content types and security requirements. Clients send messages; the remote agent creates a task that moves through states such as working, input required, completed or failed, and returns artifacts as results. Streaming and push notifications cover long-running tasks.

A2A and MCP solve different problems and are designed to be used together. MCP connects an agent to tools and data: the server is a capability without its own goals. A2A connects an agent to another agent: the remote side has its own reasoning, may take a long time, may ask for more input, and hides its internals. In a typical architecture, an orchestrator delegates to specialist agents over A2A, and each specialist reaches its tools over MCP.

ApproachCommunicationBest forMain risk
Single agentOne loop, one contextTightly coupled, sequential workContext growth on long tasks
Subagents in one appFunction calls in processParallel research, isolated explorationToken cost, lost details at handoffs
HandoffsConversation passed to a specialistTriage then specialist supportContext dropped at the boundary
A2A across servicesAgent Cards, tasks, artifacts over HTTPAgents owned by other teams or vendorsTrust, latency, partial failure
MCPTools and resourcesGiving any agent capabilitiesTool sprawl, injection via results

Worked Example: Subagents in Code and an A2A Agent Card

The first part defines two subagents with the Claude Agent SDK, each with restricted tools and its own model. The second shows the Agent Card a team might publish so other organizations' agents can call their invoice agent over A2A.

Code
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions, AgentDefinition

options = ClaudeAgentOptions(
    agents={
        "code-searcher": AgentDefinition(
            description="Finds where something is implemented. Use for any 'where is' question.",
            prompt="Search the repository and return file paths with one-line explanations. No edits.",
            tools=["Grep", "Glob", "Read"], model="haiku"),
        "test-runner": AgentDefinition(
            description="Runs the test suite and summarizes failures only.",
            prompt="Run the tests, then return only failing test names and the key error lines.",
            tools=["Bash", "Read"], model="sonnet"),
    },
    allowed_tools=["Read", "Edit", "Agent"],      # the main agent delegates through the Agent tool
    max_turns=30,
)

async def main():
    async for msg in query(prompt="Fix the failing invoice rounding test.", options=options):
        if type(msg).__name__ == "ResultMessage":
            print(msg.result)

asyncio.run(main())
JSON
{
  "name": "Invoice Agent",
  "description": "Answers questions about invoices and issues credit notes for Acme customers.",
  "version": "1.4.0",
  "supportedInterfaces": [
    { "url": "https://agents.acme.example/invoices/a2a", "protocolBinding": "JSONRPC" }
  ],
  "capabilities": { "streaming": true, "pushNotifications": true },
  "defaultInputModes": ["text/plain", "application/json"],
  "defaultOutputModes": ["text/plain", "application/json"],
  "skills": [
    { "id": "invoice-lookup", "name": "Invoice lookup",
      "description": "Find invoices by customer, number or date range and explain line items.",
      "tags": ["billing", "invoices"], "examples": ["Why is invoice 4471 higher than last month?"] },
    { "id": "credit-note", "name": "Issue credit note",
      "description": "Issue a credit note up to 500 EUR; larger amounts return input-required for approval.",
      "tags": ["billing", "refunds"] }
  ]
}

Within the coding task, the subagents keep search output and test logs out of the main agent's context. Across companies, the Agent Card lets a partner's procurement agent discover what the invoice agent can do without knowing which model or tools it uses internally; a real card would also declare its security schemes.

An orchestrator delegates to specialist agents over A2A after reading their Agent Cards. Each specialist has its own reasoning and reaches its tools over MCP. A2A is agent to agent; MCP is agent to tool.
An orchestrator delegates to specialist agents over A2A after reading their Agent Cards. Each specialist has its own reasoning and reaches its tools over MCP. A2A is agent to agent; MCP is agent to tool.

Real-World Examples

  • Anthropic's June 2025 post on its Research feature reported that the multi-agent system outperformed a single agent by about 90 percent on breadth-first research queries while using roughly fifteen times the tokens of a chat, and concluded that multi-agent designs suit high-value, parallelizable tasks.
  • Google announced A2A in April 2025 with more than fifty partners, contributed it to the Linux Foundation in June 2025 with AWS, Cisco, Microsoft, Salesforce, SAP and ServiceNow among the founding members, and the protocol reached version 1.0 in April 2026.
Key TakeawaysUse multiple agents when the work is broad, parallel and valuable enough to justify several times the tokens of a single agent. Keep a single agent when steps depend tightly on each other. Make handoffs explicit with briefs, formats and shared facts. Within one app, use subagents or handoffs; across organizations, use A2A, where Agent Cards describe skills and tasks carry long-running work. A2A connects agents to agents; MCP connects agents to tools.

Review Questions & Answers

When the task is broad and can be split into fairly independent parallel subtasks, such as researching many sources, and its value justifies the much higher token usage.

Each agent sees only its own context, so decisions made by one are not visible to others. Subtasks that depend on each other's precise choices lead to conflicting or inconsistent results.

A JSON document describing an agent's name, skills, endpoints, supported content types, capabilities and security requirements. It is published at /.well-known/agent-card.json so other agents can discover it.

An orchestrator uses A2A to delegate tasks to specialist agents, which have their own reasoning and may run long, and each specialist uses MCP to access the tools and data it needs.