Overview

1 The rise of AI agents

AI agents represent the shift from LLM systems that merely respond to prompts toward systems that can pursue goals, plan multi-step work, use tools, and adapt based on results. The chapter frames an agent as software that perceives context, decides what to do, and acts to achieve an objective, distinguishing agents from assistants mainly by autonomy. Assistants can use tools but generally require user approval step by step, while agents can reason, plan, and execute across a higher-level goal, with human oversight still needed for risky or irreversible actions.

The chapter explains the basic operating pattern behind agentic systems: agents sense input and context, plan tasks, act through tools, and learn from results. Tools are central because they let agents interact with APIs, databases, applications, knowledge stores, and other external resources. The Model Context Protocol is introduced as a major development that standardizes how agents discover and call tools through reusable external servers, reducing the need for custom per-agent integrations while raising important concerns around authentication, authorization, trust, and least-privilege execution.

The chapter also presents agents as layered systems built from persona, actions and tools, reasoning and planning, knowledge and memory, and evaluation and feedback. These layers shape an agent’s role, capabilities, planning style, access to context, and ability to judge or improve its work. Finally, the chapter broadens from single agents to multi-agent systems, showing why teams of agents are useful for specialization, parallelism, context management, and inherently multi-actor problems. It outlines common coordination patterns such as assembly-line flows, hub-and-spoke orchestration, and collaborative teams, emphasizing that added capability must be balanced against cost, latency, complexity, and control.

Common patterns for directly communicating with an LLM or an LLM with tools. If you’ve used earlier versions of ChatGPT, you experienced direct interaction with the LLM. No proxy agent or other assistant interjected on your behalf. Today, ChatGPT itself has plenty of tools it uses to help respond from web search, coding and so on, making the current version function like an assistant.
Top: an assistant performs a single or multiple tasks on behalf of a user, where each task requires approval by the user. Bottom: An agent may use multiple tools autonomously without human approval to complete a goal,
The four-step process agents use to complete goals: –Sense (receive input – goal or feedback) -> Plan (define the task list that completes the goal) -> Act (execute tool defined by task) -> Learn (observe the output of the task and determine if goal is complete or process needs to continue) ->
For an agent to use a tool, that tool must first be registered with the agent in the form of a JSON description/definition.l Once the tool is registered, the agent uses that tool in a process not unlike calling a function in Python.
An agent connects to an MCP server to discover the tools it hosts and the description of how to use each tool. When an MCP server is registered with an agent it internally calls list_tools to find all the tools the server supports and their descriptions. Then, like typical tool use internally, it can determine the best way to use those tools based on the respective tool description.
the five functional layers of agents – Persona, Actions & Tools, Reasoning & Planning, Knowledge & Memory, and Evaluation & Feedback
The Persona layer of an agent is the core layer, consisting of the system instructions that define the role of the agent, and how it should complete goals and tasks. It may include how to reason/plan and access knowledge and memory
The role of Actions & Tools within the agent, and how tools can also help power the other agent layers. Tools are a core extension of agents but are also fundamental to the functions used in the upper agent layers
The Reasoning & Planning of agents and how agentic thinking may be augmented. Reasoning may come from many forms, from the underlying model powering the agent, to prompt engineering and even through the use of tools
The Knowledge & Memory layer and how it interacts with and uses the same common forms of storage across both types. Agent knowledge represents information the LLM was not initially trained with but is later augmented. Likewise, memories represent past experiences and interactions of the user, agent or even other systems.
The Evaluation & Feedback layer and the mechanisms used to provide them. From tools which may help evaluate tool use, knowledge retrieval (grounding) and provide feedback, to other agents and workflows that provide similar functionality
The agent flow pattern of assembly with multiple agents. The flow starts with a planning agent that breaks down the goal into a high-level plan that it then passed to the research agent, which may execute the research tasks on the plan and after completing will pass to the content agent, which is responsible for completing the later tasks of the plan, such as writing a paper based on the research
The agent orchestration pattern, often referred to as hub-and-spoke. In this pattern, a central agent asks as the hub or orchestrator to delegate tasks to each of work agents. Worker agents complete their respective tasks and return them to the hub, which determines when the goal is complete and outputs the results.
A team of collaborative agents. The agent collaboration pattern allows agents to interact as peers to allow back and forth communication from one agent to another. In some cases, a manager agent may work as a user proxy and help keep collaborating agents on track

