Bridging Google A2A Protocol and MCP in Python Multi-Agent Systems
S L Manikanta
Nov 28, 2026 • 7 min read
bolt Key Takeaways
- MCP standardizes vertical agent-to-tool access (databases, APIs, files), while Google's A2A protocol standardizes horizontal agent-to-agent task delegation.
- Expose opaque specialist agents via A2A Agent Cards (/.well-known/agent.json) and JSON-RPC 2.0 + SSE without leaking internal prompts or memory schemas.
- Inside an A2A AgentExecutor, connect to local or remote FastMCP tool servers so tool definitions stay decoupled from inter-agent orchestration.
- Pin a2a-sdk>=0.2.5 and fastmcp>=2.3.0 with explicit task timeouts and structured artifact validation to prevent hanging delegation chains.
list On this page expand_more
- Quick Solution: A2A Server Powered by an Internal MCP Client
- Protocol Boundaries: A2A vs. MCP vs. In-Process LangGraph
- Production Implementation: A2A Specialist Agent Calling FastMCP
- 1. The A2A Specialist Server (a2a_mcp_worker.py)
- 2. The Upstream Orchestrator Client (a2a_orchestrator_client.py)
- Production Hardening Rules for A2A + MCP Bridges
- Frequently Asked Questions
- What is the difference between Google A2A and Anthropic MCP?
- Do I need A2A if I already use LangGraph for multi-agent workflows?
- How does an A2A client discover what a remote agent can do?
- Can an A2A agent call an MCP server internally?
Want to build production-ready AI?
Subscribe to StackMindset to receive actionable systems engineering checklists and code walkthroughs. No spam, only technical insights.
Quick Solution: A2A Server Powered by an Internal MCP Client
Modern multi-agent systems fail when teams force one protocol to do everything. MCP handles vertical tool access (agent to database/API), while A2A (Agent2Agent) handles horizontal delegation between independent agents. Pin a2a-sdk>=0.2.5 and fastmcp>=2.3.0 on Python 3.12+ to expose an A2A specialist agent that executes MCP tools internally.
pip install "a2a-sdk>=0.2.5" "fastmcp>=2.3.0" "uvicorn>=0.32.0" "httpx>=0.27.2" "pydantic>=2.10.0"
flowchart LR
Orch["Orchestrator Agent (LangGraph / ADK)"] -->|"1. GET /.well-known/agent.json"| Card["A2A Agent Card"]
Orch -->|"2. JSON-RPC tasks/send (HTTP/SSE)"| A2ASrv["A2A AgentServer (Compliance Specialist)"]
A2ASrv -->|"3. FastMCP Client Call"| MCPSrv["FastMCP Tool Server (SQL / Policy Docs)"]
MCPSrv -->|"4. Structured Tool Result"| A2ASrv
A2ASrv -->|"5. A2A Task Artifact"| Orch
Protocol Boundaries: A2A vs. MCP vs. In-Process LangGraph
The Agent2Agent (A2A) protocol is an open HTTP and JSON-RPC 2.0 standard for opaque, cross-framework agent collaboration, complementing the Model Context Protocol (MCP) which standardizes how individual agents invoke tools and read data sources.
When designing a multi-agent architecture, choosing the wrong boundary creates brittle coupling. Exposing raw database MCP tools directly to an upstream orchestrator leaks internal schemas, whereas stuffing every specialist into one monolithic graph creates deployment bottlenecks.
| Architectural Dimension | In-Process LangGraph Subgraph | MCP (Model Context Protocol) | Google A2A (Agent2Agent) |
|---|---|---|---|
| Primary Relationship | Node-to-node inside one app | Agent-to-tool / data source | Agent-to-agent across services |
| State & Memory | Shared TypedDict / Postgres checkpointer | Stateless or session-scoped tool calls | Opaque; only Task & Artifact states shared |
| Discovery Mechanism | Python import / compiled graph | tools/list & resources/list | /.well-known/agent.json Agent Card |
| Long-Running Tasks | Checkpointer + human interrupt | Request-scoped progress notifications | Native submitted / working / completed lifecycle |
| Best Production Fit | Tightly coupled reasoning loops | Reusable, deterministic capability APIs | Cross-team or cross-framework agent delegation |
If your agents share a single repository and state store, LangGraph with async Postgres checkpointing is simpler and faster than network RPC. Reach for A2A when you need service-level isolation, independent deployments, or interoperability between LangGraph, PydanticAI, and Google ADK services.
Production Implementation: A2A Specialist Agent Calling FastMCP
Below is a complete, runnable two-part Python implementation:
a2a_mcp_worker.py: An A2A server that publishes an Agent Card, receives atasks/senddelegation, calls a local or remote FastMCP tool server with a strict timeout, and returns a validated A2A Artifact.a2a_orchestrator_client.py: An upstream A2A client that fetches the Agent Card, dispatches a task, and handles errors cleanly.
Tested on Python 3.12, a2a-sdk==0.2.5, fastmcp==2.3.4, pydantic==2.10.4, and uvicorn==0.32.1.
1. The A2A Specialist Server (a2a_mcp_worker.py)
import asyncio
import os
import logging
from typing import Any
import uvicorn
from a2a.server.apps import A2AStarletteApplication
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.tasks import InMemoryTaskStore
from a2a.server.agent_execution import AgentExecutor, RequestContext
from a2a.server.events import EventQueue
from a2a.types import (
AgentCapabilities,
AgentCard,
AgentSkill,
TaskState,
TaskStatus,
TextPart,
)
from a2a.utils import new_agent_text_message
from fastmcp import Client as MCPClient
from fastmcp.client.transports import StreamableHttpTransport
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
logger = logging.getLogger("a2a.bridge")
MCP_SERVER_URL = os.environ.get("MCP_SERVER_URL", "http://localhost:8001/mcp")
class MCPBackedExecutor(AgentExecutor):
"""Executes incoming A2A tasks by delegating tool calls to an MCP server."""
def __init__(self, mcp_url: str, timeout_sec: float = 15.0) -> None:
self._mcp_url = mcp_url
self._timeout_sec = timeout_sec
async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
user_input = context.get_user_input()
if not user_input:
await event_queue.enqueue_event(
new_agent_text_message("Error: empty task payload.")
)
return
logger.info("Received A2A task %s: %s", context.task_id, user_input[:80])
try:
transport = StreamableHttpTransport(url=self._mcp_url)
async with MCPClient(transport, timeout=self._timeout_sec) as mcp_client:
tool_result = await asyncio.wait_for(
mcp_client.call_tool(
"query_ledger",
{"params": {"account_id": user_input.strip(), "limit": 5}},
),
timeout=self._timeout_sec,
)
summary = f"Ledger verification complete for {user_input.strip()}: {tool_result.data}"
await event_queue.enqueue_event(new_agent_text_message(summary))
except asyncio.TimeoutError:
logger.error("MCP tool call timed out after %.1fs", self._timeout_sec)
await event_queue.enqueue_event(
new_agent_text_message("Upstream MCP tool timed out. Retry later.")
)
except Exception as exc:
logger.exception("Failed executing MCP-backed A2A task")
await event_queue.enqueue_event(
new_agent_text_message(f"Task execution failed: {exc}")
)
async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None:
logger.warning("Cancellation requested for task %s", context.task_id)
def build_agent_card(base_url: str) -> AgentCard:
return AgentCard(
name="LedgerComplianceAgent",
description="Verifies account ledger entries using internal MCP data tools.",
url=base_url,
version="1.0.0",
defaultInputModes=["text"],
defaultOutputModes=["text"],
capabilities=AgentCapabilities(streaming=True),
skills=[
AgentSkill(
id="verify-ledger",
name="Verify Account Ledger",
description="Queries internal settlement ledger for a given account ID.",
tags=["finance", "compliance", "mcp"],
examples=["acct_1024"],
)
],
)
def create_app() -> Any:
base_url = os.environ.get("A2A_BASE_URL", "http://localhost:9999/")
handler = DefaultRequestHandler(
agent_executor=MCPBackedExecutor(MCP_SERVER_URL),
task_store=InMemoryTaskStore(),
)
app = A2AStarletteApplication(
agent_card=build_agent_card(base_url),
http_handler=handler,
)
return app.build()
if __name__ == "__main__":
uvicorn.run(create_app(), host="0.0.0.0", port=9999)
2. The Upstream Orchestrator Client (a2a_orchestrator_client.py)
import asyncio
import logging
import uuid
from typing import Any
import httpx
from a2a.client import A2ACardResolver, A2AClient
from a2a.types import MessageSendParams, SendMessageRequest
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("a2a.orchestrator")
async def delegate_to_specialist(base_url: str, account_id: str) -> dict[str, Any]:
async with httpx.AsyncClient(timeout=30.0) as httpx_client:
resolver = A2ACardResolver(httpx_client=httpx_client, base_url=base_url)
agent_card = await resolver.get_agent_card()
logger.info("Discovered A2A agent: %s (v%s)", agent_card.name, agent_card.version)
client = A2AClient(httpx_client=httpx_client, agent_card=agent_card)
request = SendMessageRequest(
id=str(uuid.uuid4()),
params=MessageSendParams(
message={
"role": "user",
"parts": [{"kind": "text", "text": account_id}],
"messageId": uuid.uuid4().hex,
}
),
)
response = await client.send_message(request)
return response.model_dump(mode="json", exclude_none=True)
if __name__ == "__main__":
output = asyncio.run(delegate_to_specialist("http://localhost:9999", "acct_1024"))
print(output)
Production Hardening Rules for A2A + MCP Bridges
- Replace
InMemoryTaskStorefor Multi-Replica Deployments: Just like stateful MCP servers,InMemoryTaskStoreloses task state on pod restart. Back your A2A task store with PostgreSQL or Redis when handling long-runningworkingtasks. - Isolate Credentials at the Protocol Boundary: Never forward end-user OAuth tokens blindly across arbitrary third-party A2A agents. Exchange or down-scope tokens at the gateway, following the OAuth 2.1 Resource Server pattern for Streamable HTTP MCP.
- Validate Structured Outputs Before Returning Artifacts: If your A2A agent uses an LLM to synthesize MCP tool results before returning an Artifact, enforce schema validation using PydanticAI or Instructor so downstream agents never parse malformed text.
- Prevent Recursive Delegation Loops: When Agent A can call Agent B and Agent B can call Agent A, propagate a
hop_countor OpenTelemetrytraceparentheader and reject delegations exceeding 4 hops, mirroring recursion limit guards in LangGraph. - Test Regressions Across Protocol Hops: Wire your A2A endpoints into automated DeepEval and Ragas CI regression pipelines so prompt or MCP tool changes don’t silently break downstream consumers.
In hybrid systems like StoxFlow, keeping internal reasoning inside a typed graph while exposing clean external capabilities over A2A and MCP prevents tight coupling as models and tools evolve.
Frequently Asked Questions
What is the difference between Google A2A and Anthropic MCP?
MCP connects a single AI agent to external tools, APIs, and data sources. A2A (Agent2Agent) connects independent, opaque AI agents to each other over HTTP, JSON-RPC 2.0, and SSE so they can delegate long-running tasks and exchange artifacts without sharing internal state.
Do I need A2A if I already use LangGraph for multi-agent workflows?
Use LangGraph subgraphs when all agents live in the same Python codebase and share a single state schema. Use A2A when agents are owned by different teams, written in different frameworks or languages, or deployed as isolated microservices.
How does an A2A client discover what a remote agent can do?
Every A2A server publishes an Agent Card JSON manifest at /.well-known/agent.json. The card declares the agent’s name, supported input/output modalities, skills, authentication schemes, and streaming capabilities before any task is dispatched.
Can an A2A agent call an MCP server internally?
Yes. That is the recommended production pattern: the A2A AgentExecutor receives a high-level task from a peer agent, invokes local or remote MCP tools via FastMCP to gather data, and returns a clean A2A Artifact.
Want to build production-ready AI?
Subscribe to StackMindset to receive actionable systems engineering checklists and code walkthroughs. No spam, only technical insights.
Written by S L Manikanta
AI Engineer specializing in agentic workflows, multi-step LLM validation pipelines, and secure cloud environments. Sharing practical lessons from building software.
Related Articles
LangGraph vs CrewAI vs AutoGen: Which Multi-Agent Framework Should You Actually Use?
A technical comparison of LangGraph, CrewAI, and AutoGen for building production multi-agent systems in 2026. Covers architecture, state management, checkpointing, control flow, and a clear decision framework for AI engineers.
AI Agent Design Patterns Every Engineer Should Know
A technical reference covering the essential design patterns for building production AI agents, including ReAct, Orchestrator-Worker, Evaluator-Optimizer, Tool Routing, Human-in-the-Loop, and Guardrail patterns.
Building Production AI Agents with MCP: Complete Architecture Guide (2026)
Architect and deploy production AI agents using Model Context Protocol (MCP). Step-by-step implementation for LangGraph host integration, stdio vs SSE transports, and secure tool sandboxing.