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

A2A communication elements

- [Instructor] What kinds of elements exist in the A2A protocol? And, what are their purposes? Let's explore them in this video. We begin with the agent card, which is a fundamental elemental for A2A. An agent card is a JSON-based metadata document. It is used to describe the configurations and capabilities of a given agent. It is created by the developer of the agent, with documentation that helps others understand about this agent. Key information present in the agent card includes the identity of the agent, like name and description, endpoint where the agent is being served, version of the agent, capabilities supported by the agent like streaming, skills of the agent like policy and time of, and modalities like text and video. The agent card can be hosted by the A2A server itself at a familiar endpoint. Alternatively, an agent registry or data tree can be used to host all agent cards centrally for discovery purposes. A2A clients can use the agent card to understand the capabilities of the agent, and then use them to decide if and how to integrate with that agent. The next element to discuss is a task. A task is the unit of work that an A2A client requests the server to complete. This an be an action, or a code or a question to answer. Examples of tasks include answer a question, create a file or approve a request. Each task is identified by a unique task ID, which is an integral part of all communications in A2A. A task can be synchronous or asynchronous. The status of a task is managed by the A2A server. Examples of status codes include submitted, working, completed, et. cetera. Then comes messages in A2A. A message is a single unit of communication between an A2A client, and an A2A server. A message can include any kind of data. This includes instructions, context, status or handshake. Each message is identified by a message ID. A given task may require multiple turns between the client and the server. So, there can be multiple messages required between the client and the server to complete a task. Each message can have many parts that represent the type of data. Examples include TextPart, FilePart and DataPart. Finally, we have the artifact element. The output generated by the A2A server is called an artifact. The output could be answers, documents, images and audio files that can be sent back from the server to the client using messages. Streaming can be used to incrementally send large artifacts. This is useful in real time streaming of text, audio or video.

Contents