What is the Agent to Agent Protocol
Introduction
Like alot of other people when I first saw Google announce the Agent2Agent Protocol, the first thing that came to mind was
Fortunately, they pretty explicitly called out that this was something to be built on top of MCP and not entirely replace it. Whether that holds true long term is yet to be seen.
So what is the Agent2Agent Protocol ?
To put it simply its a way for agents to communicate with each other. There are 3 actors in the protocol.
User - the end user that is using the agent to accomplish something Client - The application agent or service that is requesting the action to be completed Remote agent - The server or agent completing the task.
Transport
Unlike MCP the Agent2Agent protocol laucnhed with support for HTTP from the start. There is also optional support for SSE streaming. The biggest benefit of SSE streaming is that it allows for bidirectional communication and is a stateful transport.
Key Design Principles
The A2A protocol was built on five foundational principles:
-
Embracing Agentic Capabilities: A2A allows agents to collaborate in their natural, unstructured modalities, even when they don't share memory, tools, or context.
-
Building on Existing Standards: The protocol leverages popular standards like HTTP, SSE, and JSON-RPC, making it easier to integrate with existing IT infrastructure.
-
Security by Default: A2A is designed with enterprise-grade authentication and authorization, offering parity with OpenAPI's authentication schemes.
-
Support for Long-Running Tasks: From quick tasks to complex research projects that may take days, A2A provides flexibility with real-time feedback and state updates.
-
Modality Agnostic: Beyond text, A2A supports various communication formats, including audio and video streaming.
How A2A Works
The protocol facilitates communication between a "client" agent (which formulates tasks) and a "remote" agent (which acts on those tasks). This interaction includes:
- Capability Discovery: Agents advertise their capabilities through "Agent Cards" in JSON format
- Task Management: Agents collaborate on task completion with synchronized status updates
- Collaboration: Agents exchange messages to communicate context, replies, and artifacts
- User Experience Negotiation: Agents specify content types and formats based on user interface capabilities
Building Your First Agent
Below I'll outline a simple Agent its architecture.
Define your agent action
def get_weather(location: str, date: Optional[str] = None) -> dict[str, Any]:
"""
Get weather information for a specific location and optional date.
Args:
location (str): The city or location to get weather for
date (str): Optional date to get weather for. If not provided, returns current weather.
Returns:
dict[str, Any]: A dictionary containing weather information including temperature, conditions, and forecast.
"""
return {
"location": location,
"date": date if date else "current",
"temperature": "72°F",
"conditions": "Partly Cloudy",
"forecast": "Sunny with a chance of rain in the evening"
}
Initilize the agent
def _build_agent(self) -> LlmAgent:
"""Builds the LLM agent for the weather bot."""
return LlmAgent(
model="gemini-2.0-flash-001",
name="weather_agent",
description=(
"This agent provides weather information and forecasts for any location"
" requested by the user."
),
instruction="""
You are a weather assistant agent that helps users get weather information.
When a user asks about weather, you should:
1. Extract the location from their query
2. Check if they specified a date for the forecast
3. Use get_weather() to retrieve the weather information
4. Format the response in a user-friendly way
Always include:
- The location
- Current temperature
- Weather conditions
- A brief forecast
If the user doesn't specify a location, ask them to provide one.
If they ask for a forecast beyond what's available, let them know the limitations.
""",
tools=[
get_weather,
],
)
The Future of A2A
It will be interesting to see where things head from here. Both MCP and A2A have their own set of standards for auth and I'm curious how they will involved along side one another.
- ← Previous
MCP Statistics