Chapter 10: Assembling Interoperable MAS with A2A
This introduction explains how A2A enables collaboration with remote agents across frameworks through standardized HTTP interactions and client-server roles.
After this chapter you will be able to
- Cross-framework agent interoperability. Explain how A2A lets a multi-agent system use agents built by others and why standardized HTTP interactions help.
- A2A client-server roles. Describe the roles of an A2A client and server, including how the book's LLM agent can participate on either side.
- Local and remote execution. Distinguish how the main agent sends work to and receives results from subagents versus A2A agents.
- Visibility and framework independence. Explain how developer access to subagents differs from access to A2A agents, and why A2A agents are easier to share across teams.
- Agent discovery and AgentCards. Describe how an A2A client discovers agents exposed by a server and what their AgentCards provide.
- Remote task exchange. Trace how a client sends a task to a remote agent and receives its outcome through an A2A server.
- Communication and implementation boundary. Explain what A2A standardizes and why that supports using agents built by others.
- Messages and content parts. Describe how a client initiates a task using a Message and how Parts represent its content.
- Stateful tasks and artifacts. Explain how a Task records execution state and how Artifacts carry results.
- Input required task workflow. Trace how an agent requests clarification and how the server reconnects the client's response to the saved Task.
- A2A SDK responsibilities. Explain how the official A2A Python SDK supports the framework’s client-side integration and what the framework must still handle.
- A2A agent specification. Describe what A2AAgentSpec represents and the information it holds about an A2A agent.
- Agent catalog disclosure. Explain how A2AAgentSpec discloses an agent to an LLM agent through catalog().
- Agent specification constructors. Distinguish from_agent_card() from the asynchronous from_url() constructor and trace how the latter builds a specification.
- A2A Tool Registry. Describe how UseA2AAgentTool identifies the A2A agents available to an LLM agent.
- Remote Task Dispatch. Trace how a tool call is validated, sent to a remote A2A agent, and returned to the framework.
- Input Required Task Resumption. Explain how the tool handles an A2A task that needs more input and how the optional task ID changes the meaning of the task argument.
- A2A registry and catalog wiring. Explain how LLMAgent and TaskHandler are updated to make remote A2A agents available during task execution.
- A2A dispatch during execution. Describe when and how UseA2AAgentTool dispatches a remote agent during a task.
- Input required Hailstone exchange. Trace how the coordinator responds when the CrewAI Hailstone agent needs a numerical starting value.
- AgentExecutor wrapper role. Explain how LLMAgentA2AExecutor uses the A2A AgentExecutor abstraction to make an LLMAgent available as a remote agent.
- A2A task execution flow. Trace how the executor turns a request into agent work and reports progress and outcomes through TaskUpdater.
- In-flight task tracking. Explain why the executor tracks TaskHandlers and what its cancellation implementation does.
- A2A server assembly. Describe the high-level steps for exposing an LLMAgent through an A2A server using FastAPI and the A2A SDK.
- Hailstone remote task round trip. Trace how the coordinator uses the running Hailstone A2A server to perform a task and receive its result.
- Remote agent process isolation. Distinguish the process and logging behavior of a remote A2A agent from that of a subagent.
- Interoperable multi-agent patterns. Explain how client-side A2A integration extends familiar multi-agent patterns to remote agents.
- Mixed-agent chaining example. Trace the coordinator's work with the CrewAI A2A agent and Hailstone subagent in the example.
- Streaming support limitations. Explain why the client and standard server integration do not stream progress, and describe the alternatives mentioned for adding streaming.
- Input-required workflow asymmetry. Explain which side supports the input-required flow, why the server side does not, and what change would help.
- Multi-turn context sharing gap. Describe what A2A’s context_id can refer to and how client and server changes could enable the framework to use it.
What it builds on
- Supporting subagents in our framework (chapter 9) · Subagents support multi-agent systems built using the book's own framework.
- The MCP architecture (chapter 5) · The earlier MCP architecture provides context for the contrast with the book's client-side MCP use.
- Implementing UseSubAgentTool (chapter 9) · The tool used to invoke local subagents.
- SubAgentSpec: a core type for specifying a subagent (chapter 9) · SubAgentSpec as the framework’s specification for a local subagent
- Implementing LLMAgentBuilder (chapter 5) · LLMAgentBuilder as the builder used for agents
- When—and How—should humans be in the loop? (chapter 8) · The motivation for requesting input when a task becomes ambiguous.
- Updating LLMAgent and TaskHandler (chapter 9) · The analogous integration for dispatching subagents.
- Implementing a processing loop for LLMAgent (chapter 4) · The LLMAgent processing loop.
Section by section
Introduction
This introduction explains how A2A enables collaboration with remote agents across frameworks through standardized HTTP interactions and client-server roles.
- Cross-framework agent interoperability: Explain how A2A lets a multi-agent system use agents built by others and why standardized HTTP interactions help.
Why it matters: This explains how your system can reuse other teams' agents instead of rebuilding their capabilities or creating a custom interface for each one. - A2A client-server roles: Describe the roles of an A2A client and server, including how the book's LLM agent can participate on either side.
Why it matters: The distinction shows how an agent can both use remote capabilities and make its own capabilities available to others.
Key terms: Agent2Agent protocol, A2A, HTTP, multi-agent systems, A2A client, A2A server, remote agent, MCP
10.1 How A2A works
10.1.1 Understanding subagents vs A2A agents
This section contrasts local subagents with remote A2A agents in execution and developer visibility.
- Local and remote execution: Distinguish how the main agent sends work to and receives results from subagents versus A2A agents.
Why it matters: This distinction explains where delegated work runs and how the main agent reaches it. - Visibility and framework independence: Explain how developer access to subagents differs from access to A2A agents, and why A2A agents are easier to share across teams.
Why it matters: A2A enables teams to use agents without owning their internals or using the same framework.
Key terms: subagents, A2A agents, A2A server, tool calls, event loop, SubAgentSpec, LLMAgentBuilder, black boxes, agent framework
10.1.2 Understanding A2A’s client-server architecture
This section explains how A2A clients discover remote agents and exchange tasks and results with them through servers.
- Agent discovery and AgentCards: Describe how an A2A client discovers agents exposed by a server and what their AgentCards provide.
Why it matters: Discovery tells a client what remote agents can do and where to reach them. - Remote task exchange: Trace how a client sends a task to a remote agent and receives its outcome through an A2A server.
Why it matters: This exchange lets an application delegate work to an agent exposed by a remote server. - Communication and implementation boundary: Explain what A2A standardizes and why that supports using agents built by others.
Why it matters: A shared communication protocol lets a system reuse remote agents without requiring the same internal implementation. - Long-running task updates: Describe the two update options mentioned for long-running A2A tasks.
Why it matters: Long-running work can keep a client informed without relying solely on an immediate result. - Marketplace agent discovery: Describe how an A2A agent marketplace offers an alternative way to discover and reach an agent.
Why it matters: A marketplace offers another source of agent information besides discovery from a server.
Key terms: agent discovery, AgentCard, well-known URI, HTTP GET, A2A client, A2A server, remote A2A agent, JSON-RPC, A2A protocol, communication
10.1.3 Understanding the A2A elements used in a task lifecycle
This section explains the A2A elements used to exchange task instructions, maintain task state, return results, and request additional input.
- Messages and content parts: Describe how a client initiates a task using a Message and how Parts represent its content.
Why it matters: This explains how task instructions and other content are packaged for A2A exchanges. - Stateful tasks and artifacts: Explain how a Task records execution state and how Artifacts carry results.
Why it matters: The Task lets clients track and refer back to work, while Artifacts hold its outputs. - Input required task workflow: Trace how an agent requests clarification and how the server reconnects the client's response to the saved Task.
Why it matters: This workflow lets a remote task continue when its instructions need clarification. - Immediate message responses: Distinguish an immediate Message response from a response represented by a Task.
Why it matters: Not every A2A interaction needs a Task response.
Key terms: Message, Part, Task, task ID, status, Artifact, input_required, TaskStore
10.2 Integrating A2A into our framework: client-side
This section introduces the client-side A2A integration and explains the role of the official Python SDK.
- A2A SDK responsibilities: Explain how the official A2A Python SDK supports the framework’s client-side integration and what the framework must still handle.
Why it matters: This distinction clarifies which communication work the SDK handles and which protocol objects the integration works with.
Key terms: A2A Python SDK, a2a-sdk, Message, Task
10.2.1 A2AAgentSpec: a core type for specifying an A2A agent
This section introduces A2AAgentSpec, its agent metadata and disclosure method, and its constructors for creating a specification from an AgentCard or server URL.
- A2A agent specification: Describe what A2AAgentSpec represents and the information it holds about an A2A agent.
Why it matters: The specification gives the framework the information needed to represent and reach an A2A agent. - Agent catalog disclosure: Explain how A2AAgentSpec discloses an agent to an LLM agent through catalog().
Why it matters: The catalog gives the LLM agent a representation of the A2A agent. - Agent specification constructors: Distinguish from_agent_card() from the asynchronous from_url() constructor and trace how the latter builds a specification.
Why it matters: The two constructors let you create a specification whether you already have the AgentCard or only the server URL.
Key terms: A2AAgentSpec, A2A AgentCard, headers, timeout, catalog(), XML-formatted string, from_url(), from_agent_card(), AgentCard, discovery
10.2.2 Implementing UseA2AAgentTool
This section explains how UseA2AAgentTool dispatches tasks to registered remote agents and supports tasks that require additional input.
- A2A Tool Registry: Describe how UseA2AAgentTool identifies the A2A agents available to an LLM agent.
Why it matters: The registry gives the tool a way to identify the remote agents available for delegation. - Remote Task Dispatch: Trace how a tool call is validated, sent to a remote A2A agent, and returned to the framework.
Why it matters: This flow connects the framework’s tool interface to agents running on remote A2A servers. - Input Required Task Resumption: Explain how the tool handles an A2A task that needs more input and how the optional task ID changes the meaning of the task argument.
Why it matters: The task ID lets an agent provide clarification to an existing remote task instead of accidentally starting a new one.
Key terms: UseA2AAgentTool, AsyncBaseTool, A2AAgentSpec, _a2a_agents_registry, __call__(), A2A Python SDK, A2A client, A2A Message, ToolCallResult, input_required
10.2.3 Updating LLMAgent and TaskHandler
This section updates the agent framework to use remote A2A agents and illustrates dispatch and input-required handling with a Hailstone example.
- A2A registry and catalog wiring: Explain how LLMAgent and TaskHandler are updated to make remote A2A agents available during task execution.
Why it matters: This wiring makes the available remote agents visible and usable during task execution. - A2A dispatch during execution: Describe when and how UseA2AAgentTool dispatches a remote agent during a task.
Why it matters: This locates remote agent interaction within the existing task-processing loop. - Input required Hailstone exchange: Trace how the coordinator responds when the CrewAI Hailstone agent needs a numerical starting value.
Why it matters: The example shows how a coordinator can respond when a remote agent needs more input. - Rollout and final result: Distinguish where the example’s remote-agent interactions appear from what the final output contains.
Why it matters: Knowing where to look lets you inspect the interaction rather than relying only on the final answer.
Key terms: a2a_agents_registry, _use_a2a_agent_tool, _a2a_agents_catalog, run_step(), UseA2AAgentTool, __call__(), tool-call execution, input-required, ToolCallResult, coordinator agent
10.3 Integrating A2A into our framework: server-side
This section introduces the planned server-side integration that will expose an LLMAgent as a remote A2A agent.
10.3.1 Wrapping LLMAgent in an A2A AgentExecutor
This section wraps an LLMAgent in an A2A AgentExecutor and traces how it executes, reports, and tracks remote tasks.
- AgentExecutor wrapper role: Explain how LLMAgentA2AExecutor uses the A2A AgentExecutor abstraction to make an LLMAgent available as a remote agent.
Why it matters: The wrapper connects the framework’s agent to the A2A server interface. - A2A task execution flow: Trace how the executor turns a request into agent work and reports progress and outcomes through TaskUpdater.
Why it matters: This flow explains how local agent work becomes an A2A task with observable progress and results. - In-flight task tracking: Explain why the executor tracks TaskHandlers and what its cancellation implementation does.
Why it matters: Tracking active work makes it possible to address the right task when several requests are in flight.
Key terms: AgentExecutor, LLMAgentA2AExecutor, execute(), cancel(), LLMAgent, RequestContext, A2A Task, TaskUpdater, Artifact, Message
10.3.2 Standing up an A2A server with the A2A SDK
This section outlines how to expose an LLMAgent through an A2A server and demonstrates a remote Hailstone task round trip and its process isolation.
- A2A server assembly: Describe the high-level steps for exposing an LLMAgent through an A2A server using FastAPI and the A2A SDK.
Why it matters: These steps show how to make an agent available to A2A clients without requiring server implementation details. - Hailstone remote task round trip: Trace how the coordinator uses the running Hailstone A2A server to perform a task and receive its result.
Why it matters: The example connects server setup to a complete client-to-agent task exchange. - Remote agent process isolation: Distinguish the process and logging behavior of a remote A2A agent from that of a subagent.
Why it matters: Process isolation explains where to look for a remote agent's execution logs.
Key terms: LLMAgentA2AExecutor, AgentCard, DefaultRequestHandler, FastAPI, a2a-sdk, A2AAgentSpec, coordinator LLMAgent, Hailstone A2A agent, subagents, remote A2A agents
10.4 MAS patterns using A2A
10.4.1 Router, Fan-out, and Chaining, but interoperable
This section shows how A2A extends familiar multi-agent patterns across framework and process boundaries through a mixed-agent chaining example.
- Interoperable multi-agent patterns: Explain how client-side A2A integration extends familiar multi-agent patterns to remote agents.
Why it matters: This shows how familiar coordination patterns can include independently implemented agents. - Mixed-agent chaining example: Trace the coordinator's work with the CrewAI A2A agent and Hailstone subagent in the example.
Why it matters: The example makes interoperability concrete by chaining an external agent with a local subagent.
Key terms: Router, Fan-out, Chaining, A2A agents, interoperability, coordinator LLMAgent, CrewAI A2A Agent, Hailstone subagent, UseA2AAgentTool, UseSubAgentTool
10.4.2 Limitations of our integration
This section identifies limitations of the framework’s A2A integration and outlines ways to address streaming, input-required workflows, and multi-turn context sharing.
- Streaming support limitations: Explain why the client and standard server integration do not stream progress, and describe the alternatives mentioned for adding streaming.
Why it matters: Streaming determines whether an agent can receive progress updates before a remote task finishes. - Input-required workflow asymmetry: Explain which side supports the input-required flow, why the server side does not, and what change would help.
Why it matters: This distinction shows why a supported client workflow cannot yet be handled by the framework’s server. - Multi-turn context sharing gap: Describe what A2A’s context_id can refer to and how client and server changes could enable the framework to use it.
Why it matters: Sharing context would let a new A2A task refer back to earlier work rather than treating every interaction as isolated.
Key terms: streaming, UseA2AAgentTool, ToolCallResult, LLMAgentA2AExecutor, StreamingLLMAgentA2AExecutor, SupervisedTaskHandler, input-required flow, rollout, LLMAgent, run()
10.5 Summary
Concepts explained in this chapter
- A2A clientAn A2A client is an agent or application that communicates with A2A servers to discover agents and send them tasks.
- A2A serverAn A2A server is a service that exposes agents to network clients and handles their task execution.
- UseA2AAgentToolUseA2AAgentTool is the example framework's tool for dispatching tasks to registered remote A2A agents.
- A2A agentAn A2A agent is an agent accessible to other agents through the Agent2Agent protocol without exposing its internal processes.
- taskAn A2A task is a stateful object representing an agent's execution of a request, including its status and any results.
- a2a-sdka2a-sdk is the official Python SDK for building clients and servers that communicate through the Agent2Agent protocol.
- llmagenta2aexecutorLLMAgentA2AExecutor is the book framework's A2A executor class that wraps an LLMAgent for remote task execution.
- input-required workflowThe input-required flow is an A2A workflow in which task execution can request additional input before continuing.
- A2AThe Agent2Agent protocol is an open standard for communication and collaboration between software agents, including agents built with different frameworks.
- A2A messageAn A2A message is a communication between an agent and a client containing one or more content parts.
- artifactAn A2A artifact is a protocol object representing an output produced by an agent task.
- streamingStreaming is the incremental delivery of data as it becomes available during an ongoing operation.
- agent executorAgentExecutor is an A2A SDK abstract class that handles agent execution requests and cancellation.
- subagentA subagent is an agent dispatched by another agent to work on a subtask contributing to an overall task.
- A2A task lifecycleThe A2A task lifecycle is the sequence of interactions and state changes involved in requesting and executing an agent task.
- client-server architectureClient-server architecture is a system pattern in which clients request services from servers that provide them.
- LLMAgentLLMAgent is the framework class that implements an LLM agent and its task-execution orchestration.
- TaskHandlerTaskHandler is a framework helper class that orchestrates task execution across the processing loop and resolves to a TaskResult.
- run_step()run_step() is an asynchronous TaskHandler method that executes one TaskStep and returns its TaskStepResult.
- ToolCallResultToolCallResult is a framework data structure that records a tool-call identifier, its execution result, and whether an error occurred.
- __call__() methodThe __call__() method is a Python special method that defines how an object behaves when invoked with function-call syntax.
- trajectoryA trajectory, or rollout, is a record of an agent's task execution, including its actions and their results.
- coordinator agentA coordinator LLM agent manages subagents or shared resources in a multi-agent system.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
