A2A offers a unified protocol allowing AI agents to exchange, discover their respective capabilities and cooperate without complex integrations.
The development of AI agents raises the question of communication between them. Next to MCP, for Model Context Protocol, AP2, for Agent Payments Protocol, ACP, the OpenAI / Stripe payment protocol or the Trusted Agent Protocol, A2A, for agent to agent, seems particularly promising. This open source specification designed by Google aims to standardize communication between AI agents. It provides a “common language”. This allows them to discover the capabilities of others, to exchange information and to collaborate to accomplish complex tasks that a single agent could not carry out alone.
Concretely, A2A simplifies what was until now a headache. For example, an inventory agent, operating on Microsoft Azure infrastructure, can now directly query a supplier agent hosted on Amazon Web Services to check the availability of a product, automatically triggering an order through a third billing agent. All this without going through difficult integrations.
A “business card” and a language in JSON
How A2A works is relatively simple. Each agent has a “business card”. She tells who the agent is, his abilities and how to contact him. Each of them can receive requests. They communicate in JSON. When the human user makes a request, the coordinator queries the different agents in JSON via the “agent cards” to find out who can help them respond. He combines their response to provide an answer to the user’s query.
There are numerous practical cases. For example, a coordinating agent may be responsible for finding the right doctor at the right time. For this purpose, he interviews a “Doctor” agent, who knows the different types of practitioners available, and a “calendar” agent, who manages the available slots.
We can also imagine a travel reservation system. There would be four “experts”: the Flights agent for searching for flights, the Hotels agent for searching for accommodation, the Weather agent for weather forecasts and the Coordinator agent. The user could make a request like: “I want to go to Rome next weekend”
Setting up the environment
For this tutorial, we will build a system composed of three agents. But, before we start using them, let’s make sure the environment is ready. To do this, we check that Python and pip, the package manager, are installed and configured in the PATH of our system. To examine this, we open a PowerShell or CMD terminal on Windows and type:
python –version pip --version
In case Python is not installed, one can download version 3.7 or higher from python.org.
We then install the dependencies, with Flask and Requests. The first is a tool for creating web servers in Python. In our case, this is what allows agents to listen and respond to requests. The second allows you to send web requests in Python. In our example, this is what allows the coordinator to talk to other agents.
In the terminal we type:
pip install flask requests
A file to download and commands to write
To use the agents, simply load the “tutoriel_a2a_simple” folder. We unzip it into the directory of our choice. This contains the different agents in the main files.
Restaurant Agent is a small program that can search restaurants based on different criteria like city. The Weather Officer provides weather forecasts for a given location and date. The Coordinating agent is the “conductor”. It receives the user’s query and provides them with a recommendation. All run on the computer like a mini web server. Finally, the client_test file allows you to test the agents via a command line interface.
To launch these agents, we open 4 different terminals. For terminal 1 of the Restaurant agent, we type:
cd chemin/vers/tutoriel_a2a_simple/agent_restaurant python agent_restaurant.py
The launch is successful. We see the agent’s “business card” and the address of his server.
For terminal 2 corresponding to the Weather agent, we write in a new terminal:
cd chemin/vers/tutoriel_a2a_simple/agent_meteo python agent_meteo.py
The new agent also introduces himself:
For terminal 3 of the coordinating agent, we mention:
cd chemin/vers/tutoriel_a2a_simple/agent_coordinateur python agent_coordinateur.py
This agent handles the other two well:
Let us indicate that in order to verify that the agents are working, it is possible to mention in the browser: http://localhost:10000/.well-known/agent.json for the Restaurant, http://localhost:10001/.well-known/agent.json for the Weather and http://localhost:10002/.well-known/agent.json for the Coordinator.
Operation of the whole via A2A
To test how everything works via A2A, we open a fourth terminal:
cd chemin/vers/tutoriel_a2a_simple/client_test python client_test.py
This should allow you to write a query in natural language. In our case: “I would like to go to a Lyon stop next Wednesday at noon”. We see that the Weather and Restaurant agents contacted provide a response.
Then the coordinator aggregates the results and gives his feedback:
Note that the coordinating agent did not always respond satisfactorily during our various tests. The A2A protocol must still provide a solid basis for creating a system where several “expert” agents collaborate. This simple use case can lead to other, more ambitious ones. For example, you can connect to real APIs instead of simulated data, add a database, create a web interface, use an LLM to understand queries and deploy this online.




