From the course: Hands-On AI: Building AI Agents with Model Context Protocol (MCP) and Agent2Agent (A2A)

Architecture of A2A

- [Narrator] In this video, we will discuss the typical architecture of A2A, and how agents use it to interact with each other. There are three main actors in an A2A setup. First comes the A2A user. The A2A user is a human end user who provides goals or tasks to the multi-agent system. The user could also be a client program that sends goals and receives responses as part of a workflow. Then comes the A2A client agent. The client agent has its own reasoning process with an LLM. It can decide to utilize the services of another agent to fulfill certain tasks. It initiates communication with the other agent and receives results or responses. Finally, there is the A2A server agent. This is the agent that receives requests from a client agent, then executes them and returns responses. The A2A client and the server are typical client servers in software architectures. The same agent can be both a client for some actions, and a server for others. This is how a typical A2A setup looks like. We have the A2A client agent and the A2A server agent. The server agent runs an A2A server inside it. This server is typically listening on a port. The A2A client resides inside the client agent. This connects to the A2A server on the server agent using the A2A protocol. It initiates connection, gets a listing of agents, and executes tasks. Now, the A2A client agent can independently use a few MCP servers for its tools, prompts and resources. The A2A server agent can also independently use a few MCP servers for its own use. They can also share MCP servers if needed. It is very important to understand how MCP and A2A are different. MCP provides resources and tools. A2A provides integrations with other independent agents with their own reasoning models. Can an MCP server run an agent underneath it? It can, but what we are concerned about here is the interface between the entities, not their internal implementation. The user or the client application talks to the A2A agent for initiating requests and receiving responses. What does a multi-agent system with A2A look like? Let's say we have an agent, agent one, having an A2A client that talks to agent two using MCP. Agent two can in turn talk to agent three. So agent two has both a client and a server implementation, but for connecting to different agents. We can also have agent four, which acts as a server to agent two, but uses agent three. Any kind of permutations and combinations are possible here. Agents have an instance of an A2A client for each server they integrate with. On the other hand, a single instance of an A2A server can handle many clients.

Contents