Introduction to Agentic AI14 of 18 steps (78%)

How Agents Plan: Thinking Before Acting

Not all agent tasks are created equal. Some tasks are simple enough that the agent can just start, use a tool, and give you an answer. Others are complex enough that jumping straight into action leads to mistakes, wasted steps, or a result that solves the wrong problem.

This is where planning comes in. Planning is what an agent does before it starts using tools, to make sure it is working toward the right goal in a sensible order.

Why planning matters

Imagine asking an agent to write a competitive analysis of five companies for a board presentation. There is no single tool that produces this directly. The agent needs to research each company, find comparable data points, structure a comparison, and write it in a format appropriate for a board. That is at least 15 to 20 steps.

If the agent just starts taking actions without a plan, it might research company 1 in depth, then realize halfway through company 3 that it is using a different data structure than it used for company 1, and have to go back and redo work. Or it might finish all the research and then realize it never established what data points to compare across companies.

A little planning at the start prevents a lot of rework in the middle.

The basic think-act-observe loop

At its simplest, planning in an agent looks like this:

  1. Read the goal
  2. Think about what to do
  3. Do one thing
  4. Observe what happened
  5. Think about what to do next
  6. Repeat until done

This cycle is the foundation of nearly every agentic framework. The thinking steps are where planning happens. The doing steps are where tools get used.

The key insight is that thinking and acting are interleaved. The agent does not plan everything at the start and then execute. It keeps checking in with its own reasoning as the task unfolds and adjusts based on what it finds.

ReAct: the pattern that gave this a name

ReAct (short for Reasoning and Acting) is a prompting pattern that formalized the think-act-observe loop. The idea is to get the model to write out its reasoning before taking each action, so that the reasoning and the action are explicitly connected.

A ReAct trace for a simple research task might look like this:

Thought: I need to find the current pricing for Notion's team plan.
         I should search for this directly rather than relying on training data,
         since pricing changes frequently.
Action: search_web("Notion team plan pricing 2024")
Observation: The search returned Notion's pricing page. The team plan is $16 per
             person per month, billed annually.
Thought: I have the Notion price. Now I need the same for Coda and ClickUp
         to complete the comparison.
Action: search_web("Coda team plan pricing 2024")
...

By writing the thought before each action, the model is less likely to take an action that does not follow from its reasoning. The trace is also readable, which makes debugging much easier. When something goes wrong, you can see exactly which thought led to which action.

Chain-of-thought reasoning

Chain-of-thought is a related idea. When you ask a model to "think step by step" before answering a complex question, it produces better answers because it is forced to work through the reasoning rather than jumping to a conclusion.

For agents, chain-of-thought is most useful during the planning phase. Before the agent starts using tools, you can prompt it to write out:

  • What it understands the goal to be
  • What information it will need
  • What steps it expects to take
  • What the output should look like

This planning step catches a lot of misunderstandings early, before they get baked into 10 steps of work.

Task decomposition: breaking big goals into small steps

For complex tasks, the most reliable planning approach is decomposition: taking a big goal and breaking it into a list of smaller, concrete steps.

Here is what this looks like for the competitive analysis example:

Goal: Write a competitive analysis of Notion, Coda, ClickUp, Linear,
      and Asana for a board presentation.

Decomposed steps:
1. Decide on 5 data points to compare across all companies
   (pricing, user count, funding, key features, target market)
2. For each company, search for current information on each data point
3. Build a comparison table
4. Identify the two or three most significant differences
5. Write an executive summary (2 paragraphs)
6. Format the full output as a slide-ready document

Now the agent has a plan. It can work through the steps in order, and at each step it knows exactly what it is trying to produce. If something unexpected comes up (the user count for one company is hard to find), the agent can note it and move on rather than getting stuck.

When to plan and when to just start

Planning adds overhead. For simple tasks, it is unnecessary. Here is a rough guide:

Just start: The task has two to four steps, the goal is clear, and mistakes are easy to correct. Searching for something, summarizing a document, sending a message.

Brief plan first: The task has five to ten steps, or involves combining information from multiple sources. A research summary, a report, a data extraction task.

Detailed plan with checkpoints: The task is long, involves irreversible actions, or requires consistent decisions across many items. Processing hundreds of records, sending personalized emails to a list, making structured changes across a codebase.

Building the right amount of planning into a task is one of the judgment calls that separates well-designed agents from ones that are frustrating to use.

Common planning failures to watch for

Misunderstanding the goal The agent starts with the wrong interpretation of what you asked for. The fix is to have the agent restate the goal in its own words before starting, so you can catch mismatches early.

Over-planning The agent spends so much time on the plan that it never gets to the task. This is rare with current models but more common when prompts are overly focused on thoroughness.

Plans that do not account for what might go wrong A good plan includes: "If I cannot find X, I will do Y instead." Pure happy-path planning fails when real-world messiness shows up.

Not updating the plan when something changes If step 4 reveals information that makes step 6 irrelevant, the agent should update its plan rather than continuing to follow the original one mechanically.

A practical starting point

If you want to add planning to an agent you are building, the simplest approach is to add one instruction at the start of the system prompt:

Before you take any action, write out your plan: what steps you will take
and in what order. Then follow the plan, updating it if what you find
requires a change.

That single addition improves the reliability of most agents on complex tasks, with almost no downside for simple ones.

In the next step, you will explore the best AI tools for Build AI agents and multi-agent workflows. Browse the options, pick one that fits your workflow, and try it before continuing.

Discussion

  • Loading…

← Back to learning path