Pattern Selection Framework¶
Overview¶
Understanding 12 patterns is one thing. Knowing which to use for YOUR system is another.
This framework walks through the decision process used by production teams to select patterns for their agentic systems.
The 3-Step Selection Process¶
Step 1: Understand Your Problem
↓
Step 2: Identify Core Constraints
↓
Step 3: Select Pattern Combination
↓
Step 4: Validate & Iterate
```
---
## Step 1: Understand Your Problem
### Classify Your Task
| Task Type| Example| Characteristics|
|-----------|---------|-----------------|
| **Question Answering**| "What's in these documents?"| Single shot, grounded, fast|
| **Multi-Step Workflow**| "Research and write report"| Sequential, complex, iterative|
| **Real-Time Interaction**| "Answer customer questions"| Fast, responsive, specialized|
| **Creative Generation**| "Write marketing copy"| Quality-focused, iterative|
| **Autonomous Agent**| "Manage calendar and email"| Continuous, self-directed|
| **Team Coordination**| "Build analysis team"| Multi-agent, specialist|
### Define Your Goal
**Be specific**:
- "Summarize customer support tickets with 95% accuracy"
- "Use AI to improve customer support"
**State success criteria**:
- Accuracy target?
- Latency requirement?
- Cost budget?
- Quality bar?
- User satisfaction?
-
## Step 2: Identify Core Constraints
### Time Constraint
```
< 100ms: RAG only (maybe + simple tools)
100ms-1s: RAG + Tool Use + Error Recovery
1-10s: Simple Agentic Loop + Tools
10s+: Full orchestration possible
```
**Decision**: How fast must this be?
### Quality Constraint
```
Good enough (80%): Tool Use + Error Recovery
High quality (90%): + Reflection + Planning
Very high (95%+): + CoT + Memory + Routing
```
**Decision**: What's your quality target?
### Cost Constraint
```
Budget per call:
$0.001-0.01: Simple RAG or basic loop
$0.01-0.1: Multi-step with reflection
$0.1+: Full orchestration OK
```
**Decision**: What's your cost budget?
### Complexity Constraint
```
Team capacity:
1-2 engineers: Keep it simple (2-3 patterns)
5-10 engineers: Moderate (5-7 patterns)
20+ engineers: Full stack (10-12 patterns)
```
**Decision**: How much can your team handle?
### Safety/Compliance Constraint
```
Low risk (personal use):
No HITL required
Simple error handling
Medium risk (business):
HITL on medium-impact decisions
Audit logs required
User override possible
High risk (financial/healthcare):
HITL on all material decisions
Full audit trail
Compliance monitoring
Regular testing
```
**Decision**: How much safety/oversight needed?
-
## Step 3: Select Pattern Combination
### The Decision Tree
```
START
│
- Is this a Q&A task?
- YES → Start with: RAG
- NO → Continue
│
- Does it need to take action?
- YES → Add: Tool Use + Error Recovery
- NO → Continue (Question answering)
│
- Is it multi-step?
- YES → Add: Planning
- NO → Continue
│
- Need exploration/iteration?
- YES → Add: Agentic Loop
- NO → Continue
│
- Quality paramount?
- YES → Add: Reflection + CoT
- NO → Continue
│
- Multiple input types?
- YES → Add: Routing
- NO → Continue
│
- Need to maintain context?
- YES → Add: Memory
- NO → Continue
│
- Multiple agents?
- YES → Add: Multi-Agent Coordination
- NO → Continue
│
- High-impact decisions?
YES → Add: HITL
NO → Continue
RESULT: Your pattern combination
```
### Common Selections
#### Selection 1: Simple RAG Bot
```
RAG
Tool Use (search, fetch)
Error Recovery
Cost: $0.001-0.01 per call
Latency: <1 second
Quality: 85%
Complexity: Low
Production: 15% of systems
```
**Example**: FAQ bot, documentation search
#### Selection 2: Agentic Research Agent
```
Agentic Loop
Tool Use (search, fetch, analyze)
Planning
Memory
Error Recovery
HITL (optional)
Cost: $0.01-0.1 per call
Latency: 5-30 seconds
Quality: 95%
Complexity: Medium
Production: 40% of systems
```
**Example**: Research assistant, data analyst
#### Selection 3: Customer Support Team
```
Routing (classify issue)
Tool Use (APIs, databases)
Reflection (improve response)
Memory (customer history)
Error Recovery
HITL (escalation)
Cost: $0.01-0.05 per interaction
Latency: 1-5 seconds
Quality: 90-95%
Complexity: Medium-High
Production: 25% of systems
```
**Example**: Enterprise customer support
#### Selection 4: Full Enterprise System
```
Multi-Agent Coordination
Agentic Loops (specialist agents)
Planning & Decomposition
Tool Use (extensive APIs)
Memory (persistent)
Routing (task distribution)
Reflection (quality control)
HITL (approval workflows)
Error Recovery
RAG (knowledge access)
Cost: $0.05-0.5+ per interaction
Latency: 10s-5min (async)
Quality: 98%+
Complexity: High
Production: <5% of systems
```
**Example**: Full enterprise research platform
---
## Framework: 3x3 Matrix
Quick lookup by Complexity vs Speed vs Quality
```
LATENCY (Time)
Low Medium High
(<1s) (1-10s) (>10s)
- ┌─────────┬──────────┬──────────┐
- High │ RAG │ RAG + │ Multi- │
- Quality │ (Simple)│ Tools │ Agent │
- (95%+) │ │ + Refl │ (Full) │
- ┼──────────┼──────────┤
- Medium │ RAG + │ Loop + │ Loop + │
- Quality │ Tools │ Plan + │ Memory │
- (80-90%)│ │ Tools │ + Multi │
- ┼──────────┼──────────┤
- Good │ Simple │ Tool │ Planning │
- Quality │ Tool │ Use + │ + Loop │
- (70-80%)│ Use │ Error │ │
- ┴──────────┴──────────┘
```
---
## Detailed Selection Guide
### "I need to answer questions from documents"
→ Start: RAG
→ Add if needed: Tool Use, Error Recovery
→ If quality issues: + Reflection
→ If customer-facing: + HITL
**Typical: RAG + Error Recovery**
---
### "I need an autonomous research agent"
→ Start: Agentic Loop
→ Add: Tool Use (search, fetch, analyze)
→ Add: Planning (break down research)
→ Add: Memory (remember findings)
→ Add: Error Recovery
→ If multi-phase: + Reflection
**Typical: Agentic Loop + Tool Use + Planning + Memory**
---
### "I need customer support"
→ Start: Routing (classify issue type)
→ Add: Tool Use (customer DB, APIs)
→ Add: RAG (knowledge base)
→ Add: Reflection (improve responses)
→ Add: Memory (customer history)
→ Add: Error Recovery
→ Add: HITL (escalation)
**Typical: Routing + RAG + Tool Use + HITL**
---
### "I need a team of agents"
→ Start: Multi-Agent Coordination
→ Add: Routing (task distribution)
→ Each agent: Agentic Loop + Tool Use
→ Add: Planning (task decomposition)
→ Add: Memory (shared context)
→ Add: HITL (oversight)
**Typical: Multi-Agent + Routing + Planning + HITL**
-
### "I need creative generation"
→ Start: Reflection (quality)
→ Add: CoT (complex reasoning)
→ Add: Memory (maintain voice/style)
→ Add: Error Recovery
→ If iterative: + Agentic Loop
**Typical: Reflection + CoT + Memory**
---
### "I need very fast responses"
→ Use: RAG only (no looping)
→ Add: Tool Use only if necessary
→ Avoid: Agentic Loop, Reflection, CoT
**Typical: RAG + minimal tools**
---
### "I need maximum quality"
→ Use: Reflection, CoT, Planning
→ Add: Agentic Loop (iteration)
→ Add: Memory (learning)
→ Cost higher, latency higher
→ Speed acceptable
**Typical: Agentic Loop + Reflection + CoT + Memory**
-
## Pattern Swap Table: "I'm having this problem..."
### Problem: Output Quality Too Low
```
Current: RAG + Tool Use
Add: Reflection
CoT
Agentic Loop (iterate)
```
### Problem: Hallucinating/Inaccurate
```
Current: Agentic Loop
Add: RAG (ground in docs)
Memory (cross-check facts)
Error Recovery (fallback)
```
### Problem: Too Slow
```
Current: Agentic Loop + Reflection
Remove: Reflection
Replace: RAG
Simplify: Single pass instead of loop
```
### Problem: Too Expensive
```
Current: Full orchestration
Simplify to: Essential patterns only
Remove: Reflection, HITL if optional
Cache: RAG results when possible
```
### Problem: Can't Handle Complexity
```
Current: Single agent
Add: Multi-Agent Coordination
Routing (task distribution)
Parallelization (parallel work)
```
### Problem: Users Don't Trust It
```
Current: Autonomous
Add: HITL (override capability)
Audit trail (show reasoning)
Reflection (self-critique)
```
### Problem: Errors Cascade
```
Current: Basic error handling
Add: Error Recovery pattern
Fallback paths
Bounded execution
Graceful degradation
```
-
## Validation Checklist
Before committing to pattern selection, verify:
```
Does this solve the core problem?
Within time budget?
Within cost budget?
Quality meets target?
Team can build/maintain it?
Users will trust it?
Can we recover if it fails?
Can we improve over time?
Will it scale?
```
If any "No" → Adjust pattern selection
-
## Implementation Order
Once you've selected patterns, implement in this order:
### Phase 1: Core (Week 1)
1. Tool Use + Error Recovery
2. Get basic execution working
### Phase 2: Intelligence (Week 2-3)
3. Add Planning or RAG
2. Improve task handling
### Phase 3: Quality (Week 4-5)
5. Add Reflection/CoT
2. Increase output quality
### Phase 4: Sophistication (Week 6+)
7. Add Memory
2. Add HITL
3. Add monitoring
### Phase 5: Scaling (Month 2+)
10. Add Multi-Agent if needed
2. Add Routing if needed
3. Production optimization
-
## Case Studies: Pattern Selection in Action
### Case Study 1: Startup Support Bot
```
Constraints:
- Speed: <1 second
- Cost: <$0.01/call
- Quality: 80% OK
- Team: 2 engineers
Selection:
RAG (documents)
Tool Use (simple APIs)
Error Recovery
Result: Launched in 2 weeks
Cost: $0.005/call
Quality: 82%
User satisfaction: 4.2
```
-
### Case Study 2: Enterprise Research Platform
```
Constraints:
- Speed: <30 seconds acceptable
- Cost: $0.1/call OK
- Quality: 95%+ required
- Team: 8 engineers
Selection:
Agentic Loop (exploration)
Planning (multi-step)
Tool Use (multiple sources)
Memory (findings)
Reflection (quality)
HITL (review before publish)
Error Recovery
Result: Launched in 8 weeks
Cost: $0.08/call
Quality: 96%
User satisfaction: 4.8
```
-
### Case Study 3: Customer Support System
```
Constraints:
- Speed: 2-5 seconds
- Cost: $0.02/call
- Quality: 90%+
- Team: 12 engineers
- Safety: Medium (business use)
Selection:
Routing (classify issues)
RAG (knowledge base)
Tool Use (APIs)
Memory (customer history)
Reflection (response quality)
HITL (escalation)
Error Recovery
Result: Launched in 12 weeks
Cost: $0.018/call
Quality: 92%
Escalation rate: 12%
User satisfaction: 4.5
CSAT improvement: +35%
```
-
## Key Decisions Summary
### The 5 Critical Questions
1. **Speed**: How fast must this be?
- <1s → RAG-based
- 1-10s → Agentic Loop
- 10s+ → Full orchestration OK
1. **Quality**: How accurate must this be?
- 80% → Simple patterns
- 90% → Add Reflection/Planning
- 95%+ → Full stack needed
1. **Actions**: Must it interact with systems?
- No → RAG-focused
- Yes → Add Tool Use + Error Recovery
1. **Complexity**: Is the task multi-step/exploration?
- No → Single pass (RAG/Tool)
- Yes → Agentic Loop
1. **Safety**: Is oversight required?
- No → Autonomous OK
- Yes → Add HITL
---
## Quick Reference Card
```
PATTERN SELECTION QUICK GUIDE
Task Type Minimum Patterns
- ──────────────────────
Q&A from documents RAG + Error Recovery
Simple action Tool Use + Error Recovery
Multi-step task Planning + Tool Use
Autonomous agent Agentic Loop + Tools
Quality-critical + Reflection + CoT
Customer-facing + HITL
Learning over time + Memory
Large projects + Multi-Agent
Remember:
START SIMPLE, ADD AS NEEDED
```
-
## Iteration & Feedback Loop
Your pattern selection isn't final:
```
1. Select patterns
↓
2. Build & test
↓
3. Measure results
↓
4. Collect feedback
↓
5. Adjust patterns
↓
6. Repeat
```
**What to measure**:
- Quality/accuracy
- Latency
- Cost
- User satisfaction
- Error rates
- Adoption
**When to change patterns**:
- Quality below target → Add Reflection/CoT
- Too slow → Simplify, use RAG
- Too expensive → Remove Reflection, cache results
- Low adoption → Add HITL, Reflection
- Errors increasing → Add Error Recovery
- Complexity too high → Split into Multi-Agent
---
## Next: Implement Your Patterns
1. Choose your patterns using this framework
2. Read the detailed pattern guides
3. Implement Phase 1 (Core)
4. Test and measure
5. Add phases iteratively
6. Monitor and adjust
-
**Last Updated**: August 9, 2026