# Agentic Design Patterns - Deep Dive

> **TL;DR**: This is a free 400+ page guide by a Google Distinguished Engineer covering 21 design patterns for building AI agents. It bridges the gap between AI demos and production systems, with implementations in LangChain/LangGraph, Crew AI, and Google ADK. The repo has 7.2k+ stars and includes Jupyter notebooks for hands-on learning.

---

## What Is This Repository?

The **Agentic Design Patterns** repository is a comprehensive resource based on the book by **Antonio Gullí** (Senior Director and Distinguished Engineer in Google's CTO Office). It provides:

- **400+ page PDF guide** - Free, comprehensive documentation
- **21 design patterns** - From basic to advanced agent architectures
- **3 framework implementations** - LangChain/LangGraph, Crew AI, Google ADK
- **Jupyter notebooks** - Executable code examples

### The Problem It Solves

> "Agentic design patterns are the missing link between AI demos and enterprise value."

Most teams struggle to move from:
- **AI demos** → **Production systems**
- **Single LLM calls** → **Autonomous agents**
- **Proof-of-concept** → **Scalable, reliable agents**

This repository provides the **blueprints** for building real AI agent systems.

---

## The 21 Design Patterns

The patterns are organized into three categories:

### Core Execution Patterns (Foundation)

| Pattern | What It Does | When to Use |
|---------|--------------|-------------|
| **Prompt Chaining** | Sequential task decomposition | Complex tasks with clear steps |
| **Routing** | Direct inputs to specialized agents | Multi-domain queries |
| **Parallelization** | Execute independent tasks simultaneously | Speed up independent operations |

### Advanced Agentic Patterns

| Pattern | What It Does | When to Use |
|---------|--------------|-------------|
| **Reflection** | Self-evaluate and refine outputs | Quality-critical responses |
| **Tool Use** | Interact with external tools/APIs | Need real data or actions |
| **Planning** | Create structured roadmaps | Complex multi-step problems |
| **Multi-Agent** | Teams of specialized agents | Large, complex tasks |
| **Memory Management** | Maintain context across interactions | Long conversations |
| **Learning & Adaptation** | Improve from experience | Repeated similar tasks |
| **MCP (Model Context Protocol)** | Standardized tool integration | Multiple tool sources |

### Production & Governance Patterns

| Pattern | What It Does | When to Use |
|---------|--------------|-------------|
| **Goal Monitoring** | Track progress toward objectives | Long-running tasks |
| **Exception Handling** | Graceful failure management | Production systems |
| **Human-in-the-Loop** | Human approval for decisions | High-stakes actions |
| **Knowledge Retrieval (RAG)** | Integrate external knowledge | Need factual grounding |
| **Inter-Agent Communication** | Agent-to-agent messaging | Multi-agent systems |
| **Resource Optimization** | Manage costs and latency | Production at scale |
| **Reasoning Techniques** | Chain-of-thought, tree-of-thought | Complex reasoning |
| **Guardrails/Safety** | Output validation, filtering | User-facing systems |
| **Evaluation & Monitoring** | Track agent performance | Production systems |
| **Prioritization** | Task ordering | Multiple competing tasks |
| **Exploration** | Discover new solutions | Open-ended problems |

---

## Key Patterns Explained

### 1. Prompt Chaining

Break complex tasks into sequential steps:

```
Step 1: Extract key information
    ↓
Step 2: Analyze the information
    ↓
Step 3: Generate recommendations
    ↓
Step 4: Format final output
```

**Benefits**:
- Reduces cognitive load per step
- Easier to debug (which step failed?)
- Each step can be verified independently

### 2. ReAct Pattern (Reason + Act)

The most fundamental agentic pattern:

```
┌──────────────────────────────────────────────────────────────┐
│                      ReAct LOOP                              │
├──────────────────────────────────────────────────────────────┤
│                                                              │
│   THINK: "I need to find the current stock price..."        │
│      ↓                                                       │
│   ACT: search_stock_price("AAPL")                           │
│      ↓                                                       │
│   OBSERVE: "AAPL is currently $185.50"                      │
│      ↓                                                       │
│   THINK: "Now I need to compare with yesterday..."          │
│      ↓                                                       │
│   ACT: get_historical_price("AAPL", "yesterday")            │
│      ↓                                                       │
│   OBSERVE: "Yesterday's close was $183.20"                  │
│      ↓                                                       │
│   THINK: "I can now calculate the change..."                │
│      ↓                                                       │
│   RESPOND: "AAPL is up $2.30 (1.25%) from yesterday"        │
│                                                              │
└──────────────────────────────────────────────────────────────┘
```

**Key insight**: Forces the model to "show its work" before acting, reducing hallucination.

### 3. Reflection Pattern

Self-improvement through critique:

```
1. GENERATE: Create initial response
       ↓
2. CRITIQUE: "Is this accurate? Complete? Well-structured?"
       ↓
3. IDENTIFY: Find specific issues
       ↓
4. REVISE: Fix the issues
       ↓
5. REPEAT: Until quality threshold met
```

**Implementation**:
```python
# Conceptual pseudocode
response = generate(user_query)
while not meets_quality_threshold(response):
    critique = evaluate(response)
    response = revise(response, critique)
return response
```

### 4. Parallelization Pattern

Execute independent tasks simultaneously:

```
                    ┌─── Query Source A ───┐
                    │                      │
User Query ────────►├─── Query Source B ───┼───► Aggregate ───► Response
                    │                      │
                    └─── Query Source C ───┘
```

**Requirements**:
- Tasks must be independent (no cross-dependencies)
- Results can be meaningfully combined

### 5. Planning Pattern

Plan before executing:

```
┌─────────────────────────────────────────────────────────────┐
│                    PLAN-AND-EXECUTE                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│   PLANNER (Heavy LLM)                                       │
│   └── Analyzes complex request                              │
│   └── Breaks into steps: [Step1, Step2, Step3, Step4]       │
│   └── Identifies dependencies                               │
│                                                             │
│   EXECUTOR (Lighter LLM per step)                           │
│   └── Step 1: Execute, return result                        │
│   └── Step 2: Execute with Step1 context                    │
│   └── Step 3: Execute with Step1+2 context                  │
│   └── Step 4: Execute, synthesize final answer              │
│                                                             │
└─────────────────────────────────────────────────────────────┘
```

**Benefits**:
- Faster overall (lighter LLM calls per step)
- Better tracking of progress
- Easier to recover from failures

### 6. Multi-Agent Collaboration

Teams of specialized agents:

```
                         ┌─────────────────┐
                         │  ORCHESTRATOR   │
                         │  (Lead Agent)   │
                         └────────┬────────┘
                                  │
              ┌───────────────────┼───────────────────┐
              │                   │                   │
     ┌────────▼────────┐ ┌───────▼────────┐ ┌───────▼────────┐
     │    RESEARCH     │ │     CODE       │ │     TEST       │
     │    AGENT        │ │     AGENT      │ │     AGENT      │
     └─────────────────┘ └────────────────┘ └────────────────┘
```

**Orchestration patterns**:
- **Sequential**: One agent after another
- **Concurrent**: Multiple agents in parallel
- **Dynamic handoff**: Agents pass control based on context
- **Maker-checker**: One creates, another validates

### 7. Human-in-the-Loop

Critical for production systems:

```
Agent Action Decision
        │
        ▼
┌───────────────────┐
│ Risk Assessment   │
│ Is this high-risk?│
└────────┬──────────┘
         │
    ┌────┴────┐
    │         │
   Low       High
    │         │
    ▼         ▼
Execute    Request Human
Directly    Approval
              │
              ▼
         Human Reviews
              │
         ┌────┴────┐
         │         │
      Approve   Reject
         │         │
         ▼         ▼
      Execute   Modify/
               Explain
```

---

## Framework Implementations

The repository covers three major frameworks:

### 1. LangChain / LangGraph

**Best for**: Complex operational sequences, custom workflows

```
LangGraph models workflows as directed cyclic graphs:

┌─────────────────────────────────────────────────────────────┐
│                     LANGGRAPH WORKFLOW                       │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│   StateGraph Object                                         │
│   ├── Nodes: Agent, Tools, Reflection, Output               │
│   ├── Edges: Conditional routing between nodes              │
│   └── State: Shared context passed between nodes            │
│                                                             │
│   Enables:                                                  │
│   ├── Reflection agents                                     │
│   ├── ReAct agents                                          │
│   ├── Plan-and-execute                                      │
│   └── Multi-agent collaboration                             │
│                                                             │
└─────────────────────────────────────────────────────────────┘
```

### 2. Crew AI

**Best for**: Multi-agent teams with role-based specialization

```
CREW AI ARCHITECTURE

┌─────────────────────────────────────────────────────────────┐
│   CREW                                                       │
│   ├── Agent 1: Researcher (role, goals, tools)              │
│   ├── Agent 2: Writer (role, goals, tools)                  │
│   └── Agent 3: Editor (role, goals, tools)                  │
│                                                             │
│   TASKS                                                     │
│   ├── Task 1: Research topic → Agent 1                      │
│   ├── Task 2: Write article → Agent 2                       │
│   └── Task 3: Edit article → Agent 3                        │
│                                                             │
│   FLOW: Sequential or Parallel execution                    │
└─────────────────────────────────────────────────────────────┘
```

### 3. Google Agent Developer Kit (ADK)

**Best for**: Production deployment, evaluation, Google ecosystem

```
GOOGLE ADK FOCUS

├── Agent Building
├── Evaluation Frameworks
├── Deployment Pipelines
└── Google Cloud Integration
```

---

## Practical Recommendations

### Choosing the Right Pattern

| Scenario | Recommended Pattern |
|----------|-------------------|
| Sequential task breakdown | Prompt Chaining |
| Classify and route queries | Routing |
| Independent parallel tasks | Parallelization |
| Quality-critical output | Reflection |
| External data/actions needed | Tool Use + MCP |
| Complex multi-step problem | Planning |
| Large project with specialists | Multi-Agent |
| High-stakes decisions | Human-in-the-Loop |
| Need factual grounding | RAG (Knowledge Retrieval) |

### Key Principles

1. **Start Simple**: Most tasks can be handled by single agents with ReAct + tools
2. **Avoid Premature Complexity**: Multi-agent systems are impressive but often overkill
3. **Compose Patterns**: Combine simple patterns rather than building monolithic agents
4. **Bounded Autonomy**: Keep humans in the loop by default

---

## The Author

**Antonio Gullí**
- Senior Director and Distinguished Engineer, Google CTO Office
- 30+ years experience
- Ph.D. in Computer Science (University of Pisa)
- Previous book: "Deep Learning for Keras"

**Repository Maintainer**: Sarwar Alam (Data Scientist at Intellect Design Arena)

---

## How This Helps Us Achieve Our Goals

Looking at our "Software Development in the Age of AI" repository, Agentic Design Patterns provides:

### 1. **Foundational Knowledge**

| Our Focus | What This Adds |
|-----------|----------------|
| Claude Code usage | Understanding of underlying agent patterns |
| AI-assisted development | Systematic approaches to agent design |
| Prompting techniques | Advanced patterns like reflection, planning |

### 2. **Complements Our Other Deep Dives**

| Deep Dive | Connection |
|-----------|------------|
| **DeepAgents** | DeepAgents implements these patterns (planning, subagents) |
| **CCPM** | Uses multi-agent patterns for parallel development |
| **Vibe Kanban** | Orchestrates agents using multi-agent patterns |
| **MCP Servers** | MCP is one of the 21 patterns covered here |

### 3. **Design Reference**

When building custom AI workflows:
- Reference these patterns for architecture decisions
- Choose appropriate patterns for each task
- Avoid reinventing established solutions

### 4. **Industry Standard Knowledge**

- Published by Springer Nature
- Written by Google Distinguished Engineer
- 7.2k+ stars shows community validation
- Referenced across enterprise AI literature

---

## Quick Reference

### Installation

No installation needed - the PDF is free to download from the repository.

```bash
# Clone for Jupyter notebooks
git clone https://github.com/sarwarbeing-ai/Agentic_Design_Patterns
cd Agentic_Design_Patterns/notebooks
```

### Core Patterns Summary

| Pattern | One-Line Description |
|---------|---------------------|
| Prompt Chaining | Sequential steps, each builds on previous |
| Routing | Classify and route to specialists |
| Parallelization | Run independent tasks simultaneously |
| Reflection | Self-critique and improve |
| Tool Use | Call external APIs and tools |
| Planning | Plan before executing |
| Multi-Agent | Teams of specialized agents |
| Human-in-the-Loop | Human approval for decisions |
| RAG | Ground responses in external knowledge |
| Guardrails | Validate and filter outputs |

---

## Key Links

| Resource | URL |
|----------|-----|
| GitHub Repository | https://github.com/sarwarbeing-ai/Agentic_Design_Patterns |
| Book (Springer) | https://link.springer.com/book/10.1007/978-3-032-01402-3 |
| Book (Amazon) | https://www.amazon.com/Agentic-Design-Patterns-Hands-Intelligent/dp/3032014018 |
| LangGraph Docs | https://www.langchain.com/langgraph |
| Crew AI Docs | https://docs.crewai.com/ |
| Google ADK | https://cloud.google.com/agent-development-kit |

---

## Quick Stats

| Metric | Value |
|--------|-------|
| Author | Antonio Gullí (Google Distinguished Engineer) |
| Publisher | Springer Nature |
| Publication Date | December 3, 2025 |
| Pages | 424 |
| GitHub Stars | 7,200+ |
| GitHub Forks | 1,300+ |
| Design Patterns | 21 |
| Frameworks Covered | LangChain/LangGraph, Crew AI, Google ADK |
| License | Free PDF available |

---

## Bottom Line

Agentic Design Patterns is the **definitive reference** for building AI agents systematically.

**Why it matters**:
- Not just theory - includes executable Jupyter notebooks
- Not just code - includes architectural reasoning
- Not framework-specific - covers multiple approaches
- Free and accessible - PDF available in the repository

**Key takeaway**: Before building an agent, check if there's an established pattern for your use case. Chances are, one of these 21 patterns fits.

For our repository focused on AI-assisted development, this is essential background knowledge. Understanding these patterns helps you work more effectively with tools like Claude Code, and build your own AI workflows when needed.

---

*Document created: January 2026*
*Sources: [GitHub - sarwarbeing-ai/Agentic_Design_Patterns](https://github.com/sarwarbeing-ai/Agentic_Design_Patterns), [Springer Nature](https://link.springer.com/book/10.1007/978-3-032-01402-3), [VentureBeat](https://venturebeat.com/infrastructure/agentic-design-patterns-the-missing-link-between-ai-demos-and-enterprise), [LangChain Blog](https://blog.langchain.com/reflection-agents/)*
