chapter ten

10 Assembling Interoperable MAS with A2A

 

This chapter covers

  • Collaborating with agents from other frameworks through the Agent2Agent protocol
  • Turning the LLMAgent into an A2A client, enabling it to use remote A2A agents
  • Wrapping the LLMAgent in an A2A server, so it can become a remote A2A agent for other A2A clients

Now that we know how to create subagents, we can build multi-agent systems composed exclusively of LLM agents built with our framework. But what if we want to compose a MAS using agents built by others, potentially with other frameworks? For example, another team in your company may already have built an agent using LangGraph to handle an important data-preprocessing step that your MAS also needs. Rather than building your own agent, you can connect your MAS to that team’s agent and send tasks to it directly. As with MCP tools built by others, using agents built by others can unlock new capabilities for your MAS. For the final step of our build plan, we’ll integrate the A2A protocol, which lets agents connect and collaborate on tasks regardless of the frameworks that built them.

With the A2A protocol, these interactions happen over HTTP network calls, and the protocol standardizes them. This allows any A2A-compatible system to readily connect to any A2A agent. Without such a standard, we could resort to standing up a custom HTTP API around the other team’s agent, but we’d have to do that for every agent built by other teams we wanted to use.

10.1 How A2A works

10.1.1 Understanding subagents vs A2A agents

10.1.2 Understanding A2A’s client-server architecture

10.1.3 Understanding the A2A elements used in a task lifecycle

10.2 Integrating A2A into our framework: client-side

10.2.1 A2AAgentSpec: a core type for specifying an A2A agent

10.2.2 Implementing UseA2AAgentTool

10.2.3 Updating LLMAgent and TaskHandler

10.3 Integrating A2A into our framework: server-side

10.3.1 Wrapping LLMAgent in an A2A AgentExecutor

10.3.2 Standing up an A2A server with the A2A SDK

10.4 MAS patterns using A2A

10.4.1 Router, Fan-out, and Chaining, but interoperable

10.4.2 Limitations of our integration

10.5 Summary