Summary

  • An AI agent has agency, the ability to make decisions, undertake tasks, and act autonomously on behalf of someone or something, powered by large language models connected to tools, memory, and planning capabilities.
  • An agents agency provides them the ability to process with an autonomous loop called Sense-Plan-Act-Learn process.
  • Assistants use tools to perform single tasks with user approval, while agents have the agency to reason, plan, and execute multiple tasks independently to achieve higher-level goals.
  • The four patterns we see LLMs being used in include: direct user interaction with LLMs, assistant proxy (reformulating requests), assistant (tool use with approval), and autonomous agent (independent planning and execution).
  • Agents receive goals, load instructions, reason out plans, identify required tools, execute steps in sequence, and return results, all while making autonomous decisions.
  • Agents use actions, tool functions (extensions that wrap API calls, databases, and external resources) to act beyond their code base and interact with external systems.
  • Model Context Protocol (MCP), developed by Anthropic in November 2024, serves as the "USB-C for LLMs," providing a standardized protocol that allows agents to connect to MCP servers, discover available tools, and use them seamlessly without custom integration code.
  • MCP addresses inconsistent tool access, unreliable data responses, fragmented integrations, code extensibility limitations, implementation complexity, and provides easy-to-build standardized servers.
  • AI Agent development can be expressed in terms of five functional layers: Persona, Tools & Actions, Reasoning & Planning, Knowledge & Memory, and Evaluation & Feedback.
  • The Persona layer represents the core role/personality and instructions an agent will use to undertake goal and task completion.
  • The Tools & Actions layer provides the agent with the functionality to interact and manipulate the external world.
  • The Reasoning & Planning layer enhances an agent's ability to reason and plan through complex goals that may require trial-and-error iteration.
  • The Knowledge & Feedback layer represents external sources of information that can augment the agent’s context with external knowledge or relate past experiences (memories) of previous interactions.
  • The Evaluation & Feedback layer represent external agent mechanisms that can assist in improved response accuracy, encourage goal/task learning and increased confidence in overall agent output.
  • Multi-agent systems include patterns such as Agent-flow assembly lines (sequential specialized workers), agent orchestration hub-and-spoke (central coordinator with specialized workers), and agent collaboration teams (agents communicating and working together with defined roles).
  • The Agent-Flow pattern (sequential assembly line) is the most straightforward multi-agent implementation where specialized agents work sequentially like an assembly line, ideal for well-defined multi-step tasks with designated roles.
  • The Agent Orchestration pattern is a hub-and-spoke model where a primary agent plans and coordinates with specialized worker agents, transforming single-agent tool use into multi-agent delegation.
  • The Agent Collaboration pattern represents agents in a team-based approach. Agents communicate with each other, provide feedback and criticism, and can solve complex problems through collective intelligence, though with higher computational costs and latency.
  • AI agents represent a fundamental shift from traditional programming to natural language-based interfaces, enabling complex workflow automation from prompt engineering to production-ready agent architecture.

FAQ

What is an AI agent?

An AI agent is software that perceives its environment, decides what to do, and takes action to achieve a goal, typically using the reasoning and language capabilities of an LLM. Unlike a simple chatbot that only responds to prompts, an agent can work through multi-step tasks such as booking travel, updating a project tracker, performing research, or interacting with external tools.

How is an agent different from a traditional AI assistant?

The main difference is autonomy. An assistant can use tools on behalf of a user but usually requires approval for each action. An agent works toward a higher-level goal, reasons about what steps are needed, selects tools, executes tasks, and may only ask for approval at important milestones or for high-stakes actions. In practice, the boundary is a spectrum, and production agents often use human-in-the-loop controls for safety.

What does “agentic” mean?

“Agentic” describes systems or behaviors that exhibit agency: the ability to perceive, decide, and act with some degree of autonomy in pursuit of a goal. In engineering terms, an agentic system is not just producing text; it is using patterns such as planning, tool use, observation, and revision to complete work.

What are the four common LLM interaction patterns?

The chapter describes four patterns: direct LLM chat, tool-augmented LLMs, assistants, and agents. Direct LLM chat only generates text. Tool-augmented LLMs can invoke a tool for a specific task, such as image generation or web search. Assistants can use tools with user approval for each action. Agents operate with higher autonomy, taking a user’s goal and deciding the steps needed to complete it.

What is the Sense, Plan, Act, Learn cycle?

The Sense, Plan, Act, Learn cycle is a basic model for how agents complete goals. The agent first senses input, such as a user goal or feedback. It then plans the tasks needed to reach the goal. Next, it acts by executing tools or actions. Finally, it learns by observing the results, deciding whether the goal is complete, and revising the plan if needed.

Why are tools important for AI agents?

Tools allow agents to act outside the LLM itself. They may wrap APIs, databases, external applications, file systems, web search, calendars, messaging systems, or other services. By using tools, agents can complete real tasks such as retrieving information, sending messages, booking flights, querying data, or updating records. Tool failures must also be handled carefully through retries, fallbacks, user clarification, or task abandonment.

What is the Model Context Protocol (MCP)?

The Model Context Protocol, or MCP, is an open standard developed by Anthropic and released in November 2024. It is based on JSON-RPC 2.0 and lets AI systems connect to external services in a consistent, secure, and reusable way. MCP allows agents to discover and use tools hosted by external MCP servers instead of requiring every agent developer to build custom tool wrappers inside each agent codebase.

Why is MCP described as “USB-C for LLMs and agents”?

MCP is often compared to USB-C because it provides a standard way for agents and LLMs to connect to tools and resources. It helps solve problems such as inconsistent tool access, unreliable response formats, fragmented integrations, limited language support, and repeated tool implementation work. With MCP, developers can connect to a server, discover available tools with list_tools, and let the agent decide which tools to use.

What are the five functional layers of an agent?

The five functional layers are Persona, Actions & Tools, Reasoning & Planning, Knowledge & Memory, and Evaluation & Feedback. Persona defines the agent’s role, instructions, and communication style. Actions & Tools let the agent perform tasks. Reasoning & Planning helps the agent decide what to do. Knowledge & Memory provide relevant information and past context. Evaluation & Feedback help assess and improve the agent’s outputs and actions.

When should developers use multi-agent systems?

Multi-agent systems are useful when a single agent becomes limited by scale, scope, context size, or complexity. They support specialization, parallelism, context management, and problems that naturally require multiple actors. Common patterns include agent-flow assembly lines, hub-and-spoke orchestration, and collaborative teams of agents. The best pattern is usually the simplest and cheapest one that satisfies the task requirements.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • AI Agents in Action, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • AI Agents in Action, Second Edition ebook for free