Agentic Patterns: Plan-Execute-Verify
First make a plan, then execute step by step, then verify against acceptance criteria — beats one-shot.
Why Plan First?
One-shot code generation works for tiny tasks ("write a fizzbuzz"). For real software changes, the agent should:
- Plan — decompose the task into steps
- Execute — implement each step
- Verify — test, lint, run
- Iterate — fix until verified
Step 1: Plan
Ask the model to produce a structured plan:
PLAN_PROMPT = '''
You are a senior engineer. Given this task, produce a JSON plan:
{steps: [{description, files_to_touch: [str], test_commands: [str]}], risks: [str]}
Task: {user_task}
'''All lessons in this course
- Agentic Patterns: Plan-Execute-Verify
- Tool Surfaces for Coding (Read, Edit, Bash)
- Iterative Self-Correction Loops
- SWE-Agent and OpenDevin Architectures