Lesson 06.02 · Phase 06 · Planning & Reasoning
Plan-and-execute
Have the model write the whole plan once, check it in code before anything runs, then execute it without asking the model again. You trade adaptability for fewer calls and a plan you can read, validate and approve.
Learning objectives
- Implement plan-and-execute: a planner call that returns a JSON plan, validation, and an executor that runs it without further model calls.
- Validate a plan with a dry run: simulate each step's preconditions and effects to catch unknown tools, wrong order and missed goals before acting.
- Feed validation problems back to the planner for one repair, with a safe stop if it fails again.
- Compare model calls and behaviour with a ReAct agent that chooses one step at a time.
A ReAct agent (Phase 3 · Lesson 2) calls the model before every action. For a six-step release that is seven model calls, each re-reading the growing history, and nobody can see the whole plan until it's done. If step 4 publishes something that shouldn't have been published, you find out after the fact.
Loading the full lesson…