Back to paths

A2A and MCP: agents talking to agents and to tools

Tell the two protocols apart. MCP connects an agent to tools; A2A connects independent agents, often run by other teams. Read an agent card, and choose between a local sub-agent, an AgentTool and a remote A2A agent.

advanced~25 min#agentic-ai#a2a#mcp#multi-agent
Chapter 4Custom agentsLesson 6 of 8Show

Prerequisites: Building agents with ADK


Two protocols, two boundaries

The ADK lesson composed agents inside one app: a sub-agent takes over the conversation, and an AgentTool is called like a function. Both run in your process, from code you own. Real systems also cross two other boundaries.

  • Agent to tool. The agent calls a function with typed arguments and gets a result: query a table, book a pickup. The Model Context Protocol () standardises this. An MCP server publishes tools with names, descriptions and parameter schemas; an agent lists them (tools/list) and calls them.
  • Agent to agent. The agent asks another agent, often run by another team or company, to do a piece of work. That agent has its own model, tools, instructions and state, and it may take minutes, ask a follow-up question or return files. The Agent2Agent protocol () standardises this.

The A2A project puts it this way. MCP is vertical: it deepens a single agent. A2A is horizontal: it connects agents across a boundary. The line is about what you are calling, not what each protocol can do: current MCP also has experimental tasks (deferred results with status tracking, including an input_required status) and elicitation, where a server asks the user for more information through the client. Choose A2A when the other side is an agent that someone else owns and publishes as an agent; choose MCP when you are exposing or calling tools. A2A is an open project under the Linux Foundation, contributed by Google, and its current specification is version 1.0.

What A2A exchanges

An A2A client sends a message (a role and one or more parts: text, a file or structured data) to a remote agent. The remote agent's work is a task, which moves through states: submitted, working, input-required (it needs an answer from the client), auth-required (it needs further credentials), and finally completed, failed, canceled or rejected. Its artifacts are the files or structured data the task produces. Long work can stream updates over server-sent events (a long-lived HTTP response the server keeps writing updates to), or send push notifications (the server calls a URL you registered when the task changes), so the client does not have to keep asking.

The remote agent stays opaque: the client sees its advertised skills, never its prompts, tools or reasoning. That is the point. The finance team can change its model or tools without breaking yours, and keeps its internals private.

Your agent calls a partner's agent over A2A. What can your agent see of it?

Follow one support agent across both boundaries: two MCP tool calls, then a refund check by the finance team's fraud-review agent over A2A. Predict first: can the support agent see the fraud-review agent's tools? Then step through and watch what crosses each boundary.

Simulation: a2a-vs-mcp-flow

Which protocol is vertical and which is horizontal, and what does that mean?

The agent card

A client finds out how to work with a remote agent from its : a JSON document the A2A server publishes, usually at https://{domain}/.well-known/agent-card.json. Here is a shortened card for the finance team's fraud-review agent (A2A 1.0 field names):

{
  "name": "Fraud review agent",
  "description": "Reviews a refund request for fraud risk and returns approve, reject or escalate, with reasons.",
  "version": "1.2.0",
  "supportedInterfaces": [
    {
      "url": "https://fraud-review.example.com/a2a",
      "protocolBinding": "JSONRPC",
      "protocolVersion": "1.0"
    }
  ],
  "capabilities": { "streaming": true, "pushNotifications": false },
  "defaultInputModes": ["text/plain", "application/json"],
  "defaultOutputModes": ["application/json"],
  "skills": [
    {
      "id": "review-refund",
      "name": "Review a refund",
      "description": "Assesses one refund request against order and payment history.",
      "tags": ["fraud", "refunds"]
    }
  ],
  "securitySchemes": {
    "google": {
      "openIdConnectSecurityScheme": {
        "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration"
      }
    }
  },
  "securityRequirements": [{ "schemes": { "google": { "list": ["openid"] } } }]
}
  • Identity: name, description and version say what the agent is.
  • Endpoint: supportedInterfaces gives the URL, the protocol binding (the wire format and transport requests use: JSON-RPC, gRPC or HTTP+JSON) and the A2A protocol version that interface speaks.
  • Capabilities: whether it streams or sends push notifications.
  • Skills: what it can do, described for the calling agent's model, much as a tool's description is.
  • Security: securitySchemes defines the authentication methods, here OpenID Connect (an identity layer on OAuth 2.0 that issues signed ID tokens), and securityRequirements says which of them the server requires. The card holds no secrets: the client obtains credentials separately, such as a token from the identity provider, and sends them with every request. The server authenticates each request against the requirements its card declares; the card only declares them, so the server's own code must enforce them.

