liveBook · Manning

What you will learn in AI Agents in Action, Second Edition

Intelligent workflows with LLMs, MCP, A2A, and more

by Micheal Lanham

Chapter by chapter

Chapter 1: The rise of AI agents

The introduction distinguishes response-generating LLM apps from AI agents that can decide and act toward goals.

1.1 Defining agents and agentic thinking · 1.1.1 Understanding agent, assistant, and LLM patterns · 1.1.2 Thinking like agents: Sense-plan-act-learn · 1.1.3 Agents act with tools · 1.2 Introducing the Model Context Protocol · 1.3 Understanding the five functional layers of an agent · 1.3.1 The agent persona · 1.3.2 Agent tools and actions · 1.3.3 Agent reasoning and planning · 1.3.4 Agent knowledge and memory · 1.3.5 Agent evaluation and feedback · 1.4 Advancing to multi-agent systems · 1.4.1 The agent flow assembly line · 1.4.2 Agent orchestrations (hub-and-spoke) · 1.4.3 Agent collaboration (teams of agents) · 1.5 Next steps · 1.6 Summary

What you learn in chapter 1 →

Chapter 2: Core components: Large language models, prompting, and agents

The chapter introduction identifies the roles of the LLM, prompting, and OpenAI Agents SDK in an agent’s core architecture.

2.1 Understanding large language models · 2.1.1 LLMs: Probabilistic token machines · 2.1.2 What is a token? · 2.1.3 Tuning temperature, top-p, and more · 2.2 Controlling LLMs with prompt engineering (agent persona) · 2.2.1 Applying core prompt techniques · 2.2.2 Thinking like an LLM · 2.2.3 Avoiding common prompt pitfalls · 2.3 Building an agent with OpenAI Agents · 2.3.1 Building a minimal agent · 2.3.2 Setting the agent model and other parameters · 2.3.3 Controlling inputs and typed outputs · 2.3.4 Tracing agents · 2.4 Enhancing agents through tool integration · 2.4.1 Providing agents with tools · 2.4.2 Tracing agentic tool use · 2.5 Exercises · 2.6 Summary

What you learn in chapter 2 →

Chapter 3: Actions with Model Context Protocol for AI agents

The introduction presents MCP as a standard way to connect agents with tools and describes how agent workflows can themselves be offered as reusable tools.

3.1 Understanding MCP fundamentals for agent development · 3.1.1 The standardization problem MCP solves · 3.1.2 MCP architecture: Clients, servers, and services · 3.1.3 Core components: Tools, resources, and prompts · 3.1.4 MCP deployment patterns for agents · 3.1.5 MCP powers the functional agent layers · 3.2 Getting started with MCP servers · 3.2.1 Coding up an MCP server for Claude · 3.2.2 Using the MCP inspector · 3.2.3 Understanding MCP transport types · 3.2.4 From desktop to agents: The key differences · 3.3 Using MCP servers for agents · 3.3.1 Using agents with local MCP servers over STDIO · 3.3.2 Using local MCP servers over SSE with agents · 3.3.3 Connecting to the standard MCP servers · 3.4 Building MCP servers for agents · 3.4.1 Converting tools to an MCP server · 3.4.2 Consuming MCP servers locally or remotely · 3.5 Exercises · 3.6 Summary

What you learn in chapter 3 →

Chapter 4: Architecting and building multi-agent systems

The chapter introduction explains why multi-agent design shifted from simply adding agents toward structuring their roles, while noting the tradeoff between single-agent simplicity and capability.

4.1 Architecting multi-agent systems · 4.1.1 Decision-making and control patterns · 4.1.2 Communicating with shared memory, message passing, and MCP · 4.1.3 Channeling multi-agent coordination strategies · 4.2 Balancing agents with agentic flows · 4.2.1 Transforming agents to agent flows · 4.2.2 Building an agent-to-agent flow · 4.2.3 Agency and decision-making in agent flows · 4.3 Understanding handoffs in agent flows · 4.3.1 Agent-to-agent flow with handoffs · 4.3.2 Visualizing agent flows · 4.3.3 Monitoring the handoff · 4.4 Validating agent flows with guardrails · 4.4.1 Implementing input and output guardrails · 4.4.2 Using agents as guardrails · 4.4.3 Adding guardrails for pass-off agent flows · 4.5 Exercises · 4.6 Summary

