google-a2a-agent
Example implementation of the Google A2A protocol with a Flask server and Python client includes web search integration via MCP
Documentation
Google A2A Agent Example
This repository implements a simple Agent-to-Agent (A2A) communication example based on Google's A2A protocol. A2A is Google's proposed standard for enabling AI agents to communicate with each other through a standardized API.
Overview
The implementation consists of two main components:
1. Server (`server.py`): A Flask-based server acting as an AI agent. It implements the core A2A protocol endpoints:
2. Client (`client.py`): A simple Python script demonstrating how to interact with the A2A server:
Architecture
The interaction flow can be visualized as follows:
sequenceDiagram
participant C as Client (client.py)
participant S as A2A Server (server.py)
participant MCP as Brave MCP Server
participant OAI as OpenAI API
C->>S: GET /.well-known/agent.json (Discover Agent)
S-->>C: Agent Card JSON
C->>S: POST /tasks/send (Task Request with User Query)
S->>OAI: Process Query (Initial processing)
Note right of S: Agent decides to use Brave Search
S->>MCP: Search Request
MCP-->>S: Search Results
S->>OAI: Process Query + Search Results
OAI-->>S: Final Response Text
S-->>C: Task Response (with Agent's Final Message)- The Client initiates communication by discovering the A2A Server.
- The Client sends a task (e.g., "What is Google A2A?") to the Server.
- The Server uses the `pydantic-ai` library, which coordinates with:
- The Server sends the final response back to the Client.
Setup
1. Clone the repository:
git clone
cd2. Create and activate a virtual environment:
python -m venv venv
.\venv\Scripts\activatepython3 -m venv venv
source venv/bin/activate3. Create a `.env` file:
Create a file named `.env` in the root directory and add your API keys:
OPENAI_API_KEY=your_openai_api_key
BRAVE_API_KEY=your_brave_api_key*(Replace `your_openai_api_key` and `your_brave_api_key` with your actual keys)*
4. Install dependencies:
pip install -r requirements.txt5. Run the server:
Open a terminal, activate the virtual environment, and run:
python server.pyThe server will start, typically on `http://localhost:5000`.
6. Run the client:
Open a *separate* terminal, activate the virtual environment, and run:
python client.pyThe client will discover the server, send a predefined question, and print the agent's response.
A2A Protocol Details
Google's A2A protocol defines a standard way for agents to communicate via HTTP. Key concepts include:
- Agent Card (`/.well-known/agent.json`): A standard JSON document describing an agent's identity, capabilities (e.g., streaming support), and API endpoints.
- Task API (`/tasks/send`, `/tasks/receive`, etc.): Endpoints for exchanging tasks and messages. This example only implements the essential `/tasks/send`.
- Standardized Message Format: A consistent JSON structure for messages exchanged between agents, typically including roles (`user`, `agent`) and content parts.
For more in-depth information, refer to the official Google A2A protocol documentation (link if available).
Frequently asked questions
What is google-a2a-agent?
google-a2a-agent is Example implementation of the Google A2A protocol with a Flask server and Python client includes web search integration via MCP
How do I install google-a2a-agent?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is google-a2a-agent open source?
Yes — it is hosted on GitHub at https://github.com/system32miro/google-a2a-agent.
Related MCP tools
AWS MCP Servers — helping you get the most out of AWS, wherever you use MCP. Python-based implementation. Trusted by 6900+ developers.
A simple, secure MCP-to-OpenAPI proxy server Python-based implementation. Trusted by 3500+ developers. Trusted by 3500+ developers.
MCP server that interacts with Obsidian via the Obsidian rest API community plugin Python-based implementation. Trusted by 2300+ developers.
Default Configuration: MCP CLI defaults to using Ollama with the gpt-oss reasoning model for local, privacy-focused operation without requiring API keys.
Official MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
MCP server for long term agent memory with Mem0. Also useful as a template to get you started building your own MCP server with Python!
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP