BrainBank

AI Agents in Action (2nd Edition) | AI Agents in Action · Second Edition

7/19/2026, 7:57:33 PM · Source

#ai-agents#mcp#multi-agent#step-by-step#llm#rag

This book is the Chinese translation of the second edition of *AI Agents in Action*, systematically guiding developers from LLM fundamentals to integrate the MCP protocol, test-driven development (TDAD), and metacognition to build production-grade agent systems capable of solving real-world problems.

This project is the Chinese translation of the classic book AI Agents in Action (Second Edition) published by Manning Publications. This book is a practical guide focusing on the construction and application of agent systems. Its core goal is not only to build autonomous entities, but also to develop production-grade agents that can practically address and solve real-world business problems.

GitHub Repository CoverGitHub Repository Cover


Book Introduction and Version Evolution

Starting from the basic applications of Large Language Models (LLMs), the book progressively dives deeper into building intelligent assistants, multi-agent systems, and autonomous agents, systematically explaining the key components of agent systems: persona, tools and actions, knowledge and memory, retrieval and augmentation, reasoning and planning, evaluation and feedback.

Key Changes Between the Second Edition and the First Edition

The second edition of this book is almost a complete rewrite, rather than a minor revision based on the first edition. The specific evolutionary directions include:

  • Substantial Content Updates: Nine new chapters focusing on current engineering practices have been added, outdated content has been removed, and the remaining chapters have been comprehensively reconstructed using the latest tools and protocols.
  • Structural Refactoring: The "five functional layers" concept proposed in the first edition is more formalized in the second edition, serving as the core organizing principle of the first half starting from Chapter 1.
  • Focus on Practical Implementation: The first edition focused on explaining the underlying concepts that enable agents; the second edition aligns with the trends of industry frameworks, bypassing tedious internal implementation details to focus on how to build agent systems that can go straight into production.
  • Introduction of Cutting-edge Topics: Dedicated chapters introduce the MCP protocol (Model Context Protocol) and Docker distributed orchestration and deployment, with deep coverage of advanced topics such as multi-agent workflows, Test-Driven Agent Development (TDAD), RAG agents, deep research agents, agent loops, and metacognition.

Chapter Table of Contents and Overview

Part 1: Foundations & Core Components

  • Chapter 1: The Rise of AI Agents
    • Definition of agents and agentic thinking
    • Introduction to the Model Context Protocol (MCP)
    • The five functional layers that make up an agent
    • Evolution from single assistants to complex agent systems
  • Chapter 2: Core Components: LLMs, Prompts, and Agents
    • The nature of LLMs as probabilistic token machines
    • Precisely controlling LLM outputs through prompt engineering
    • Building agents using the OpenAI Agents SDK
    • Enhancing agent capabilities through tools integration

Part 2: MCP & Multi-Agent Systems

  • Chapter 3: MCP Operations for AI Agents
    • Deep dive into MCP architecture: clients, servers, and services
    • Getting started and working with MCP servers
    • Building custom MCP servers
    • Enabling seamless agent interaction with external systems
  • Chapter 4: Architecting and Building Multi-Agent Systems
    • Basic architectures of flows, orchestration, and collaboration
    • Balancing the relationship between "agents" and "agent flows"
    • Managing handovers between agents
    • Validating agent flow safety using guardrails

Part 3: Core Agent Capabilities

  • Chapter 5: Agent Reasoning and Planning
    • Chain of Thought (CoT) and ReAct paradigms
    • Guiding agents through multi-step reasoning and long-term planning
    • Detailed explanation of advanced planning strategies
    • Leveraging Sequential Thinking MCP servers to enhance autonomous problem-solving capabilities
  • Chapter 6: Handling Memory and Knowledge RAG for Agents
    • Ingesting external documents using vector databases and similarity search
    • Using retrieval mechanisms as dynamic knowledge sources for agents
    • Using retrieval mechanisms as long-term memory sources for agents
    • Recalling and tracing past interaction histories through MCP
  • Chapter 7: Building Robust Agents through Evaluation and Feedback
    • The Test-Driven Agent Development (TDAD) process
    • Collaboration between Grounding Agents and Critic Agents
    • Comprehensive evaluation and feedback using the Phoenix framework
    • Practical methods for building production-grade reliable agents

