Skip to content

Planning: breaking a goal into steps

This is lesson 7 of Track 20 (AI Agents and Tool Use) and the fourth lesson of Phase 2, The design patterns that make agents work. So far every agent in the track has lived in the moment: each trip around the loop, it read the current state, picked one move, and acted. That reactive style is enough until the task gets big.

This lesson is about the planning turn: deciding the shape of the whole job before starting it. The core operation is decomposition, breaking one large goal into an ordered set of smaller sub-tasks whose order captures their dependencies. The lesson traces a plan being built and then executed step by step, shows how an agent replans when a step’s result contradicts the plan, and gives the rule for getting the grain size right (each step a single clear intention, neither the goal in disguise nor a keystroke transcript). It closes on the recurring tradeoff: plan only when the task is large enough to earn the overhead.

The track structurally mirrors Microsoft’s “AI Agents for Beginners” (MIT-licensed), with the Berkeley CS294 LLM Agents course as a depth reference. Full attribution is in this lesson’s references.

This lesson steps up a level from the design patterns before it. Tool use, memory, and retrieval each gave the agent a new move it could make inside the loop; planning is about deciding which moves to make, and in what order, before acting. It builds directly on the agent loop established in lesson 1 and reuses the self-correction instinct seen with tool failures and weak retrievals, now lifted to the level of the whole task. The next lesson, Many agents working together, follows naturally: a plan often names sub-tasks that are practically separate jobs, which raises the question of whether one agent should do all of them or each should go to an agent built for it.

Prerequisites: the earlier lessons in the track, especially What makes an AI an “agent” (planning is a new layer on top of the perceive-decide-act loop) and Agents that retrieve their own information (the immediately prior lesson; replanning is the same self-correction instinct seen there with weak retrievals). You do not need to code. If you understand that an agent works by looping over tool calls, you have the background this lesson assumes.

  • Explain why a purely reactive agent breaks down on large, multi-step tasks
  • Describe how an agent decomposes a goal into an ordered set of sub-tasks whose order captures their dependencies
  • Distinguish plan-then-execute from replanning and say when each fits
  • Choose the right grain size for plan steps (neither the goal in disguise nor a keystroke transcript)
  • Judge when a task is large enough that planning earns its overhead
  • Read time: about 10 minutes
  • Practice time: about 15 minutes (a self-check, two applied exercises on decomposition and replanning, and flashcards)
  • Difficulty: standard