Jump to ratings and reviews
Rate this book

AI Agents in Action, Second Edition: Intelligent workflows with LLMs, MCP, A2A, and more

Rate this book
Get the eBook free when you register your print book at Manning.

"Great contents, broad coverage, fun exercises. This book has it all.” —Saurabh Sawant, Microsoft

AI Agents in Action, Second Edition is a substantial revision and update of the first edition. It is a practical and comprehensive guide to building AI agents—not just understanding what they are, but designing, implementing, evaluating, and deploying them. Its strength is in the way it combines conceptual clarity with working code examples, so readers build progressively rather than absorb isolated ideas. The examples form a continuous learning path, moving from a minimal agent to more capable, tool-using, multi-agent, and deployable systems. Each step adds a new skill while reinforcing what came before.

The book begins by giving readers a usable mental model for agent design. Its central organizing idea is the five functional persona, actions and tools, reasoning and planning, knowledge and memory, and evaluation and feedback. This framework helps readers understand where an agent’s behavior comes from and how to diagnose weaknesses. Rather than randomly adding prompts, tools, or memory, readers learn to ask which layer needs improvement. This is especially valuable because the model is not tied to one vendor or framework; it remains useful even as APIs and tools continue to change.

From there, the book moves into the practical building blocks of LLMs, prompting, typed outputs, tracing, tool use, and the OpenAI Agents SDK. Typed outputs reduce brittle text parsing. Tracing exposes what the agent is doing. Tool integration gives agents the ability to act rather than merely respond. The cumulative benefit is that readers learn to build agents that are more predictable, inspectable, and maintainable.

A highlight is the treatment of Model Context Protocol. Readers liked the book’s “USB-C” analogy, because it explains MCP as a standard connector between agents and external capabilities. The book shows how MCP can flatten “a mess of bespoke integrations” into cleaner, swappable components, helping developers build agents that are modular instead of tangled.

The book also covers multi-agent architectures, reasoning patterns, planning strategies, RAG, memory, evaluation, feedback, observability, and deployment. Each topic is tied to a practical multi-agent patterns help divide complex work; reasoning and planning help agents handle multi-step tasks; RAG and memory let agents use external and retained knowledge; evaluation and feedback help make them safer and more reliable.

Physically, this is a substantial but focused book covering 392 pages across 11 chapters. Its tables and figures are a valuable part of the learning experience. While building, readers will want to return to the easy-to-use tables summarizing complex trade-offs.

What’s new and included in the second edition?

A near-total rewrite with new and extensive coverage of the latest agent innovations Agents start to finish—from prompting and planning, to memory and evaluation New chapter! Evaluate agents with LLM-as-judge, test-driven-development, and observable behavior New chapter! Explore the agentic loop, build task-focused agents, and develop long-horizon, goal focused systems New chapter! Metacognition harnesses that structure agent thinking, planning, and learning New chapter! Practical tips and techniques for building AI applications, help desks, and deep research agents New chapter! Voice-driven AI agents, including real-world deployment patterns for multi-agent systems Multi-agent workflows with assembly-flow, orchestration, and collaboration patterns Hands-on with the Model Context Protocol (MCP) to connect agents to tools and servers Hybrid search for Retrieval Augmented Generation (RAG) and practical ways to use memory in agents
With more than 95% rewritten from the first edition, AI Agents in Action is far more than a refresh! You’ll go right from your agent’s first response, to systems that use tools, work together, draw on knowledge, and incorporate feedback. All illustrated with practical examples throughout.

What's inside

Autonomous agent design and deployment MCP-based tools, resources, prompts, memory, and server integrations Reasoning and planning patterns including ReAct, Reflexion, Tree-of- Thought, and Sequential Thinking
About the reader

For intermediate Python programmers. No experience with AI agents and agentic systems required.

About the author

Micheal Lanham is a software and technology innovator with over 20 years of industry experience. He has authored books on deep learning, including Manning’s Evolutionary Deep Learning.

Table of Contents

1 The rise of AI agents
2 Core componen...

391 pages, Paperback

Published July 14, 2026

Loading...
Loading...

About the author

Micheal Lanham

