What you will learn in Build a Multi-Agent System (from Scratch)
With MCP and A2A
Chapter by chapter
Chapter 1: What are LLM Agents and Multi-Agent Systems?
Introduces how LLM agents turn generated intentions into actions through tool-calling and how multiple agents can collaborate in a system.
What you learn in chapter 1 →Chapter 2: Working with Tools
This introduction explains how tools expand LLM agents’ capabilities and outlines the basic tool-calling process.
What you learn in chapter 2 →Chapter 3: Working with LLMs
This introduction previews adding an LLM abstraction, an Ollama integration, and a complete tool-calling demonstration to the framework.
What you learn in chapter 3 →Chapter 4: The LLMAgent Class
This introduction connects the framework’s LLM and tool components to an agent and explains how to configure the chapter notebook’s LLM.
What you learn in chapter 4 →Chapter 5: MCP Tools
This introduction situates MCP as a standard for connecting agents to external systems and enabling access to third-party tools.
What you learn in chapter 5 →Chapter 6: Skills
This introduction explains why reusable procedures complement tools and how an open standard supports sharing skills.
What you learn in chapter 6 →Chapter 7: Memory
This introduction explains why agents need memory and how episodic memory can help them use past task executions.
What you learn in chapter 7 →Chapter 8: Human In the Loop
This introduction explains when human input, result approval, and stepwise supervision can help with agent tasks that should not be fully autonomous.
What you learn in chapter 8 →Chapter 9: Assembling MAS with Subagents
This introduction explains how a main LLM agent can delegate tasks to subagents and how subagent dispatch works through a tool.
What you learn in chapter 9 →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.
What you learn in chapter 10 →Concepts explained in this book
- LLMAgentLLMAgent is the framework class that implements an LLM agent and its task-execution orchestration.
- tool useToolCall is a data structure representing a requested tool invocation and its arguments.
- TaskHandlerTaskHandler is a framework helper class that orchestrates task execution across the processing loop and resolves to a TaskResult.
- subagentA subagent is an agent dispatched by another agent to work on a subtask contributing to an overall task.
- LLM-powered agentAn LLM agent is a software system that orchestrates a large language model and external capabilities to turn the model's intentions into actions.
- run()run() is an LLMAgent method that accepts a user task, initiates its processing loop, and returns an awaitable that resolves to a TaskResult.
- structured_output()structured_output() is a BaseLLM method that prompts an LLM to return a response conforming to a specified structure or custom type.
- multi-agent systemA multi-agent system is a system composed of multiple interacting agents that cooperate, coordinate, or compete to achieve goals.
- ToolCallResultToolCallResult is a framework data structure that records a tool-call identifier, its execution result, and whether an error occurred.
- run_step()run_step() is an asynchronous TaskHandler method that executes one TaskStep and returns its TaskStepResult.
- processing loopA processing loop is a repeated execution structure in which an LLM agent plans, invokes tools, evaluates results, and continues through successive steps until a stopping condition is met.
- memoryMemory is a collection of records from an agent's experiences that can influence its future behavior.
- continue_chat_with_tool_results()continue_chat_with_tool_results() is a BaseLLM method that submits tool results in an ongoing chat interaction for further LLM synthesis and response.
- trajectoryA trajectory, or rollout, is a record of an agent's task execution, including its actions and their results.
- agent skillA skill is a reusable workflow packaged for discovery, activation, and execution by an LLM agent.
- get_next_step()get_next_step() is an asynchronous TaskHandler method that determines the next TaskStep or returns the final TaskResult.
- supervised-execution HITLSupervised-execution HITL is a human-in-the-loop pattern in which a human oversees, inspects, and can modify individual steps of an agent's task execution.
- result-approval hitlResult-Approval HITL is a human-in-the-loop pattern in which a human reviews and either approves or rejects an LLM agent's completed task result.
- tool-based HITLTool-based HITL is a human-in-the-loop pattern in which an agent invokes a tool to request information from a human during task execution.
- A2AThe Agent2Agent protocol is an open standard for communication and collaboration between software agents, including agents built with different frameworks.
- BaseLLMBaseLLM is the example framework's abstract class defining an interface for large language models.
- basetoolBaseTool is the book-specific base class defining the common interface for callable tools in the framework.
- TaskResultTaskResult is a framework data structure containing a task identifier and the result of executing that task.
- OllamaLLMOllamaLLM is an LLM interface implementation that connects an agent framework to locally running models supported by Ollama.
- __call__() methodThe __call__() method is a Python special method that defines how an object behaves when invoked with function-call syntax.
- EpisodeEpisode is a book-specific record of an agent task execution containing its task, result or exception, rollout, metadata, identifier, and completion timestamp.
- agent skillsAgent Skills is an open standard for packaging reusable workflows that compliant LLM agent clients can discover, activate, and execute.
- A2A agentAn A2A agent is an agent accessible to other agents through the Agent2Agent protocol without exposing its internal processes.
- A2A serverAn A2A server is a service that exposes agents to network clients and handles their task execution.
- chat()chat() is a framework LLM interface method that processes input messages, conversation history, and optional tools to produce chat messages.
- MCPToolProviderMCPToolProvider is a framework class that establishes and maintains a connection to an MCP server and discovers its tools.
- human-in-the-loopHuman-in-the-loop is a design pattern in which people participate in or oversee stages of an automated process.
- A2A clientAn A2A client is an agent or application that communicates with A2A servers to discover agents and send them tasks.
- TaskStepTaskStep is a book-specific data structure representing one execution step associated with an overarching task.
- ChatMessageChatMessage is a structured representation of a message in an LLM conversation, including its role and content.
- complete()complete() is a BaseLLM method that performs text-completion interaction with a language model.
- MCPModel Context Protocol is an open standard for connecting AI applications with external tools and contextual resources.
- skill discoverySkill discovery is the process by which an LLM agent identifies available skills and determines whether one is relevant to a task.
- UseA2AAgentToolUseA2AAgentTool is the example framework's tool for dispatching tasks to registered remote A2A agents.
- usesubagenttoolUseSubAgentTool is the example framework's tool for dispatching registered subagents to execute tasks.
- BaseMemoryStoreBaseMemoryStore is a book-specific abstract base class defining an asynchronous interface for persisting, retrieving, updating, and deleting memory records.
- subagentspecSubAgentSpec is the example framework's class for specifying a subagent's identity, construction, and execution configuration.
- session()session() is an MCPToolProvider method that returns an established MCP session, creating it if necessary.
- episodic memoryEpisodic memory retains discrete experiences from an agent's task executions.
- TaskStepResultTaskStepResult is a framework data structure containing the result of executing one agent sub-step.
- MCPToolMCPTool is a book-specific asynchronous wrapper that exposes an MCP server tool through the framework's tool interface.
- SupervisedTaskHandlerSupervisedTaskHandler is a book-specific TaskHandler variant whose task execution steps are manually supervised by a human operator.
- toolA tool is an externally executable capability that an LLM agent can invoke to perform an operation or obtain information.
- SKILL.mdSKILL.md is the required Markdown file in an Agent Skills bundle that contains the skill's metadata and instructions.
- HumanInputToolHumanInputTool is a book-specific callable tool that obtains input from a human operator during agent execution.
- taskA task is a framework data structure containing the identifier and instruction for a user-submitted task.
- CompleteResultCompleteResult is a data structure containing an LLM text-completion response and the prompt that produced it.
- ollama.chat()ollama.chat() is an Ollama client method that sends messages and optional tools to a model and returns its chat response.
- taskAn A2A task is a stateful object representing an agent's execution of a request, including its status and any results.
- dynamic tool discoveryTool discovery is the process of identifying and obtaining the descriptions of tools exposed by an external provider before constructing an agent that can use them.
- JSON SchemaJSON Schema is a standard for describing and validating the structure, data types, and constraints of JSON data.
- a2a-sdka2a-sdk is the official Python SDK for building clients and servers that communicate through the Agent2Agent protocol.
- NextStepDecisionNextStepDecision is a framework data structure whose kind and content represent either the instruction for the next sub-step or the overall task result.
- llmagenta2aexecutorLLMAgentA2AExecutor is the book framework's A2A executor class that wraps an LLMAgent for remote task execution.
- MCP toolAn MCP tool is an executable capability exposed through the Model Context Protocol.
- input-required workflowThe input-required flow is an A2A workflow in which task execution can request additional input before continuing.
- working memoryWorking memory is transient memory that retains an agent's progress during its current task execution.
- LLMAgentBuilderLLMAgentBuilder is a book-specific framework class that discovers tools from selected MCP servers and constructs an LLMAgent with them.
- SimpleFunctionToolSimpleFunctionTool is a book-specific tool wrapper that automatically exposes a synchronous Python function as an invocable agent tool.
- templateA template is a modifiable text structure containing placeholders that can be filled with values before an LLM interaction.
- 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.
- BaseModelPydantic BaseModel is a base class for defining typed data models that validate and serialize structured data.
- stopping criterionA stopping condition is a rule that determines when iterative task execution must terminate.
- embeddingAn embedding is a numerical vector representation of an item that encodes properties or relationships relevant to machine learning.
- approval gateA human approval gate is a review mechanism that requires human approval of a task result and returns rejected results with feedback for revision.
- QdrantMemoryStoreQdrantMemoryStore is a book-specific memory-store backend that indexes and retrieves episodes using Qdrant.
- similarity searchSimilarity search retrieves items according to their similarity to a query, often using vector representations.
- QdrantQdrant is an open-source vector database and similarity-search engine.
- planningPlanning is the capability of formulating and revising a sequence of actions or steps toward completing a task.
- asyncbasetoolAsyncBaseTool is a framework base class for tools whose operations execute asynchronously and can avoid blocking while awaiting external results.
- vector databaseA vector database stores and indexes vector embeddings to support similarity-based retrieval.
- BaseModel.model_json_schema()BaseModel.model_json_schema() is a Pydantic method that generates a JSON Schema describing a model.
- coordinator agentA coordinator LLM agent manages subagents or shared resources in a multi-agent system.
- AsyncClientollama.AsyncClient is Ollama's asynchronous client class for communicating with a running Ollama service.
- llm agent frameworkAn LLM agent framework is software infrastructure that provides reusable components for building and operating systems centered on large language models.
- agent executorAgentExecutor is an A2A SDK abstract class that handles agent execution requests and cancellation.
- concurrencyConcurrency is the coordination of multiple tasks whose execution can overlap in time.
- useskilltoolUseSkillTool is the example framework's tool class for activating a skill and returning its formatted content.
- recall methodA recall method is a procedure for selecting stored memories to retrieve for a task.
- tool registryA tool registry is a collection that organizes tools for lookup and dispatch.
- chainingChaining is a multi-agent pattern in which an agent dispatches subagents sequentially, often passing results between dependent subtasks.
- client-server architectureClient-server architecture is a system pattern in which clients request services from servers that provide them.
- streamingStreaming is the incremental delivery of data as it becomes available during an ongoing operation.
- skill directoryA skill repository is a storage location for skill bundles, defined according to an agent application's and skill's scope.
- skill resourceA skill resource is an auxiliary file that a skill's workflow can use, categorized as a script, reference, or asset.
- LLMAgentTemplatesLLMAgentTemplates is a framework type that defines the prompt templates used for standardized interactions with an agent's backbone LLM.
- memory recordA memory record is a purposefully constructed stored record derived from an LLM agent's experience or past task execution.
- ChatRoleChatRole is an enumeration of the valid roles for messages in an LLM conversation.
- memory moduleA component that stores information from agent task execution and retrieves selected information into the agent's processing context.
- skill activationSkill activation is the process of loading a skill's procedural workflow into the LLM's context so the workflow can be executed.
- LLM Agent InspectorLLM Agent Inspector is a book-specific developer tool that provides an interface for supervising LLM agent task execution.
- A2A task lifecycleThe A2A task lifecycle is the sequence of interactions and state changes involved in requesting and executing an agent task.
- MCP serverAn MCP server is a program that exposes tools or contextual resources to clients through the Model Context Protocol.
- shared lockA shared lock is a synchronization mechanism that permits only one concurrent participant at a time to access a protected resource.
- asyncio.Eventasyncio.Event is a Python asyncio synchronization primitive that lets asynchronous tasks signal that a condition has occurred.
- mcp clientAn MCP client is a software component that connects an AI application to capabilities exposed through the Model Context Protocol.
- abstract methodAn abstract method is a method that concrete subclasses must implement before they can be instantiated.
- frontmatterFrontmatter is metadata placed at the beginning of a structured document and separated from its main content.
- run_with_skill()run_with_skill() is the example framework's LLMAgent method for explicitly invoking a named skill with an optional prompt and step limit.
- Skill.catalog()Skill.catalog() produces an informational string containing the skill's name, description, and location.
- skillscopeSkillScope is a book-specific enumeration representing the scope options available to an agent skill.
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.
