Introduction to Agent2Agent (A2A) Protocol
By Google Cloud Tech
Agent-to-Agent (A2A) Protocol: A Detailed Overview
Key Concepts:
- A2A (Agent-to-Agent): An open standard for AI agent communication and collaboration.
- Agent Card: A JSON file serving as a digital “business card” for an agent, detailing its capabilities and endpoint.
- Client Agent: An agent initiating requests and handling user interaction.
- Remote Agent: An agent responding to requests and performing actions.
- Agent Executor: A class linking the A2A protocol with the specific logic of an agent.
- Task: A unit of work assigned to an agent, tracked with a lifecycle (Submitted, Working, Input Required, Completed, Failed).
- JSON RPC 2.0: The envelope format for messages exchanged between agents.
- SSE (Server-Sent Events): A streaming technology enabling real-time updates from a remote agent.
- MCP (Model Capabilities Protocol): A protocol focused on agent interaction with tools and APIs.
1. Introduction to A2A and its Purpose
Holt Skinner, a Developer Advocate for Google Cloud AI, introduces the Agent-to-Agent (A2A) protocol, developed by Google (with contributions from Ivon Nardini and Lashmi Harikumar). The core problem A2A addresses is the lack of a standardized communication method between the rapidly proliferating AI agents built by various companies using diverse frameworks. The goal is to enable seamless collaboration on complex tasks, such as trip planning, where multiple specialized agents (flight, hotel, activities) need to coordinate. Currently, integrating these agents is difficult due to their “opaque” implementations – developers lack insight into how other agents function internally. A2A aims to be the “common language” for agent interaction, analogous to how Langchain simplifies model swapping. It’s described as a system of “Lego blocks,” where standardized information and public methods allow agents to be easily connected and orchestrated.
2. Core Capabilities of the A2A Protocol
A2A offers several key capabilities:
- Dynamic Discovery: Agents can automatically find and identify each other.
- Standardized Tasks: Collaboration is facilitated through predefined, standardized tasks.
- Multimodal Content Sharing: Agents can exchange various data types, including text, files, and structured data.
- Long-Running Process Handling: The protocol supports asynchronous tasks that may take significant time to complete.
- Enterprise-Grade Security: Communication is secured using standard HTTPS.
- Implementation Opacity: Agents can interact without needing to understand each other’s internal workings.
3. How A2A Works: A Step-by-Step Process
The presentation details the process of agent interaction using Agent A (client) and Agent B (remote) as an example:
- Agent Discovery (Agent Card): Agent B publishes an “Agent Card” – a JSON file at a well-known URI – containing information about its name, function, HTTP endpoint, skills, supported capabilities (like streaming), and authentication requirements. This card functions similarly to
robots.txtfor web crawlers or service registries in microservice architectures. - Secure Communication (JSON RPC 2.0): Communication between agents occurs over secure HTTPS using the JSON RPC 2.0 protocol. This provides a simple mechanism for calling functions on a remote server.
- Message Structure: Messages consist of a “role” (user or agent) and “parts” (the actual content, which can be text, files, or structured data).
- Agent Executor: Agent B utilizes an “Agent Executor” – a class developers write – to bridge the A2A protocol with the agent’s specific logic. The SDK handles the underlying HTTP, JSON RPC, and event management, allowing developers to focus on the agent’s core functionality.
- Task Management: For long-running tasks, A2A employs a “Task” object with a lifecycle: Submitted, Working, Input Required, Completed, or Failed. Agent B initially responds with a task ID, and Agent A can periodically check the task status using the “tasks get” method.
- Streaming Updates (SSE): For real-time updates, A2A supports streaming via Server-Sent Events (SSE). If Agent B supports streaming, Agent A can use the “message stream” method to receive updates as they happen, including task status updates and streamed results (e.g., paragraphs of a generated document).
4. A2A in the Broader Agent Stack & Relationship to MCP
The presentation clarifies that A2A is not a standalone solution but rather a component within a larger agent stack. Google recommends a specific stack, but developers can customize it. Crucially, A2A is complementary to the Model Capabilities Protocol (MCP).
- MCP: Focuses on how an agent interacts with its own tools, APIs, and resources – essentially, function calling.
- A2A: Focuses on communication and collaboration between independent agents.
Therefore, a sophisticated agentic system will likely utilize both protocols: agents use MCP to interact with their tools and A2A to collaborate with other agents. As stated, “Agents use A2A and they use MCP to interact with their tools to get part of the job done.”
5. Adoption and Resources
A2A has gained significant traction in the software development industry, with a growing list of partners supporting the protocol (a current list is available in the A2A documentation). Resources available include:
- Documentation: goo.gold/2a
- Python SDK:
pip install aa-sdk - Sample Code: A2A Samples GitHub repo
- Google AA GitHub Organization: All official A2A code will be hosted here.
6. Community Involvement
The A2A protocol is actively evolving, and Google encourages community involvement through:
- GitHub Issues: Reporting bugs and suggesting features.
- Pull Requests: Contributing code improvements and sample implementations.
Notable Quote:
“A2A is just one part of a possible agent stack… A2A and MCP are complimentary, not competing.” – Holt Skinner
7. Conclusion
The A2A protocol represents a significant step towards enabling seamless collaboration between AI agents. By providing a standardized communication framework, A2A unlocks new possibilities for complex task orchestration and allows developers to leverage the strengths of different agents without needing to understand their internal implementations. The protocol’s focus on security, scalability, and implementation opacity makes it well-suited for enterprise applications and fosters a collaborative ecosystem for AI agent development. The availability of resources and the emphasis on community involvement position A2A for continued growth and adoption.
Chat with this Video
AI-PoweredHi! I can answer questions about this video "Introduction to Agent2Agent (A2A) Protocol". What would you like to know?