28 books5 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
5 (45%)
4 stars
5 (45%)
3 stars
1 (9%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 4 of 4 reviews
Profile Image for Jean Tessier.
168 reviews31 followers
November 4, 2026
"Intelligent workflows with LLMs, MCP, A2A, and more."

LLMs are a given to drive the agents. Agent-to-agent communication (A2A) is hinted at in many places, but the book does not provide concrete, detailed example.

I picked up this book because I wanted to better understand programming with AI agents and what was all the fuss about MCP. It did not disappoint on that front, though this is a rapidly evolving field and some bits are already outdated even as the book is just coming out.

The term agent can mean a lot of things. The book focuses on what it calls agentic systems.

It describes systems or behaviors that exhibit agency, the ability to perceive, decide, and act with some degree of autonomy in pursuit of a goal. (p. 2)


Tools

The early parts cover tools, how to define them, and how to use and reuse them in multiple agents. Tools are just code that the LLM can trigger as part of answering a query. When the tools are strongly typed, for example with parameter and return types or Zod schemas, the LLM can use them more effectively. But tools are code in the same language and executable that is calling the LLM. If two agents written in two different languages need the same tool, you need to provide an implementation of the tool in both languages.

This is where MCP comes in. You put the tools in a separate executable and use the Model Context Protocol to call them. The protocol is language agnostic. Now, you have a single implementation of the tool that is accessible by agents in different languages. The tools don't even have to be in one of the agents' languages. There are existing MCP servers for many common third-party services, like Slack or Notion or Google Calendar. You can run your own copy of the MCP server behind your firewall with your own access keys, or in some cases you can use public MCP servers maintained by these third-party services.

But all this comes at a cost. Tool descriptions, both internal tools and external tools in MCP servers, become part of the prompt to the LLM, using up precious context space and input tokens. An MCP server may want to expose many related tools, even if you only need one of them. If your organization has already standardized on a specific implementation language, it may be worth it to have a library of tools in that language and only add the ones you specifically need to any given agent.

Layered Model

The book uses a layered model to describe the various capabilities of agents. Agents have layers. At the core is the persona that guides the overall purpose of the agent, usually via the system prompt. Then, there are tools and descriptions of actions the agent can take. On top of that, the reasoning layer tells the agent how to iterate to solve a problem and what to do in each part of each iteration. Long-lived agents will use a memory layer to persist information across iterations or even across runs of the agent process. Finally, the more sophisticated agents with use a feedback layer to self-evaluate and double-check their work. Oftentimes, the functionality of each layer can be in separate cooperating agents. This keeps each agent small and dedicated to a single task, which is easier to reason about and debug.

An agent is a system built around an LLM, combining the model with tools, memory, orchestration logic, and the ability to interact with an environment. The LLM is the reasoning component. Everything else turns that reasoning into work that affects the world. (p. 139)


I have been building software systems for many, many years. I've been through design patterns and REST APIs and microservices. Each time, you specify the computing logic in a programming language with very precise syntax and idioms. I was surprised by the use of English natural language to tell the LLM what logic was expected.

Agents

All the code examples are in Python. While I don't particularly care for Python, its compact syntax makes it easy to read the code without getting lost in convoluted syntax. Since a lot of agents get they logic from natural language descriptions, it is useful to keep syntax and code to a minimum so they do not distract from the main point.

Here is a minimal example of an agent. It takes unstructured text as input and outputs unstructured text (hopefully Markdown).


research_agent = Agent(
name="Research Agent",
instructions="""
You are a research assistant.
Your role is to find research sources.
""",
)

goal = "..." # The prompt to the agent, what the user wants the agent to do

result = await Runner.run(research_agent, goal)


All the logic is in the 'instructions' string.

This example outputs unstructured text, but if we want to make decisions based on that output, it is better to require structured output using some type or some form of schema. For instance, if we want the agent to classify some data, it is better to require numerical scores as output so we can compare them to thresholds and decide what to do next.

If we want more complex behavior from the agent, we just extend the 'instructions' string and tell it what we're expecting and how to go about doing it.

Here is a later example:


agent = Agent(
name="Support",
instructions=("Use ONLY retrieved context; cite chunk ids; if absent
say 'I don't know'."),
tools=[retrieve, remember],
)


Coordination Patterns

The book describes many ways for agents to collaborate together: flow, hub-and-spokes, hierarchy. It talks about orchestration, when one agent explicitly drives the collaboration, versus collaboration, when there is no clear leader and coordination is an emergent property. It reminded me of the discussion of orchestration versus choreography with microservices and sagas, which also revolve on an explicit leader or emergent coordination.

Some of these discussions remained very high-level. I would have liked more concrete examples. Late in the book, some of the examples finally connect to the issue of coordination, but it is very late and hard to relate back to the discussion.

Miscellaneous Topics

There is a very good example of RAG and the different types of search. I liked the description of vector databases how they determine the proximity of topics. It compared it to other types of search using graph databases and relational databases.

The bit trying to relate agent "memory" to human cognitive neuroscience didn't land for me. Not sure why agent would care about "sensory memory" as opposed to image/video just being a different format of data. A lot of the integration is done in prompts, but the discussion lacks the subtleties of telling the LLM when to use what tool. (I guess that changes quickly as models evolve.)

The book does a better job when it maps failings or limitations of simpler agents to cognitive deficits. It uses theory from Minsky (Society of Mind about small agents collaborating together), Baars (Global Workspace Theory about how the agents communicate through a shared cognitive workspace), and Kahneman (System One, fast and automatic, versus System Two, slow and deliberate) to fill in the gaps. The book builds example where that exemplify these theories. I wonder if it might have been better to introduce these ideas near the beginning and reference them throughout the book. The author might have lost more pragmatic readers, though.

The final examples solve some sophisticated use cases, like customer support, RAG, and a research systems that can decide between multiple sources as needed.
Profile Image for Scott Pearson.
947 reviews47 followers
November 5, 2026
Agents are ushering in a new era in Artificial Intelligence (AI) whereby they accomplish tasks in the world electronically that mere chatbots cannot do. Through running specialized code, they can communicate with a main thread - and even with each other. In this book, now in a second edition, Micheal Lanham keeps technical folk up to date with the latest developments.

In training, educators drill into IT folks' heads to know how and why things work, not just that they work. This book shows how AI agents work through their integration with LLMs. It also shows how Model Context Protocol (MCP) communicates with servers that can achieve action.

In critique, this book lacks a depth that is found in other technical introductions to AI. It explains the lay of the land well by explaining how technologies work, but it doesn't explain how to architect and build an AI agent in too much detail. As such, it limits itself to IT staff and does not expand to the developer community as much.

Overall, it takes a village of books to learn about AI agentic technology, and this book does a great job of communicating that vocabulary. Again, it serves the purpose of informing AI technical staff about how and why things work. I just wish it would talk more to developers, coders, and designers about architecture.
7 reviews
July 19, 2026
Agentic applications are quickly becoming the foundation for building intelligent enterprise solutions that can drive significant productivity and business value. However, developing agentic applications is not simple. It requires a solid understanding of how different components such as MCP, memory, reasoning, RAG, tools, and orchestration fit together to create reliable and effective AI systems.

Building an agent is only one side of the coin. Deploying, monitoring, governing, and managing agents in production is equally important. Ignoring these aspects can lead not only to lost productivity but also financial costs, security risks, and reputational damage. Understanding when to use different models, how to avoid reasoning loops, how to manage agent behavior, and how to secure agents in enterprise environments becomes critical as organizations move from experimentation to real-world adoption.

This book does an excellent job of covering the foundations behind these concepts and presents them in a practical, easy-to-digest manner. The author explains both the technical building blocks and the operational considerations required to run agents successfully at scale. I particularly appreciated the focus on security, governance, and production readiness—topics that are often overlooked in many AI books but are essential for enterprise adoption.

Overall, anyone looking to understand what it takes to build agentic applications and successfully scale them from proof of concept to production will benefit from reading this book. Whether you are an architect, developer, engineering leader, or technology decision-maker, this book provides a solid foundation for navigating the rapidly evolving world of AI agents.
6 reviews1 follower
August 20, 2026
One and a single best resource for the hands-on deep dive in the hyping field of Agentic AI pipelines! I liked the in-depth coverage of the topic, and this book is nicely paired as a next logical step after another Manning book - Build Large Language Model from Scratch.
Displaying 1 - 4 of 4 reviews