What you learn in chapter 4 →

Chapter 5: Agent reasoning and planning

Introduces decomposition and planning as distinct, necessary parts of LLM reasoning and explains why distinguishing their failures matters for agents.

5.1 Understanding LLM reasoning and planning · 5.1.1 Chain-of-thought reasoning · 5.1.2 Reasoning, acting, observing: The ReAct paradigm · 5.1.3 Planning with LLMs · 5.2 Instructing agents to reason and plan · 5.2.1 Applying CoT to an agent · 5.2.2 Implementing ReAct with agents · 5.3 Advanced reasoning patterns with agents · 5.3.1 Tree-of-thought · 5.3.2 Reflexion · 5.3.3 Selecting the right pattern for your agents · 5.4 Utilizing the sequential thinking MCP server · 5.4.1 Unchaining the sequential thinking server · 5.4.2 Revisiting time travel problems with sequential thinking · 5.4.3 Advanced reasoning with sequential thinking · 5.5 Exercises · 5.6 Summary

What you learn in chapter 5 →

Chapter 6: Working with memory and knowledge RAG for agents

The introduction explains why agents need retrieval for external information and memory for their own past experiences.

6.1 Understanding retrieval in AI applications · 6.1.1 The basics of RAG · 6.1.2 Delving into semantic search and document indexing · 6.1.3 Applying vector similarity search · 6.2 Vector databases and similarity search · 6.2.1 Demystifying document embeddings · 6.2.2 Querying document embeddings from Chroma DB · 6.3 Building practical RAG knowledge agents · 6.3.1 Everything begins with search and relevance · 6.3.2 Building a vector search RAG agent · 6.3.3 Building a hybrid search RAG agent · 6.4 Adding memory to agents with MCP · 6.4.1 Understanding memory form and agent function · 6.4.2 Attaching a graph database for memory using MCP · 6.4.3 Creating hybrid memory systems with MCP · 6.4.4 Semantic augmented memory and applications to semantic, episodic, and procedural memory · 6.4.5 Uncluttering memory with compression and forgetting · 6.5 Exercises · 6.6 Summary

What you learn in chapter 6 →

Chapter 7: Building robust agents with evaluation and feedback

The introduction explains why evaluation and feedback matter for robust agents, what kinds of signals they provide, and why they should be considered throughout development.

7.1 Introducing agent evaluation and feedback · 7.2 Implementing test-driven agent development · 7.2.1 Exploring TDAD in practice · 7.2.2 Coding and testing the RAG agent · 7.2.3 Refactoring the agent · 7.2.4 Extending evaluation with an agent evaluator · 7.3 Employing grounding, critic, and evaluation agents · 7.3.1 Reviewing the grounding agent · 7.3.2 Grounding the RAG agent · 7.3.3 Implementing grounding agents as guardrails · 7.3.4 Understanding the role of rubrics in evaluation · 7.3.5 Building a rubric critic agent · 7.4 Phoenix for evaluation and feedback · 7.4.1 Connecting to Phoenix · 7.4.2 Adding metadata and session tracking · 7.4.3 Experimenting with evaluators · 7.4.4 Providing feedback with annotations · 7.5 Exercises · 7.6 Summary

What you learn in chapter 7 →

Chapter 8: Deploying agents and agentic systems

The introduction frames deployment as a choice among ways to make an agent available, from embedding it in an application to using containers.