Part 4: Deployment & Advanced Topics

  • Chapter 8: Deploying Agents and Agent Systems
    • Seamlessly embedding agents into existing applications
    • Exposing agents as microservices
    • Deploying agent systems to distributed production environments using Docker
    • Key considerations for security, safety, and compliance governance
  • Chapter 9: Understanding Agent Loops
    • Inner SPAL loops, outer task loops, and meta-loops
    • Building deep research agents
    • Implementing multi-agent orchestration loops
    • Building autonomous, collaborative agent loops
  • Chapter 10: Exploring Cognitive Agents That Think, Monitor, and Adapt
    • Introducing cognition and metacognition as agent engineering concepts
    • Mapping cognitive science theories to cognitive agent architectures
    • Implementing metacognitive processes
    • Enabling agents to think about their own thinking, monitor performance, and autonomously adapt strategies
  • Chapter 11: Practical Tips for Building Agent Systems
    • Summary of practical experiences organized by the five agent layers
    • Customer Support Agent role guidelines
    • RAG agent system design patterns
    • Deep research agent blueprints and comprehensive practical examples

Appendices

  • Appendix A: Setting up the sample code repository
  • Appendix B: Setting up the Node.js environment for local MCP servers

How to Use This Project

Local Reading and Preview

You can read this project directly online, or clone the repository and start a preview service locally:

# 方式一(推荐,macOS/Linux 自带 Python)
python3 -m http.server 3000

# 方式二(需 Node.js 环境)
npx serve -l 3000 .

After starting, open http://localhost:3000/ in your browser to begin reading.

🎯 Target Audience

  • AI Engineers: Learn how to build, test, and deploy production-grade AI agent systems.
  • Software Developers: Quickly master the core technology stack of agent development (such as the MCP protocol, LangChain, SDKs).
  • Product Managers: Gain a deep understanding of the technical boundaries, practical implementation capabilities, and industry application scenarios of agents.
  • Researchers: Explore cutting-edge architectures such as cognitive agents, multi-agent collaboration, and metacognitive control.
  • University Students: Systematically master the complete path of AI agents from theory to industry practice.

📚 Reading Suggestions

  1. Step-by-Step: It is recommended to read the chapters in order, as the foundational functional layers and component introductions in the early stages are the cornerstones for subsequent advanced chapters.
  2. Hands-on Practice: Each chapter in the book is equipped with abundant practical code. Readers are highly encouraged to run and debug it in their local environment.
  3. Bilingual Comparison: For complex or emerging professional technical terms, it is recommended to compare them with the original English version for better understanding.
  4. Desktop Reference: When actually developing agent projects, this book can serve as a systematic reference manual for architectural design and patterns.

Contribution Guidelines and Copyright Information

🔍 Getting Involved

We welcome developers from the Chinese AI community to join us in improving this project! You can participate in the following ways:

  1. Bug Reports: Point out typos, translation omissions, or typesetting issues in the translation.
  2. Translation Improvements: Provide more natural Chinese expressions for obscure or difficult professional terms and sentences.
  3. Proofreading & Review: Assist in quality control for already translated chapters.
  4. Terminology Building: Propose and discuss the unified translation of industry-standard terms in Issues.

Contribution Steps: Fork this repository \rightarrow Create a feature branch git checkout -b feature/your-contribution \rightarrow Commit changes git commit -m 'Add: your contribution' \rightarrow Push to branch git push origin feature/your-contribution \rightarrow Create a Pull Request.

📄 Copyright and Disclaimer

  • Original Book Copyright: The copyright of the original book AI Agents in Action, Second Edition belongs to the author Michael Lanham and Manning Publications. We recommend that readers who are able to do so purchase the genuine original book to support the author.
  • Translation Copyright: This translation project is open-sourced under the CC BY-NC 4.0 (Attribution-NonCommercial 4.0 International) license. This translation is for personal learning and academic exchange only, and any form of commercial use is strictly prohibited.
  • Disclaimer: This project is an unofficial community translation and does not represent the official stance of the original author or Manning Publications. If there is any infringement, please contact us for removal.

🔗 Related Resources


