12 Foundational Patterns¶
Overview¶
The 12 foundational patterns represent the complete taxonomy of proven agentic system design patterns currently used in production (2025-2026).
This map consolidates:
- Andrew Ng's 4 patterns
- Anthropic's 5 workflow patterns
- 3 additional emergent patterns from production systems
Together, these 12 patterns cover virtually all production agentic systems.
-
The 12 Patterns at a Glance¶
graph TD
A["12 FOUNDATIONAL AGENTIC PATTERNS<br/>(2025-2026)"] --> B["CORE PATTERNS - 4"]
B --> B1["1. Reflection"]
B --> B2["2. Tool Use<br/>Function Calling"]
B --> B3["3. Planning & Decomposition"]
B --> B4["4. Routing & Selection"]
A --> C["WORKFLOW PATTERNS - 5"]
C --> C1["5. Agentic Loop"]
C --> C2["6. Retrieval Augmented<br/>Generation RAG"]
C --> C3["7. Chain-of-Thought<br/>Reasoning"]
C --> C4["8. Parallelization"]
C --> C5["9. Multi-Agent<br/>Coordination"]
A --> D["EMERGENT PATTERNS - 3"]
D --> D1["10. Human-in-the-Loop"]
D --> D2["11. Memory & Context<br/>Management"]
D --> D3["12. Error Recovery &<br/>Resilience"]
```
---
## Core Patterns (1-4)
These are the fundamental building blocks all agents use.
### Pattern 1: Reflection
**What**: Agent generates output, critiques it, then improves
**Why**: Higher quality outputs through self-critique
**Example Use**: Writing, code generation, analysis
**Implementation Cost**: 3x inference (generate, critique, improve)
**Quality Gain**: +20-40% typical
```python
def reflection_loop(task):
# Generate
output = llm.generate(task)
# Critique
critique = llm.critique(output, task)
# Improve
if critique.issues:
output = llm.improve(output, critique)
return output
```
**Production Use**: 60% of agents use this
-
### Pattern 2: Tool Use / Function Calling
**What**: Agent calls external tools/APIs based on task needs
**Why**: Agents affect world, not just talk
**Example Use**: Database queries, web search, API calls
**Implementation Cost**: Tool definition and error handling
**Capability Gain**: From chatbot to autonomous agent
```python
def tool_use(goal):
while not done:
# Decide which tool
tool = llm.choose_tool(goal, available_tools)
# Call it
result = tools[tool.name](**tool.args)
# Integrate result
context += result
```
**Production Use**: 80% of agents use this
---
### Pattern 3: Planning & Decomposition
**What**: Break complex goal into sub-goals before execution
**Why**: Complex tasks fail without planning
**Example Use**: Research tasks, multi-step workflows
**Implementation Cost**: Additional LLM call for planning
**Quality Gain**: +30-50% on complex tasks
```python
def planning_pattern(goal):
# Decompose
plan = llm.create_plan(goal)
# steps = [step1, step2, step3,...]
# Execute
results = []
for step in plan.steps:
result = execute_step(step)
results.append(result)
return aggregate(results)
```
**Production Use**: 70% of agents use this
-
### Pattern 4: Routing & Selection
**What**: Classify request and route to specialist handler
**Why**: Specialists more accurate than generalists
**Example Use**: Customer support, API gateways
**Implementation Cost**: Classification model/logic
**Quality Gain**: +10-30% accuracy
```python
def routing_pattern(request):
# Classify
category = classifier.predict(request)
# Select specialist
specialist = specialists[category]
# Handle
return specialist.handle(request)
```
**Production Use**: 50% of agents use this
---
## Workflow Patterns (5-9)
These patterns describe how work flows through the system.
### Pattern 5: Agentic Loop
**What**: Iterative perceive→reason→act→reflect cycle
**Why**: Handles complex, multi-step tasks
**Characteristics**:
- Autonomous decision-making
- Iteration until goal met
- Reactive to environment
**When**: Multi-step problem-solving
---
### Pattern 6: Retrieval Augmented Generation (RAG)
**What**: Retrieve context before generating response
**Why**: Grounded, hallucination-reduced answers
**Characteristics**:
- Fast (no iteration)
- Document-grounded
- Deterministic
**When**: Knowledge-based Q&A
---
### Pattern 7: Chain-of-Thought Reasoning
**What**: Make reasoning steps explicit
**Why**: Better quality through visible reasoning
**Characteristics**:
- Transparent process
- Better on complex tasks
- Uses more tokens
**When**: Complex reasoning needed
---
### Pattern 8: Parallelization
**What**: Break task into parallel subtasks
**Why**: Speed up execution, gather diverse inputs
**Characteristics**:
- Concurrent execution
- Merge results
- Faster overall
**When**: Independent subtasks available
```python
def parallelization_pattern(task):
subtasks = decompose_into_independent(task)
# Run in parallel
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [
executor.submit(process, subtask)
for subtask in subtasks
]
results = [f.result() for f in futures]
return merge_results(results)
```
**When**:
- Search multiple sources
- Parallel analysis
- Independent sub-goals
-
### Pattern 9: Multi-Agent Coordination
**What**: Multiple agents collaborate on task
**Why**: Specialize work, scale capacity
**Characteristics**:
- Agent specialization
- Communication/coordination
- Scalable
**When**: Large/complex projects
---
## Emergent Patterns (10-12)
These patterns emerged from production systems (2024-2025).
### Pattern 10: Human-in-the-Loop
**What**: Humans retained authority over high-impact decisions
**Why**: Safety, oversight, trust
**Characteristics**:
- Risk-based escalation
- Approval workflows
- Audit trails
**Implementation**:
```python
def hitl_pattern(decision):
risk = assess_risk(decision)
if risk < LOW_THRESHOLD:
execute_autonomous(decision)
elif risk < HIGH_THRESHOLD:
approval = wait_for_human_approval(decision)
if approval:
execute(decision)
else:
escalate_to_human(decision)
```
**Production Adoption**: 85%+ of enterprise systems
---
### Pattern 11: Memory & Context Management
**What**: Maintain and retrieve information across interactions
**Why**: Agents can't fit full history in context window
**Characteristics**:
- Short-term (current task)
- Long-term (vector DB)
- Episodic (what happened)
- Semantic (what to know)
**Implementation**:
```python
class MemoryPattern:
def __init__(self):
self.short_term = [] # Current task
self.episodic = VectorDB() # Past events
self.semantic = KnowledgeBase() # Facts
def add_memory(self, event):
self.episodic.add(event)
def recall(self, query):
return self.episodic.search(query)
```
**Production Adoption**: 75%+ of sophisticated agents
-
### Pattern 12: Error Recovery & Resilience
**What**: Graceful handling of failures, recovery strategies
**Why**: Production systems fail; design for it
**Characteristics**:
- Error detection
- Retry strategies
- Fallback paths
- Logging/audit
**Implementation**:
```python
def resilience_pattern(task):
max_retries = 3
for attempt in range(max_retries):
try:
return execute(task)
except RecoverableError as e:
if attempt < max_retries - 1:
task = adjust_strategy(task)
continue
except UnrecoverableError as e:
return handle_graceful_failure(e)
return fallback_solution(task)
```
**Production Adoption**: 95%+ of production systems
---
## Pattern Interaction Matrix
Which patterns work together?
```
1 2 3 4 5 6 7 8 9 10 11 12
Refl Tool Plan Rout Loop RAG CoT Para Multi HITL Mem Err
1. Reflection -
2. Tool Use -
3. Planning -
4. Routing -
5. Loop -
6. RAG -
7. CoT -
8. Parallel -
9. Multi -
10. HITL -
11. Memory -
12. Error -
Legend: = Works together, = Strong synergy
```
**Key Synergies**:
- Tool Use + Planning = Powerful agents
- Agentic Loop + Memory = Stateful agents
- Multi-Agent + HITL = Enterprise systems
- RAG + Error Recovery = Robust systems
---
## Common Pattern Combinations
### 1. Simple Agent (Most Common 2025)
```
Tool Use + Planning + Error Recovery
```
- 60% of production agents
- Autonomous with guardrails
- Example: Customer service bot
### 2. Advanced Agent
```
Agentic Loop + Tool Use + Planning + Memory + Error Recovery
```
- 25% of production agents
- Complex task handling
- Example: Research assistant
### 3. Team Agent
```
Multi-Agent + Routing + Coordination + HITL
```
- 10% of production agents
- Large projects
- Example: Enterprise research team
### 4. RAG-Based
```
RAG + Tool Use + Error Recovery
```
- 20% of production agents
- Knowledge-based systems
- Example: Documentation bot
### 5. Enterprise (Full Stack)
```
All 12 patterns combined
```
- <5% of production agents (most complex)
- Mission-critical systems
- Example: Full enterprise AI platform
---
## Pattern Adoption in 2025-2026
### Current Usage (Production Systems)
| Pattern| Usage| Trend|
|---------|-------|-------|
| 1. Reflection| 60%| Growing|
| 2. Tool Use| 80%| Growing|
| 3. Planning| 70%| Stable|
| 4. Routing| 50%| Growing|
| 5. Agentic Loop| 55%| Growing|
| 6. RAG| 65%| Stable|
| 7. CoT| 45%| Stable|
| 8. Parallelization| 40%| Growing|
| 9. Multi-Agent| 30%| Growing Fast|
| 10. HITL| 85%| Growing|
| 11. Memory| 75%| Growing|
| 12. Error Recovery| 95%| Stable|
---
## Evolution Over Time
### 2023: Foundation
```
Tool Use + Planning + Error Recovery
```
→ Simple working agents
### 2024: Sophistication
```
+ Reflection + Memory + Agentic Loop + HITL
```
→ Production-ready agents
### 2025-2026: Standardization
```
All 12 patterns in various combinations
```
→ Enterprises deploy sophisticated systems
→ Multi-agent systems emerge
→ Specialization increases
---
## Decision Framework: Which Patterns Do I Need?
### Step 1: Understand Your Task
- **Simple**: Classification, simple Q&A
- **Complex**: Multi-step, exploration needed
- **Collaborative**: Requires team coordination
### Step 2: Check Requirements
- Speed needed? → Use RAG, minimal loop
- Quality paramount? → Add Reflection, CoT
- Takes action? → Add Tool Use
- Needs learning? → Add Memory
- Team effort? → Add Multi-Agent + HITL
### Step 3: Start Minimal, Add As Needed
```
Start: Tool Use + Error Recovery
If quality issues → Add Reflection
If multi-step → Add Planning
If exploration → Add Agentic Loop
If specialization → Add Routing
If team → Add Multi-Agent + HITL
If grounding → Add RAG
If reasoning → Add CoT
If parallel → Add Parallelization
If memory → Add Memory pattern
```
---
## Pattern Anti-Patterns (What NOT to Do)
**Every pattern at once** - Complexity explosion
**No error handling** - Production will fail
**Reflection everywhere** - 3x cost, not always needed
**No memory** - Can't learn or maintain state
**Always agentic loop** - Sometimes RAG is faster
**No routing** - Generalist agents underperform
**No HITL** - Lost user trust
---
## Metrics by Pattern
### Reflection
- Cost multiplier: 3x
- Quality gain: +30%
- Use when: Quality > Speed
### Tool Use
- Capability gain: 10x (chatbot → agent)
- Error rate: -50% (with proper error handling)
- Use when: Need to take action
### Planning
- Quality gain: +50% (complex tasks)
- Speed: -20% (planning overhead)
- Use when: Multi-step, complex
### Routing
- Accuracy gain: +20-30%
- Latency: Minimal
- Use when: Multiple task types
### Agentic Loop
- Latency: Variable (multiple iterations)
- Quality: +40-60% (complex tasks)
- Use when: Exploration needed
### RAG
- Hallucination reduction: 80%+
- Latency: <1s
- Use when: Document-based
### Memory
- Context efficiency: 5-10x better
- Learning capability: +70%
- Use when: Multi-turn, learning needed
### HITL
- User trust: +90%
- Escalation rate: 5-15%
- Cost: Human time overhead
- Use when: High risk, compliance needed
-
## Next: Read [Pattern Selection Framework](/01-agent-design/02-core-design-patterns/04-pattern-selection-framework/)
-
**Last Updated**: August 9, 2026