Cards are also how agents are discovered at scale. Agent Registry, Google Cloud's catalogue of agents and MCP servers, indexes A2A agent cards alongside MCP servers, and agents deployed on Agent Runtime (Google Cloud's managed service for running agents) are registered there automatically. Gemini Enterprise, Google's workplace agent app, lets an administrator add an A2A agent by entering its card. Check which A2A version a product supports: Gemini Enterprise supports A2A 0.3's streaming mechanism, so a 1.0 agent also advertises a 0.3 interface, using the compatibility packages.

Local or remote: three designs for one scenario

The support agent needs three kinds of help:

NeedDesignWhy
A returns specialist your team owns, which should take over once a return startsSub-agentSame code and release, and control should pass to it
A summariser your team owns, whose result comes back to the support agentAgentToolSame code, and the caller keeps control
The finance team's fraud-review agent over A2AAnother team owns, deploys, scales and secures it
Sub-agentAgentToolRemote A2A agent
Runs inYour processYour processAnother service
Owned byYouYouOften another team
CouplingShared code and releaseShared code and releaseOnly the card and the protocol
IdentityYour app'sYour app'sAuthenticated per request, as the card requires
LatencyIn processIn processA network call, possibly a long task

Go remote when another team owns, scales or secures the agent, not merely because a capability sounds separate. Every remote hop adds latency, a deployment and an authentication path to keep working.

A2A in ADK

ADK can serve an agent over A2A and call a remote one. To serve the fraud-review agent, the finance team wraps it in its agent.py:

from google.adk.a2a.utils.agent_to_a2a import to_a2a
 
a2a_app = to_a2a(fraud_review_agent, port=8001)  # local test: uvicorn agent:a2a_app --port 8001

to_a2a builds an agent card from the agent's name, description and tools unless you pass your own. By default the card advertises http://localhost, so a deployed agent passes its real host and protocol, or its own card. On the calling side, a remote agent joins your agent like a sub-agent, but every turn crosses the network:

from google.adk.agents import LlmAgent
from google.adk.agents.remote_a2a_agent import RemoteA2aAgent
 
fraud_review = RemoteA2aAgent(
    name="fraud_review",
    description="Reviews refund requests for fraud risk. Use before approving a refund over 200 EUR.",
    agent_card="https://fraud-review.example.com/.well-known/agent-card.json",
)
 
support_agent = LlmAgent(
    name="support_agent",
    model="gemini-flash-latest",
    instruction="You help customers with orders and refunds.",
    sub_agents=[fraud_review],
)

The finance team can host its agent on Cloud Run (Google Cloud's serverless container service) or on Agent Runtime, both of which document A2A agents (in Preview at the time of writing).

Sources

Show 9 sourcesHide sources
SourcePublisherWhat it supports
"Tasks" (experimental) and "Elicitation" (opens in a new tab)and /client/elicitationmodelcontextprotocol.ioModel Context Protocol specification 2025-11-25deferred results with status tracking and an input_required status; servers can request more information from users through the client
A2A Protocol Specification (opens in a new tab)version 1.0.0a2a-protocol.orgA2A Projectagent card, task, message, part, artifact; task states; well-known path /.well-known/agent-card.json; protocol bindings JSON-RPC, gRPC and HTTP+JSON; security schemes; every request authenticated against the declared requirements
A2A and MCP (opens in a new tab)a2a-protocol.orgA2A ProjectMCP is vertical, A2A is horizontal; agents partnering versus using capabilities
README (opens in a new tab)github.comA2A Projectan open source project under the Linux Foundation, contributed by Google
"A2A quickstart: exposing" and "A2A quickstart: consuming" (opens in a new tab)github.comGoogle, Agent Development Kit documentationto_a2a; RemoteA2aAgent with name, description and agent_card
Create an Agent2Agent agent (opens in a new tab)docs.cloud.google.comGoogle CloudAgent Runtime A2A agents, Preview
A2A agents on Cloud Run (opens in a new tab)docs.cloud.google.comGoogle CloudPreview
Agent Registry and the A2A protocol (opens in a new tab)and "Automatic registration", docs.cloud.google.com/agent-registry/automatic-registration (opens in a new tab)docs.cloud.google.comGoogle Cloudindexes A2A agent cards; automatic registration on Agent Runtime
Register and manage an A2A agent (opens in a new tab)docs.cloud.google.comGoogle Cloudagent card entered as JSON; A2A v0.3 streaming; Preview

Suggested videos

Show 3 videosHide videos

Review

Flashcards1 / 3

What does MCP connect, and what does A2A connect?

Check yourself

Quick exam1 / 7 · 0 correct

The finance team runs a fraud-review agent as its own service, with its own model, tools and release schedule. Your support agent must ask it to review refund requests. What is the best design?

Go deeper

Your notes on this lesson