In this article
Problem: Complex tasks require careful planning but straightforward execution. Using an expensive model for all steps is wasteful; using a cheap model to plan produces poor plans.
Solution: Use a powerful model (GPT-4, Claude 3.5 Sonnet) to generate a complete step-by-step plan, then execute each step with a cheaper, faster model (GPT-4o-mini, Claude Haiku).
Implementation:
- Plan: Call the planner model with: "Generate a detailed step-by-step plan to [goal]. Return as a JSON array of steps."
- Store plan: Persist the plan; allow human review if needed
- Execute: For each step, call the executor model with the step description + context from previous steps
- Replan trigger: If a step fails or produces unexpected results, call the planner model to revise the remaining plan
Trade-Offs:
- โ Pro: 50-70% cost reduction vs using the expensive model for all steps
- โ Pro: Plan is inspectable and modifiable before execution
- โ Con: Planner-executor mismatch: planner may assume capabilities the executor lacks
- โ Con: Replanning adds latency
When To Use: Research tasks, code generation with multiple files, data analysis pipelines, content creation workflows. When to avoid: Simple tasks where a single prompt suffices; tasks with highly dynamic, unpredictable steps.