8.1 Strategies for consuming agents · 8.1.1 Embedding real-time voice agents into web applications · 8.1.2 Hosting agents through an API · 8.1.3 Consuming an agent web service in a web application · 8.2 Dockerizing agent systems · 8.2.1 Containerizing an agent microservice · 8.2.2 Orchestrating agentic systems with Docker Compose · 8.2.3 Externalizing local agent microservices · 8.3 Considering advanced deployment strategies · 8.3.1 Choosing a runtime: Edge, API, or event-driven · 8.3.2 The three “wires” of communication · 8.3.3 Practical multi-agent topologies that adapt well · 8.3.4 State, memory, and idempotency · 8.3.5 Release engineering for agents (prompts, tools, models) · 8.3.6 Observability matters · 8.3.7 Reliability patterns: Timeouts, fallbacks, and budgets · 8.3.8 Cost control and model routing · 8.4 Security, safety, and governance in production · 8.4.1 A quick threat model for agentic systems · 8.4.2 Identity and access for people, services, and agents · 8.4.3 Secrets and configuration management · 8.4.4 Tool safety: Sandboxing and egress control · 8.4.5 Prompt-injection and data-exfiltration defenses · 8.4.6 Safety and policy enforcement · 8.5 Exercises · 8.6 Summary

What you learn in chapter 8 →

Chapter 9: Understanding the agentic loop

The introduction distinguishes the familiar internal SPAL loop from broader agentic looping used for long-horizon goals and multi-agent collaboration.

9.1 Peeling back the three agentic loop layers · 9.1.1 Layer 1: The inner loop (sense-plan-act-learn) · 9.1.2 Layer 2: The task loop · 9.1.3 Layer 3: The meta loop · 9.2 Layer 2: Looping with a deep research agent · 9.2.1 Creating the initial state and plan · 9.2.2 Adding the tools · 9.2.3 Understanding iteration body output · 9.2.4 The termination gate · 9.2.5 Coding the deep research loop · 9.2.6 Synthesizing the final output · 9.2.7 When to use an agentic loop · 9.2.8 Building a repetitive task loop agent · 9.3 Layer 3: Multi-agent orchestration loops · 9.4 Building collaborative agentic loops · 9.5 Exercises · 9.6 Summary

What you learn in chapter 9 →

Chapter 10: Exploring the cognitive agent that thinks, monitors, and adapts

The introduction explains why capable agents need cognition and metacognition rather than simply more reasoning patterns.

10.1 Understanding agent cognition and metacognition as engineering concepts · 10.1.1 The five failure modes of capable-but-not-cognitive agents · 10.1.2 From reasoning primitives to cognitive architecture · 10.1.3 Defining cognition for agents · 10.1.4 Defining metacognition for agents · 10.1.5 Three theoretical foundations · 10.2 Mapping the mind into a cognitive agent architecture · 10.2.1 Architecture overview · 10.2.2 The cognitive workspace · 10.2.3 The perception module · 10.2.4 The planning module · 10.2.5 The execution module · 10.2.6 The evaluation module · 10.2.7 The attention module · 10.2.8 The memory module and the MCP memory server · 10.3 Building and running the cognitive agent · 10.3.1 The cognitive loop · 10.3.2 A complete cognitive agent with MCP · 10.3.3 Walkthrough: Watching the cognitive cycle in action · 10.3.4 Confidence-gated execution · 10.3.5 Stagnation detection and strategy pivoting · 10.3.6 Knowledge boundary awareness · 10.3.7 Emergent behaviors · 10.4 Measuring cognitive capability and looking ahead · 10.4.1 Cognitive efficiency metrics · 10.4.2 Before and after: Measuring the effect · 10.4.3 The road to more general agents · 10.5 Exercises · 10.6 Summary

What you learn in chapter 10 →

Chapter 11: Tips for building agentic systems

Introduces the chapter’s production-informed tips and previews guidance for customer support, RAG, and deep research agents.

11.1 Field-tested tips organized by the five agentic layers · 11.1.1 The core layer: Persona · 11.1.2 Tools and agent actions · 11.1.3 Reasoning and planning · 11.1.4 Knowledge and memory · 11.1.5 Evaluation and feedback · 11.2 Tips for building a customer support agent · 11.3 Tips for building a RAG agent system · 11.4 Tips for building a deep research agent system · 11.5 Summary

What you learn in chapter 11 →

Concepts explained in this book

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.