AI Agents for Beginners

Module 8 of 14

Module 8: Planning and Reasoning

5 min read816 words
What you'll learn
Explain task decompositionDescribe step-by-step execution and agent loopsKnow when planning helpsKnow when a simple workflow is the better choice

"Big tasks aren't solved in one leap. An agent that plans breaks a mountain into steps — and climbs it one step at a time."

Learning Objectives

By the end of this module, you will be able to:

  • Explain task decomposition
  • Describe step-by-step execution and agent loops
  • Know when planning helps
  • Know when a simple workflow is the better choice

1. Task Decomposition

Planning starts with task decomposition — breaking one big goal into smaller, doable steps. Ask an agent to "plan a birthday party," and a good plan might be: pick a date → make a guest list → choose a venue → send invites → order a cake.

Each sub-step is small enough to actually do. This is exactly how humans tackle big projects, and agents borrow the trick. A giant, fuzzy goal like "throw a party" paralyzes both people and agents; a short checklist of concrete steps is something you can start on immediately.

Key idea: A vague goal is hard to act on; a list of small steps is easy. Planning turns "do this big thing" into "do these five small things in order" — which the agent can then execute one at a time through its loop.

Explain like I'm new: Planning is just writing a to-do list before you start. You wouldn't clean an entire house in one motion — you'd say "kitchen, then bathroom, then bedroom" and knock them out one by one. An agent's plan is that same to-do list, written by the AI for itself.

2. Step-by-Step Execution and Loops

Once there's a plan, the agent works through it using the loop from Module 2: do a step, observe the result, and adjust the plan if needed. If step 3 fails, a good agent notices and re-plans instead of blindly continuing. This "plan, act, re-plan" ability is what lets agents handle messy, real-world tasks.

Real-world use case: A research agent plans to check three sources. Source two turns out to be paywalled — a dead end. Instead of stalling, it re-plans on the spot: "that source is unavailable; I'll find an alternative." That flexibility, reacting to what actually happens rather than to what it expected, is what separates a robust agent from a brittle script.

There are two common styles here, and it helps to know both. In plan-first, the agent writes out the whole plan up front, then executes it step by step — good when the task is well understood and you want to review the plan before it runs. In plan-as-you-go, the agent decides only the next step each time, using what it just learned — better when the task is uncertain and an up-front plan would just be guesswork. Many real agents blend the two: sketch a rough plan, then adjust it as reality comes in. Neither is "correct" everywhere; the trick is matching the style to how predictable the task is.

3. When Planning Helps

Planning shines when a task is:

  • Multi-step — it takes several actions to finish.
  • Uncertain — you don't know all the steps up front.
  • Adaptive — the right next step depends on what happened last.

Research and travel planning are classic examples: you can't script every step because it depends on what you find. If the flight you wanted is sold out, the plan has to change — and only an agent that plans and re-plans can handle that gracefully.

4. When a Simple Workflow Is Better

Here's the counter-intuitive part: planning isn't always worth it. If a task is the same every time, a fixed workflow (Module 4) is faster, cheaper, and more reliable than an agent planning from scratch.

Common mistake: Adding fancy planning to a task that never changes. If the steps are always "read file → reformat → save," just script those steps. Reserve open-ended planning for problems that genuinely can't be pinned down in advance.

Think of it this way: you don't plan your route to the kitchen — you just walk there, because it never changes. But you do plan a road trip to a new city, because the details differ every time. Match the effort to the task: fixed jobs get workflows, unpredictable ones get planning.

Key Takeaway: Planning means decomposing a big goal into small steps, then executing them through the loop and re-planning when something fails. It's essential for multi-step, uncertain, adaptive tasks — but for predictable, repeatable work, a simple fixed workflow beats a planning agent every time.

Further Learning