Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Val Andrei Fajardo

Build a Multi-Agent System (From Scratch) shows you how to build a complete, working system of agents. Each chapter builds a new stage of your system. Begin by developing your first scratch-built agent, continue to integrate MCP compatibility, incorporate key patterns and designs like human-in-the-loop and memory, and finally implement full Agent2Agent capability that distributes a task among multiple agents. Every milestone comes with a careful walkthrough of the design decisions and code. By the end of the book, you will have a practical, extensible multi-agent system—and the skills to adapt it for research, business automation, or your own experiments.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on guide to building a complete multi-agent system from the ground up, covering LLM agents, tool-calling, MCP, and A2A protocols. Ideal for developers who want to understand agent infrastructure by writing it themselves rather than relying on existing frameworks. 【Book Arc】 - **Opening (~0%–10%)**: Introduces what LLM agents and multi-agent systems are, why LLMs alone are insufficient, and surveys real-world applications like deep research, Agentic RAG, coding agents, and computer use. Establishes the roadmap for building a custom framework. - **Early (~10%–35%)**: Covers the core prerequisites for an LLM agent—planning capability and tool-calling—and presents a mental model of the agent processing loop that executes tasks through sub-steps with iterative planning. - **Middle (~35%–55%)**: Begins the hands-on build by defining the tool infrastructure: a `BaseTool` base class, `ToolCall` and `ToolCallResult` data structures, and converting Python functions into LLM-compatible tools within the `llm-agents-from-scratch` framework. - **Late (~55%–80%)**: Excerpts do not cover this stage in detail, but the blurb indicates integration of MCP compatibility, human-in-the-loop patterns, and memory into the agent system. - **Ending (~80%–100%)**: Excerpts do not cover this stage, but the blurb indicates implementation of full Agent2Agent (A2A) capability to distribute tasks among multiple agents, completing the multi-agent system. 【Key Takeaways】 - **LLMs express intent but cannot act** (Opening): The fundamental limitation that motivates LLM agents—systems that orchestrate tool-call execution and planning loops around a backbone LLM. - **Tool-calling is the core capability enabling agency** (Early): LLMs generate structured tool-call requests (often JSON) from textual tool descriptions; the agent processes these requests and returns results for synthesis. - **Planning is iterative, not one-shot** (Early): Agents synthesize prior step results to adapt plans throughout task execution, enabling course-correction and early termination when tasks complete. - **A standardized tool interface is essential infrastructure** (Middle): The `BaseTool` class with `name`, `description`, `parameters_json_schema`, and `__call__()` standardizes how tools are described, invoked, and results packaged. - **Tool calls need structured input/output contracts** (Middle): `ToolCall` (id, tool_name, arguments) and `ToolCallResult` (tool_call_id, content, error) formalize the request-response cycle between LLM and tool execution. - **Python functions can become LLM tools** (Middle): The framework provides subclasses that wrap ordinary Python functions into tools conforming to the `BaseTool` interface, lowering the barrier to tool creation. - **MCP and A2A are the interoperability standards** (Opening): MCP standardizes third-party tool access; A2A standardizes agent-to-agent collaboration across different frameworks—both are central to the book's build. - **Multi-agent systems excel at task decomposition** (Early): Specialized agents outperform general-purpose ones when complex tasks can be broken into focused sub-tasks, such as front-end and back-end coding agents. 【Reading Tips】 - **Deep-read Chapters 1–2**: These establish the conceptual foundation (agent definition, planning, tool-calling) and the first concrete build stage (tool infrastructure). The mental model of the processing loop is referenced throughout later chapters. - **Follow along with the GitHub repository**: The book provides executable notebooks (e.g., `ch02.ipynb`) and a dedicated virtual environment. Running the code is essential for understanding the framework's design decisions. - **Skim the application survey in Chapter 1 if you're already familiar**: The sections on deep research, Agentic RAG, coding agents, and computer use are motivational context; the core value is in the build chapters. - **Pay attention to UML diagrams and class relationships**: The `BaseTool` inheritance model and the `ToolCall`/`ToolCallResult` contracts are the architectural backbone that later MCP and A2A integrations will extend. - **Take away the design-decision rationale**: The book emphasizes why certain abstractions exist (e.g., standardizing tool execution), which helps you adapt the framework for your own use cases. 【Coverage Limits】 This guide covers the opening through middle portions of the book based on available excerpts; the late and ending stages (MCP integration, human-in-the-loop, memory, and full A2A implementation) are described only from the blurb and are not detailed in the source material.
Excerpt 1
ch I have used extensively and even contributed to building. In fact, assuming some prior familiarity with LLMs and having past experiences programming with...
View in text
Excerpt 2
iding controls to entire applications, such as web browsers. With computer-use applications, the LLM agents can even be given control of the entirety of the...
View in text
Excerpt 3
requests through a structured output, such as a JSON format. For example, and in continuation with our task to find the best-value croissants in New York Cit...
View in text
Excerpt 4
ould accept the previously created ToolCall object as input. After the tool’s logic is executed, the result is then packaged into a ToolCallResult object, wh...
View in text
Excerpt 5
r set to False , as the following code snippet demonstrates. # Included in examples/ch02.ipynb #A from llm_agents_from_scratch.data_structures.tool import To...
View in text
Excerpt 6
esult: """Execute the tool call.""" x = tool_call.arguments.get("x") if x % 2 == 0: result = x // 2 else: result = (x * 3) + 1 return ToolCallResult( tool_ca...
View in text
Excerpt 7
able to execute in its entirety by the end of this chapter. Specifically, we’ll learn how to elicit a tool-call request from an LLM and how to submit the res...
View in text
Excerpt 8
Python terminology is analogous to the @classmethod concept. You can interpret from_tool_call_result () as a method that creates a ChatMessage object from a...
View in text
Tags
AI categories
Artificial IntelligenceProgrammingSoftware
ISBN: 1633434664
Publish Year: 2025
Language: English
Pages: 325
File Format: EPUB
File Size: 6.4 MB