A2A Protocol: How Agents Discover and Collaborate with Other Agents
~15 min read
A2A lets AI agents connect to and collaborate with OTHER agents — distinct from MCP, which connects agents to tools. Agents publish a JSON "Agent Card" describing their capabilities so others can discover and communicate with them.
Agentic applications genuinely require both A2A and MCP — and understanding why starts with being precise about what each one actually does. MCP provides agents with access to tools, while A2A (Agent2Agent) allows agents to connect with OTHER agents and collaborate in teams. In a gist: A2A lets AI agents connect to other agents; MCP lets AI agents connect to tools/APIs. Because they solve different problems, they don't compete with each other — in fact, two agents talking to each other via A2A might themselves each be separately talking to MCP servers for their own tool access.
Mechanically, A2A enables multiple AI agents to work together on tasks WITHOUT directly sharing their internal memory, thoughts, or tools — this boundary matters, since agents built by different teams, on different frameworks, with different internal architectures, can still collaborate without needing compatible internals. Instead, they communicate by exchanging context, task updates, instructions, and data — a well-defined external interface rather than internal state sharing.
Discovery works through a specific mechanism: AI applications can model A2A agents as MCP resources, represented by their AgentCard. A2A-supporting remote agents must publish a JSON 'Agent Card' detailing their capabilities and authentication requirements — clients use this card to find and communicate with the best agent for a given task, the same way a service directory lets you discover what a service offers before calling it.
What makes A2A powerful, per this course: secure collaboration, task and state management, capability discovery via the Agent Card mechanism, and — notably — agents built on entirely different frameworks (LlamaIndex, CrewAI, etc.) working together despite that framework difference. This last point is exactly A2A's value proposition: it standardizes agent-to-agent collaboration the same way MCP standardizes agent-to-tool interaction, so framework choice stops being a barrier to multi-agent collaboration across organizational or team boundaries.
💻 Code example
# A conceptual A2A Agent Card — the JSON document a remote agent
# publishes so other agents/clients can discover its capabilities.
agent_card = {
"name": "flight-booking-agent",
"description": "Searches and books flights across major airlines",
"capabilities": ["search_flights", "book_flight", "cancel_booking"],
"authentication": {"type": "bearer_token"},
"endpoint": "https://flight-agent.example.com/a2a",
}
async def discover_and_delegate(task_description: str, known_agent_cards: list[dict]) -> str:
"""A2A-style discovery: find the best agent for a task from
published capabilities, WITHOUT needing access to that agent's
internal memory, tools, or implementation details."""
for card in known_agent_cards:
if any(cap in task_description.lower() for cap in card["capabilities"]):
# Delegate via the agent's published endpoint — exchanging
# context/instructions/data, not internal state
return f"Delegating to {card['name']} at {card['endpoint']}"
return "No suitable agent found in the known Agent Cards"
print(discover_and_delegate("book a flight to Tokyo", [agent_card]))
💬 Deep Dive with AI
Key points
- •A2A lets agents connect with and collaborate with OTHER agents; MCP lets agents connect with tools/APIs — different, complementary roles
- •Agents collaborate by exchanging context, task updates, instructions, and data — WITHOUT sharing internal memory, thoughts, or tools
- •Remote agents publish a JSON 'Agent Card' detailing capabilities and authentication, enabling discovery
- •AI applications can model A2A agents as MCP resources, represented by their Agent Card
- •Key strength: agents built on entirely different frameworks (LlamaIndex, CrewAI, etc.) can still collaborate through this standard