Start free trial
Searching...
English
EnglishEnglish
EspañolSpanish
简体中文Chinese
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
Bahasa IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
Agentic Design Patterns

Agentic Design Patterns

A Hands-On Guide to Building Intelligent Systems
by Antonio Gulli 2025 472 pages
3.9
50 ratings
Listen
Try Full Access for 3 Days
Unlock listening & more!
Continue

Key Takeaways

1. Agentic AI transforms LLMs into autonomous, goal-oriented systems.

In essence, an AI agent represents a significant leap from traditional models, functioning as an autonomous system that perceives, plans, and acts to achieve specific goals.

The AI evolution. The field of artificial intelligence is at a fascinating inflection point, moving beyond models that simply process information to creating intelligent systems that can reason, plan, and act to achieve complex, ambiguous goals. This shift from basic prompts and triggers to sophisticated, autonomous entities marks the era of Agentic AI, where systems are not just reactive but proactive, continuously learning through experience. This evolution is rapidly gaining traction, with a market valued at $5.2 billion and projected to explode to nearly $200 billion by 2034.

Five-step loop. Agentic AI functions as an intelligent assistant, operating via a straightforward five-step loop to accomplish tasks. This loop involves getting the mission, scanning the scene for information, thinking it through to devise a plan, taking action to execute the plan, and finally, learning and getting better by observing successful outcomes and adapting accordingly. This continuous feedback mechanism allows agents to refine their performance and become more effective over time.

Levels of complexity. Agents span a spectrum of complexity, from Level 0 LLMs as core reasoning engines without external interaction, to Level 1 connected problem-solvers utilizing external tools like search. Level 2 agents become strategic problem-solvers, capable of planning, proactive assistance, and self-improvement through context engineering. The pinnacle, Level 3, involves collaborative multi-agent systems where specialized agents work in concert to achieve complex goals, mirroring human organizational structures.

2. Design patterns provide the essential blueprints for building reliable and scalable agents.

Just as design patterns revolutionized software engineering by providing a common language and reusable solutions to common problems, the agentic patterns in this book will be foundational for building robust, scalable, and reliable intelligent systems.

Structure for intelligence. The power of large language models, the cognitive engines of these agents, must be harnessed with structure and thoughtful design. Building intelligent systems is akin to creating a complex work of art or engineering on a canvas, where this canvas is the underlying infrastructure and frameworks providing the environment and tools for agents to operate. Agentic design patterns are battle-tested templates that offer proven approaches to standard challenges in designing and implementing agent behavior.

Overcoming complexity. Effectively realizing agent characteristics like autonomy, proactiveness, reactiveness, tool use, memory, and communication introduces significant complexity. Design patterns are indispensable because they provide reusable solutions for recurring problems, enhancing the structure, maintainability, reliability, and efficiency of the agents built on this canvas. They offer a common language and structure, making an agent's logic clearer and easier to understand and maintain.

Accelerated development. Using design patterns helps avoid reinventing fundamental solutions for tasks such as managing conversational flow, integrating external capabilities, or coordinating multiple agent actions. Leveraging these established approaches accelerates the development process, allowing developers to focus on the unique aspects of their application rather than the foundational mechanics of agent behavior. This book extracts 21 key design patterns that serve as fundamental building blocks for sophisticated agents.

3. Agents orchestrate complex tasks through sequential chains, dynamic routing, and parallel execution.

The implementation of routing enables a system to move beyond deterministic sequential processing.

Sequential processing. Prompt Chaining, also known as the Pipeline pattern, is a powerful paradigm for handling intricate tasks by breaking them down into a sequence of smaller, manageable sub-problems. Each sub-problem is addressed by a specifically designed prompt, and the output from one prompt feeds into the next, introducing modularity and clarity. This decomposition allows for granular control, reducing cognitive load on the model and leading to more accurate and reliable outputs, especially when structured output formats like JSON are enforced.

Dynamic decision-making. Routing introduces conditional logic into an agent's operational framework, enabling a shift from a fixed execution path to dynamic decision-making. An agent can classify an incoming query based on intent and direct it to specialized functions, tools, or sub-processes. This mechanism can be implemented via LLM-based, embedding-based, rule-based, or machine learning model-based routing, allowing for more flexible and context-aware system behavior.

Concurrent execution. Parallelization involves executing multiple components, such as LLM calls, tool usages, or entire sub-agents, concurrently. This significantly reduces overall execution time for tasks that can be broken down into independent parts, such as gathering information from multiple sources simultaneously. Frameworks like LangChain Expression Language (LCEL) and Google ADK provide mechanisms for defining and managing these concurrent operations, optimizing the performance of complex agent workflows.