Key takeaways

  • From Theory to Production: The book is no longer limited to popular science introductions of agent concepts, but shifts entirely toward industrial-grade implementation, offering a complete engineering loop from local testing (TDAD) to distributed deployment (Docker).
  • The Five Functional Layers Skeleton: Based on five core layers—"persona, tools and actions, knowledge and memory, reasoning and planning, evaluation and feedback"—the book deconstructs standard methods for building complex agent systems.
  • Staying Close to the Latest Tech Ecosystem: It introduces the Model Context Protocol (MCP) as a core protocol for agent interaction for the first time, providing standardized solutions for external data and tool invocations.
  • Cognitive and Metacognitive Systems: It introduces cognitive science theories to design high-level cognitive agents capable of "thinking about their own thinking, self-monitoring, and adaptively adjusting strategies" (Cognitive Agents).

Learning map

Phase 1: Foundations and Core Components

  • Large Language Models and Prompt Engineering: Understand the probabilistic token generation principles of LLMs, and master techniques for controlling LLM outputs using prompt engineering.
  • Five Functional Layers Architecture: Systematically study the five functional layers that constitute an agent (Persona, Tools & Actions, Knowledge & Memory, Retrieval & Augmentation, Reasoning & Planning).
  • OpenAI Agents SDK Practice: Learn to build basic agents using the official SDK, and master basic methods for tool integration.

Phase 2: Protocol Connection and Multi-Agent Systems

  • Model Context Protocol (MCP): Learn the architecture of the MCP protocol (clients, servers, services), and explore how to seamlessly and securely connect agents to external data and tools.
  • Multi-Agent Workflow Orchestration: Master the flows, orchestration, and collaboration architectures of multi-agent systems, and learn how to securely manage task handoffs and flow-control guardrails between agents.

Phase 3: Deepening Core Capabilities

  • Reasoning, Planning, and RAG Memory: Deeply master Chain-of-Thought (CoT) and ReAct paradigms, and learn to utilize vector databases, similarity search, and MCP to achieve short-term and long-term interactive memory for agents.
  • Test-Driven Agent Development (TDAD) and Evaluation: Learn to introduce critic agents and use tools like Phoenix for comprehensive evaluation to ensure the stability of agent operations.

Phase 4: Deployment and Advanced Cognitive Architectures

  • Production-Grade Deployment: Master the techniques of exposing agents as microservices, and use Docker for distributed containerized deployment.
  • Cognition and Metacognition: Explore agent loops (SPAL loop, meta-loop), and design cognitive agents capable of monitoring their own performance, reflecting on their own thinking, and adaptively adjusting strategies.

Get hands-on — step by step

  1. Clone the project and prepare the local environment: Open your terminal, clone the GitHub repository for the "AI Agents in Action" Chinese translation project, and enter the project directory:

    git clone https://github.com/yixiangshijie/ai-agents-in-action-2nd-edition-cn.git
    cd ai-agents-in-action-2nd-edition-cn
    
  2. Start the local reading and preview service: To deploy and preview the e-book locally, you can choose any of the following methods to run the local service:

    # 方式一:使用 Python 3 内置服务器(推荐,跨平台)
    python3 -m http.server 3000
    
    # 方式二:使用 Node.js 的 serve 模块
    npx serve -l 3000 .
    

    Once started, open http://localhost:3000/ in your browser to begin systematically reading the tutorials from Chapters 1 to 11.

  3. Explore the MCP protocol and multi-agent practical code: Visit the supporting code repository (https://github.com/yixiangshijie/AI-Agent-Workflows). According to Appendix A and B of the book, configure Node.js and run the local MCP server, then connect to the MCP service in your Python code to enable agents to interact with local files and databases through read and write operations.

Top 3 sources

  1. 1
    AI Agents in Action (2nd Edition) 中文译本 GitHub

    本书的中文翻译开源项目,提供了完整的智能体开发知识体系及前沿主题翻译。

    https://github.com/yixiangshijie/ai-agents-in-action-2nd-edition-cn

  2. 2
    Manning - AI Agents in Action, Second Edition

    Manning 出版社的原书英文官网,可获取最新出版章节、原版配套资源与专家社区讨论。

    https://www.manning.com/books/ai-agents-in-action-second-edition

  3. 3
    Model Context Protocol (MCP) 官方文档

    Anthropic 官方推出的 MCP 协议标准文档,是本书第二部分核心介绍的智能体连接外部世界的核心协议。

    https://modelcontextprotocol.io

Links are AI-suggested — worth a quick sanity check before diving in.