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

A2A protocols

- [Instructor] What protocol options exist for the A2A client and the A2A server to complete a task? Let's discuss the available options in this video. The first option is request response. Let's discuss a sequence diagram that explains how request response works. The A2A client initiates the task by sending a request message with the goal that needs to be achieved. The A2A server responds back with a working status. The A2A client will then periodically send requests for updates to the server. The server will respond back with the current status. This will continue until the A2A server is working on the task requested by the client. When the task is completed, the A2A server responds back with the final artifacts. Do note that the A2A server only responds to request from the A2A client. It does not trigger a message of its own. Also, it's possible that the server responds with the artifacts in the first round trip itself, so the status requests and updates are optional and their use depends upon the time it takes to complete the task. The next option is streaming with server sent events. Here again, the A2A client sends a request with the goal. The server now starts sending status or starts streaming the artifacts. This is triggered by the server. The server continues to send status or streamed artifacts without any additional request from the client. When the complete artifact is sent to the client, the server sends a completed event to inform the client that the task is now complete. The stream and status are initiated by the A2A server and continues until the task is complete. The number of such messages depends upon the type of task and the size of the artifact. The last type supported in A2A is push notifications. This is used in asynchronous communications only Unlike the previous two options, the A2A client does not keep the connection alive with the server. Here, the A2A client sends the request with the goal. It also provides a callback URL for the A2A server to send the responses. Then it terminates the connection. When the A2A server has updates to send, it initiates a status update to the callback URL. Again, the connection is terminated once the update is sent. This process continues as long as the A2A server is working on the task. When the task is completed, the A2A server sends the final artifacts to the callback URL. This method is used in long running or batch tasks when the client does not have to wait for completion.

Contents