Pular para o conteúdo
← Back to Skalablog

Published article

What Is the A2A Protocol? Google's Agent2Agent Explained

Software EngineeringOpenAIAnthropic

The a2a protocol is Google's open specification for letting AI agents built on different frameworks discover each other and exchange tasks over HTTP, instead of sharing a single runtime. It defines four moving parts: an Agent Card describing each agent, messages, tasks, and artifacts. This article explains each one and walks through a small local Python demo.

What the A2A protocol actually does

Google introduced the Agent2Agent protocol in April 2025 as a shared language for agent-to-agent communication. An a2a protocol setup lets a host agent find remote agents, read their Agent Cards, send tasks, and receive results, no matter which framework built either side.

Its purpose is practical: an agent built in CrewAI can talk to one built in AutoGen without sharing code or a runtime. The host only needs two things from a remote agent, the address where it is running and its JSON Agent Card. The A2A protocol is the channel in between.

The host agent and the remote agents

A host agent is the agent the user talks to. It receives your question, discovers which remote agents can answer it, and forwards the task. Remote agents are the specialists on the other side, and there can be several of them.

A concrete example from the demo is a trip from Chennai to Courtallam. You ask the host agent whether water is flowing in Courtallam. On the remote side, three agents are available: one checks the water, one books a hotel, one arranges food. The host discovers all three, sees that the question is about water, and talks only to the water agent. It returns that agent's answer to you.

That routing decision is the point. The host does not broadcast to every agent. It reads each Agent Card, picks the relevant one, and sends the task there.

The Agent Card

The Agent Card is the identity document of an agent. Just as a person's ID card carries a name, hometown, blood group, job and workplace, the Agent Card carries the agent's name, its purpose, what input to provide, what output it returns, and which tools it possesses.

The demo's card also includes the URI the agent runs on and the protocol version. It is published as a JSON file at a well-known path, so a host agent can fetch it without prior configuration. Both discovery and the Agent Card come from the A2A protocol itself; the host does not hard-code what each remote agent can do.

The four building blocks

The A2A protocol defines four parts that carry a request from start to finish:

  1. Agent Card: describes the agent, its capabilities, its URI and its version.
  2. Message: the content sent between agents, whether text or a file.
  3. Task: the unit of work, with a status that gets updated as the work proceeds.
  4. Artifact: the output the remote agent produces and returns.

A request moves through these in order: discover the available agents, choose the right one, send the task, receive the result.

How discovery and task exchange work step by step

  1. The user gives an input to the host agent.
  2. The host agent discovers which remote agents are available for that kind of work.
  3. Each remote agent exposes its Agent Card, which the host reads to learn its name, purpose, inputs, outputs and tools.
  4. The host chooses the agent that matches the question and sends it a task.
  5. The remote agent processes the task and returns an artifact, which the host shows to the user.

Discovery depends on the host knowing where each agent is running. In the local demo, the weather agent runs on port 8000 and the hotel agent on port 8001. Nothing is discovered unless those addresses are supplied to the host, because the host has no other way to find them.

ComponentRole in the A2A protocolDemo example
Host agentReceives user input, discovers remote agents, routes tasksStreamlit UI on port 3000
Weather agentRemote agent returning weather dataPython service on port 8000
Hotel agentRemote agent returning hotel dataPython service on port 8001
Agent CardJSON identity document fetched at a well-known pathName, description, URI, version, capabilities

The host can be code-based or no-code, and so can the remote agent. A2A only requires that both sides follow the same protocol.

A2A compared with MCP

QuestionA2AMCP
What does it connect?Agents to other agentsAn agent to tools and data sources
Who introduced it?Google, April 2025Anthropic
Do you need both?Yes, for delegation between agentsYes, inside each agent for tool access
Does one replace the other?NoNo

The two solve different problems. A2A handles the channel between a host and a remote specialist. MCP handles what a single agent can reach while doing its own work.

Running the demo locally without external packages

The demo uses no external AI packages and no APIs. All data is mock data hard-coded in the agents: the weather agent holds readings for Chennai, Bangalore and Mumbai, and the hotel agent holds a list of available hotels. Because there is no model call, the questions you ask are static, such as "What is the weather in Chennai?"

The code lives in a folder called a2a protocol with three files: weather_agent.py, the hotel agent and host_agent_ui.py. The UI is built with Streamlit.

To run it, OpenAI terminal in the project folder and start each agent on its port:

  1. Run python weather_agent.py. The weather agent starts and its Agent Card becomes available as a .json file at the well-known location.
  2. OpenAI second terminal, run cd a2a protocol, then start the hotel agent on port 8001.
  3. OpenAI third terminal, activate the virtual environment with the venv scripts, then run streamlit run host_agent_ui.py.
  4. In the Streamlit sidebar, the weather and hotel agents appear because they are running on their configured ports. Click either one to see its full Agent Card: URL, description, name, version and capabilities.
  5. Ask "What is the weather in Chennai?" The host selects the weather agent, and the UI shows the JSON of the request and the JSON of the response. The output is "weather in Chennai is 32", matching the mock data.

That single exchange, discovery, task, response, is the whole protocol in miniature.

Frequently Asked Questions

  • Is the a2a protocol open source? The specification and reference material are published in the open under the A2A project. Check the current repository license and the conformance details there before you build on a specific version, since the specification has been revised since its 2025 release.
  • Does A2A replace MCP? No. MCP connects an agent to tools and data sources, while A2A connects agents to each other. A working system can use both, with A2A for delegation between agents and MCP inside each agent for tool access.
  • Do the agents have to use the same framework? They do not. A2A's purpose is to let agents built on different frameworks communicate, since the host relies on the Agent Card rather than on shared code or a shared runtime. CrewAI and AutoGen are two examples the protocol is built to bridge.
  • Can I test A2A locally without cloud services? Yes. Running two remote agents and a host on localhost with mock data exercises discovery, Agent Card retrieval, task sending, and artifact return without any external API.
  • Who created the A2A protocol? Google introduced the Agent2Agent protocol in April 2025. The specification is now maintained through the open A2A project, so the current canonical details come from that repository rather than from the original announcement.

Turn the Explanation Into a Written Article

Explaining a protocol clearly is hard work, and it is the same work whether the explanation lives in a video or on a page. If you have already recorded a walkthrough like the one above, with a working demo and the reasoning behind it, that content deserves a second life as something readers can search and skim. Paste the YouTube URL into Skalablog, let it transcribe the video, and generate a structured article you can edit and publish.

Skala Blog

Source video

Watch the original walkthrough

The demo above comes from a video tutorial that builds the host agent, weather agent and hotel agent in Python, then runs them live. Watch it at YouTube to follow the terminal commands and the Streamlit UI in sequence.

About this article

The A2A protocol is one of the concepts explained in detail on Skala Blog, alongside tutorials on agent frameworks and protocols. If you want to see more AI-related content like this, subscribe to the channel and leave a comment with the concept you want covered next. Thanks to Gustavo dev doido for the question that prompted this walkthrough.

If you want more tutorials like this one, subscribe to the channel and leave a comment with the concept you want covered next; the questions in the comments shape what gets explained.

Paste the YouTube URL into Skalablog, let it transcribe the video, and generate a structured article you can edit and publish.

Skala Blog