4. Tool Use is fundamental for agents to interact with the real world and external systems.

Tool Use is what transforms a language model from a text generator into an agent capable of sensing, reasoning, and acting in the digital or physical world.

Bridging the gap. For agents to be truly useful and interact with the real world or external systems, they need the ability to use Tools. The Tool Use pattern, often implemented through Function Calling, enables an agent to interact with external APIs, databases, services, or even execute code, breaking the limitations of the LLM's training data. This allows agents to access up-to-date information, perform calculations, interact with user-specific data, or trigger real-world actions.

The process of tool use. The process typically involves defining external functions with descriptions and parameters, followed by the LLM deciding when and how to use a tool based on the user's request. The LLM then generates a structured output specifying the tool and its arguments, which the agentic framework executes. The tool's output is then returned to the LLM as context to formulate a final response or decide on the next step.

Expansive capabilities. While "function calling" describes invoking predefined code functions, "tool calling" is a broader concept acknowledging that an agent's capabilities extend beyond simple execution. A tool can be a complex API endpoint, a database request, or even an instruction directed at another specialized agent. This perspective captures the full potential of agents to act as orchestrators across a diverse ecosystem of digital resources and other intelligent entities.

5. Effective memory management enables agents to maintain context and learn across interactions.

Memory enables agents to maintain history, learn, personalize interactions, and manage complex, time-dependent problems.

Dual memory system. Effective memory management is crucial for intelligent agents to retain information and operate efficiently, much like humans. Agent memory is generally categorized into short-term (contextual) and long-term (persistent) memory. Short-term memory holds information currently being processed within the LLM's context window, essential for coherent dialogue in a single interaction.

Persistent knowledge. Long-term memory acts as a repository for information agents need to retain across various interactions, tasks, or extended periods. This data is typically stored outside the agent's immediate processing environment, often in databases or vector databases, enabling retrieval based on semantic similarity. When needed, relevant data is retrieved from long-term memory and integrated into the short-term context for immediate use.

ADK's approach. Frameworks like Google's Agent Development Kit (ADK) offer a structured method for managing context and memory through concepts like Session, State, and MemoryService. A Session tracks individual chat threads, storing temporary data (State) relevant to that conversation. The MemoryService, on the other hand, oversees the storage and retrieval of long-term knowledge, often leveraging services like Vertex AI RAG for scalable, persistent, and semantic search capabilities.

6. Multi-agent collaboration leverages specialized teams for complex problem-solving.

The collective strength of such a system lies in this division of labor and the synergy created through coordinated effort.

Beyond monolithic agents. While a single agent can be effective for well-defined problems, its capabilities are constrained when faced with complex, multi-domain tasks. The Multi-Agent Collaboration pattern addresses this by structuring a system as a cooperative ensemble of distinct, specialized agents. This approach is predicated on task decomposition, where a high-level objective is broken down and assigned to agents with specific tools, data access, or reasoning capabilities.

Forms of collaboration. Collaboration can take various forms, including sequential handoffs where one agent passes its output to another, parallel processing where multiple agents work simultaneously, or hierarchical structures where a manager agent delegates tasks. The efficacy of such a system is critically dependent on mechanisms for inter-agent communication, requiring standardized protocols and shared ontologies.

Interoperability and standardization. The Agent2Agent (A2A) protocol is an open standard designed to enable communication and collaboration between different AI agent frameworks, ensuring interoperability regardless of their origin. Similarly, the Model Context Protocol (MCP) provides a standardized interface for LLMs to discover, communicate with, and utilize external capabilities. These protocols foster an ecosystem where compliant tools and agents can be accessed by any compliant LLM, promoting reusability and reducing integration complexity.

7. Agents achieve self-improvement through reflection, learning, and adaptive planning.

The Reflection pattern involves an agent evaluating its own work, output, or internal state and using that evaluation to improve its performance or refine its response.

Self-correction loop. Even with sophisticated workflows, an agent's initial output or plan might not be optimal. The Reflection pattern introduces a feedback loop where an agent evaluates its own work, identifies potential issues, and uses those insights to generate a refined version or modify future actions. This can be facilitated by a separate "Critic" agent, which provides unbiased feedback to a "Producer" agent, leading to more robust and unbiased results.

Learning from experience. Learning and adaptation are pivotal for enhancing agent capabilities, enabling them to evolve beyond predefined parameters through experience and environmental interaction. Agents can refine their performance by learning from past interactions, storing successful strategies, mistakes, and new information in long-term memory. This allows them to adapt to novel situations and optimize performance without constant manual intervention.

