A practical flowchart to select the right agent pattern for your use case
Answer these questions in order to find your pattern:
Can you write out all the steps ahead of time?
-
✅ YES → You don't need an agent. Use a deterministic workflow (if-then logic, state machines).
- Example: E-commerce checkout flow
- Tools: Step Functions, Temporal, n8n
-
❌ NO → Continue to question 2
Does it require only one LLM call or one action?
-
✅ YES → You need a simple tool-calling agent or RAG system
- Use: Direct LLM call with function calling
- Example: "What's the weather?" → Call weather API → Return result
- Go to: Tool-Calling Strategies
-
❌ NO → Continue to question 3
Are there multiple sub-tasks that don't depend on each other?
-
✅ YES → Use parallel execution pattern
- Run tasks concurrently to save time
- Example: "Analyze this document for sentiment, key entities, and summary" (3 independent analyses)
- Go to: Parallel Execution
-
❌ NO → Continue to question 4
Does each step need the output from the previous step?
-
✅ YES → Use sequential chain pattern
- Linear pipeline where output flows to next step
- Example: "Research topic → Write outline → Draft article → Proofread"
- Go to: Sequential Chain
-
❌ NO → Continue to question 5
Do different inputs need different processing paths?
-
✅ YES → Use router pattern
- Central dispatcher routes to specialized agents/functions
- Example: Customer support routing to billing/technical/returns
- Go to: Router Pattern
-
❌ NO → Continue to question 6
Must it remember information across multiple interactions or steps?
-
✅ YES → You need a memory architecture
- Store and retrieve conversation history, facts, or working state
- Example: Personal assistant that remembers preferences and past interactions
- Go to: Memory Architectures
-
❌ NO → You likely need a ReAct agent (reason-act-observe loop)
Quick reference table:
| Your Need | Pattern | Complexity | Cost | Use When |
|---|---|---|---|---|
| Single API call | Tool Calling | ⭐ | $ | Simple function execution |
| Linear steps | Sequential Chain | ⭐⭐ | $$ | Recipe-like workflows |
| Independent tasks | Parallel Execution | ⭐⭐ | $$ | Speed is priority |
| Task routing | Router | ⭐⭐⭐ | $$$ | Multiple specialized domains |
| Context retention | Memory Architecture | ⭐⭐⭐⭐ | $$$$ | Conversational or stateful |
| Complex reasoning | ReAct Loop | ⭐⭐⭐⭐ | $$$$ | Open-ended problems |
Cost key: $ = <10¢/task, $$ = 10-50¢, $$$ = 50¢-$2, $$$$ = $2+
Requirements:
- Understand user intent
- Route to correct department
- Access knowledge base
- Remember conversation history
Decision path:
- Predictable? No (varied customer issues)
- Single-turn? No (multi-step conversation)
- Parallel? No (sequential interaction)
- Sequential? Sort of, but varies by intent
- Routing? ✅ YES → Router Pattern
- Memory? ✅ YES → Add Memory Architecture
Pattern: Router + Memory
Requirements:
- Search multiple sources
- Synthesize findings
- Generate report
Decision path:
- Predictable? No (depends on query)
- Single-turn? No (multi-step research)
- Parallel? ✅ YES → Search multiple sources concurrently
- Sequential? ✅ YES → Search → Synthesize → Generate
Pattern: Parallel Execution (for search) + Sequential Chain (for synthesis)
Requirements:
- Analyze code quality
- Check security issues
- Verify tests
- Suggest improvements
Decision path:
- Predictable? Somewhat (but requires reasoning)
- Single-turn? No
- Parallel? ✅ YES → Run quality, security, test checks simultaneously
Pattern: Parallel Execution + Tool Calling
Requirements:
- Check flight availability
- Book hotel based on flight
- Recommend restaurants near hotel
- Create itinerary
Decision path:
- Predictable? No (depends on availability)
- Single-turn? No
- Parallel? No (hotel depends on flight)
- Sequential? ✅ YES → Flight → Hotel → Restaurants → Itinerary
Pattern: Sequential Chain + Tool Calling
Real-world agents often combine patterns:
- Route intent → Execute specific workflow
- Example: "Tech support" → Diagnose → Fix → Verify
- Gather data in parallel → Process sequentially
- Example: Fetch 5 sources → Synthesize → Generate report
- Most production agents need memory
- Add memory layer to maintain context
Bad: Using LLM to decide "if payment received, ship order" Good: Simple if-then logic
Why: Agents add latency, cost, and unpredictability
Bad: Calling 5 APIs one at a time Good: Concurrent API calls
Why: Wastes time; user waits 5x longer
Bad: Multi-agent system for "translate this text" Good: Direct API call to translation LLM
Why: Over-engineering kills performance and budget
Best practice: Start with the simplest pattern, then upgrade:
- Try tool calling - Most tasks start here
- Add sequencing - If you need ordered steps
- Add parallelism - If you have independent tasks
- Add routing - If you have multiple domains
- Add memory - If you need context
- Add hierarchy - Only for very complex systems
- Identified your pattern? → Jump to the specific pattern documentation
- Need multiple patterns? → Read Tool-Calling Strategies first (foundational)
- Still unsure? → Review What is an Agent? or check Case Studies
flowchart TD
Start[Start: What are you building?] --> Q1{Solution path<br/>predictable?}
Q1 -->|Yes| Workflow[Use Workflow<br/>not Agent]
Q1 -->|No| Q2{Single-turn<br/>task?}
Q2 -->|Yes| ToolCall[Tool-Calling Pattern]
Q2 -->|No| Q3{Tasks run<br/>independently?}
Q3 -->|Yes| Parallel[Parallel Execution]
Q3 -->|No| Q4{Steps sequential<br/>and dependent?}
Q4 -->|Yes| Sequential[Sequential Chain]
Q4 -->|No| Q5{Route to<br/>specialized handlers?}
Q5 -->|Yes| Router[Router Pattern]
Q5 -->|No| Q6{Need long-term<br/>context?}
Q6 -->|Yes| Memory[Memory Architecture]
Q6 -->|No| ReAct[ReAct Loop]
ToolCall --> Docs1[Read: Tool-Calling Strategies]
Parallel --> Docs2[Read: Parallel Execution]
Sequential --> Docs3[Read: Sequential Chain]
Router --> Docs4[Read: Router Pattern]
Memory --> Docs5[Read: Memory Architectures]
Can't see the flowchart? Use the questions above - same logic, more detail.