After testing hundreds of prompts across production AI agents, we've distilled the patterns that consistently deliver reliable results. This playbook covers six core patterns—from simple few-shot learning to complex ReAct agents—with templates you can copy directly into your projects.
Each pattern includes effectiveness ratings based on our testing, complexity indicators to help you choose appropriately, and real examples showing input/output pairs. The goal is not to use the most sophisticated pattern, but to use the right pattern for your specific task.
- Multi-step reasoning problems
- Mathematical calculations
- Complex decision-making scenarios
- Tasks requiring logical deduction
You are a helpful assistant. Think through this step by step:
1. First, understand what is being asked
2. Break down the problem into components
3. Reason through each component
4. Synthesize your findings
5. Provide your final answer
Question: {user_question}
Let me think through this step by step...If a train travels 120 miles in 2 hours, and then 180 miles in 3 hours, what is its average speed for the entire journey?
Step 1: Total distance = 120 + 180 = 300 miles. Step 2: Total time = 2 + 3 = 5 hours. Step 3: Average speed = 300 / 5 = 60 mph.
Start Simple, Add Complexity
Begin with zero-shot or few-shot patterns. Only add CoT or ReAct when simple approaches fail on your specific task.
Test Across Models
Patterns that work well on GPT-4 may need adjustment for Claude or open-source models. Always validate on your target model.
Measure What Matters
Track accuracy, latency, and cost. A pattern with 5% higher accuracy but 3x the tokens may not be worth it for your use case.
Version Your Prompts
Treat prompts like code. Use git, track changes, and A/B test variations before rolling out to production.
Which Pattern Should I Use?
Is format more important than reasoning?
Use Structured Output or Few-Shot for consistent formatting needs.
Does the task require multi-step reasoning?
Use Chain-of-Thought for complex logic without external tools.
Does the agent need to use external tools?
Use ReAct for agents that search, calculate, or interact with APIs.
Is consistency critical and latency acceptable?
Use Self-Consistency for high-stakes decisions where accuracy trumps speed.
Ready to Build?
Copy these patterns into your project and start building reliable AI agents today.