Modern AI Engineering

Lesson 11.5 · 23 min · video lesson

Plan-and-Execute: Tackling Complex Tasks in Two Phases

Should an agent decide each move as it goes, or think through the whole route before taking the first step?

In short: A Plan-and-Execute agent splits the work in two: a planner (usually a strong LLM) writes the full list of steps up front, and an executor carries them out one by one, often with a cheaper model or plain code. When a step fails or reveals something new, a replanner revises the remaining plan. This gives structure, lower cost and easier oversight on long tasks, at the price of less flexibility than step-by-step agents like ReAct.

What you will learn

  • What is a Plan-and-Execute Agent
  • Plan-and-Execute Agent vs AI Agent
  • Anatomy of a Plan-and-Execute Agent
  • How a Plan-and-Execute Agent Works
  • A Full Trace Example
  • Plan-and-Execute Agent vs ReAct Agent
  • Common Failure Modes and How to Fix Them
  • Quick Summary

In this lesson

  1. What is a Plan-and-Execute agent?
  2. Plan-and-Execute agent vs a basic AI agent
  3. Anatomy of a Plan-and-Execute agent
  4. How a Plan-and-Execute agent works
  5. A full trace example
  6. Plan-and-Execute agent vs ReAct agent
  7. Common failure modes and how to fix them
  8. Worked example, step by step
  9. Practice: try it yourself

Key terms in this lesson

Plan-and-Execute agent
An agent that writes a complete plan first and then executes its steps, revising the plan when needed.
Planner
The model call that turns a goal into an ordered list of concrete steps.
Executor
The component (smaller model or code) that carries out one plan step with tools.
Replanner
The component that reviews progress and rewrites the remaining steps, or declares the task done.
Dependency
A relationship where one step needs another step's result before it can run.
Stale plan
A plan that no longer fits the situation because results differed from what the planner assumed.

This lesson is part of the Generative AI Engineering and Complete AI Engineer tracks. See plans and pricing to open the full lesson, its video, labs and quiz, or try the free lesson first (free account needed).

← 11.4 ReAct Agents: Interleaving Reasoning and Acting · 11.6 Reflection Agents: Self-Critique for Higher-Quality Outputs →