Adaptive planning. Planning is the ability for an agent to formulate a sequence of actions to move from an initial state towards a goal state, and it is a core computational process in autonomous systems. An initial plan is merely a starting point, and the agent's real power is its ability to incorporate new information and steer the project around obstacles, dynamically adapting its plan if necessary. This transforms a high-level objective into a structured plan of discrete, executable steps.

8. Advanced reasoning techniques make an agent's internal thought processes explicit and robust.

This allows agents to break down problems, consider intermediate steps, and reach more robust and accurate conclusions.

Explicit thought processes. Advanced reasoning methodologies focus on multi-step logical inferences and problem-solving, making the agent's internal reasoning explicit. This involves allocating increased computational resources during inference, allowing the agent to engage in iterative refinement, explore multiple solution paths, or utilize external tools. This extended processing time significantly enhances accuracy, coherence, and robustness for complex problems.

Chain and tree of thought. Chain-of-Thought (CoT) prompting significantly enhances LLMs' complex reasoning abilities by mimicking a step-by-step thought process, guiding the model to generate intermediate reasoning steps. Building on this, Tree-of-Thought (ToT) allows LLMs to explore multiple reasoning paths by branching into different intermediate steps, forming a tree structure. This approach supports complex problem-solving by enabling backtracking, self-correction, and exploration of alternative solutions.

Reason and Act (ReAct). ReAct is a paradigm that integrates CoT-style reasoning with an agent's ability to interact with external environments through tools. It operates in an interleaved manner: the agent executes an action, observes the outcome, and incorporates this observation into subsequent reasoning. This iterative loop of "Thought, Action, Observation, Thought..." allows the agent to dynamically adapt its plan, correct errors, and achieve goals requiring multiple interactions with the environment.

9. Knowledge Retrieval (RAG) grounds agents in real-time, verifiable information.

RAG enables LLMs to access and integrate external, current, and context-specific information, thereby enhancing the accuracy, relevance, and factual basis of their outputs.

Beyond static knowledge. Large Language Models are typically confined to their training data, limiting access to real-time, specific company, or highly specialized details. Knowledge Retrieval (RAG) addresses this by allowing LLMs to "look up" information from external knowledge bases, such as documents, databases, or web pages, before generating a response. This process empowers LLMs to provide more accurate, up-to-date, and verifiable answers.

Semantic search. When a user poses a query, the RAG system first semantically searches a vast external knowledge base for relevant snippets or "chunks" of information. These extracted pieces are then "augmented" or added to the original prompt, creating a richer, more informed query for the LLM. This semantic search understands the user's intent and the meaning behind their words, going beyond simple keyword matching.

Agentic RAG. An evolution of this pattern, Agentic RAG, introduces a reasoning and decision-making layer to significantly enhance reliability. Instead of passively accepting retrieved data, a specialized AI agent actively interrogates its quality, relevance, and completeness. This agent can validate sources, reconcile knowledge conflicts, perform multi-step reasoning to synthesize complex answers, and identify knowledge gaps, using external tools like live web-search APIs to find missing data.

10. Guardrails and exception handling ensure agents operate safely and robustly.

Without them, an AI system may be unconstrained, unpredictable, and potentially hazardous.

Safety and ethics. Guardrails, also referred to as safety patterns, are crucial mechanisms that ensure intelligent agents operate safely, ethically, and as intended, particularly as they become more autonomous and integrated into critical systems. They serve as a protective layer, guiding the agent's behavior and output to prevent harmful, biased, irrelevant, or otherwise undesirable responses. This is vital for constructing responsible AI systems, mitigating risks, and maintaining user trust.

Managing failures. The Exception Handling and Recovery pattern addresses the need for AI agents to manage operational failures. This involves anticipating potential issues like tool errors or service unavailability and developing strategies to mitigate them. These strategies include error logging, retries, fallbacks, graceful degradation, and notifications, ensuring agents can continue to operate effectively despite encountering complexities and failures.

Robust engineering. Building reliable AI agents requires applying the same rigor and best practices that govern traditional software engineering. This includes principles like fault tolerance, state management, and robust testing. Checkpoint and rollback patterns, modularity, observability through structured logging, and the principle of least privilege are critical for engineering resilient, production-grade agent systems that are effective, auditable, and trustworthy.

11. Human-in-the-Loop is crucial for ethical oversight and nuanced decision-making.

The core principle of HITL is to ensure that AI operates within ethical boundaries, adheres to safety protocols, and achieves its objectives with optimal effectiveness.

Synergy of intelligence. The Human-in-the-Loop (HITL) pattern deliberately interweaves the unique strengths of human cognition—such as judgment, creativity, and nuanced understanding—with the computational power and efficiency of AI. This strategic integration is often a necessity, especially as AI systems become embedded in critical decision-making processes where the implications of AI errors can be substantial.

Augmenting human capabilities. Rather than viewing AI as a replacement, HITL positions AI as a tool that augments and enhances human capabilities. This augmentation can take various forms, from automating routine tasks to providing data-driven insights that inform human decisions. HITL encompasses human oversight, intervention and correction, feedback for learning, decision augmentation, and human-agent collaboration.

Caveats and trade-offs. Despite its benefits, HITL has significant caveats, primarily a lack of scalability. While human oversight provides high accuracy, operators cannot manage millions of tasks, creating a fundamental trade-off between automation for scale and HITL for accuracy. The effectiveness also heavily depends on the expertise of human operators, and implementing HITL raises privacy concerns, often requiring rigorous anonymization of sensitive information.

12. Resource-aware optimization, prioritization, and continuous evaluation drive agent efficiency and accountability.

This ensures the agents concentrate efforts on the most critical tasks, resulting in enhanced effectiveness and goal alignment.

Efficient resource allocation. Resource-Aware Optimization enables intelligent agents to dynamically monitor and manage computational, temporal, and financial resources during operation. This involves choosing between more accurate but expensive models and faster, lower-cost ones, or deciding whether to allocate additional compute for a more refined response versus returning a quicker, less detailed answer. Techniques like dynamic model switching and contextual pruning are crucial for efficiency.

Strategic task management. Prioritization enables agents to assess and rank tasks, objectives, or actions based on their significance, urgency, dependencies, and established criteria. This ensures agents concentrate efforts on the most critical tasks, resulting in enhanced effectiveness and goal alignment. Dynamic re-prioritization allows agents to modify priorities as circumstances change, ensuring adaptability and responsiveness in complex, multi-objective environments.

Continuous assessment. Evaluation and Monitoring allow intelligent agents to systematically assess their performance, monitor progress toward goals, and detect operational anomalies. This includes defining metrics for accuracy, latency, and resource consumption, establishing feedback loops, and implementing reporting systems. Techniques like LLM-as-a-Judge for subjective qualities and analyzing agent trajectories for process quality are vital for continuous improvement and accountability in dynamic, real-world deployments.

Last updated:

Report Issue
Want to read the full book?
Follow
Listen
Now playing
Agentic Design Patterns
0:00
-0:00
Now playing
Agentic Design Patterns
0:00
-0:00
1x
Queue
Home
Swipe
Library
Get App
Create a free account to unlock:
Recommendations: Personalized for you
Requests: Request new book summaries
Bookmarks: Save your favorite books
History: Revisit books later
Ratings: Rate books & see your ratings
600,000+ readers
Try Full Access for 3 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
Read unlimited summaries. Free users get 3 per month
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
❤️ Unlimited Bookmarks
Free users are limited to 4
📜 Unlimited History
Free users are limited to 4
📥 Unlimited Downloads
Free users are limited to 1
Risk-Free Timeline
Today: Get Instant Access
Listen to full summaries of 26,000+ books. That's 12,000+ hours of audio!
Day 2: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 3: Your subscription begins
You'll be charged on Mar 4,
cancel anytime before.
Consume 2.8× More Books
2.8× more books Listening Reading
Our users love us
600,000+ readers
Trustpilot Rating
TrustPilot
4.6 Excellent
This site is a total game-changer. I've been flying through book summaries like never before. Highly, highly recommend.
— Dave G
Worth my money and time, and really well made. I've never seen this quality of summaries on other websites. Very helpful!
— Em
Highly recommended!! Fantastic service. Perfect for those that want a little more than a teaser but not all the intricate details of a full audio book.
— Greg M
Save 62%
Yearly
$119.88 $44.99/year/yr
$3.75/mo
Monthly
$9.99/mo
Start a 3-Day Free Trial
3 days free, then $44.99/year. Cancel anytime.
Scanner
Find a barcode to scan

We have a special gift for you
Open
38% OFF
DISCOUNT FOR YOU
$79.99
$49.99/year
only $4.16 per month
Continue
2 taps to start, super easy to cancel
Settings
General
Widget
Loading...
We have a special gift for you
Open
38% OFF
DISCOUNT FOR YOU
$79.99
$49.99/year
only $4.16 per month
Continue
2 taps to start, super easy to cancel