Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Agent Planning Strategies

Hello! In our previous lessons, we've established that an agent can Reason about a problem (using frameworks like ReAct) and Act on the world (by using tools). But what happens when a user's request isn't a single, simple action? What if it's a complex, multi-step goal like "Plan a marketing campaign for our new product launch"?

This is where planning comes in. This lesson addresses the learning outcome: Explain common planning strategies agents use, such as task decomposition. We'll explore how an agent can create a coherent strategy to tackle complex problems, moving from a single thought-action loop to a structured sequence of operations.

By the end of this lesson, you will understand:

  • The core concept of task decomposition.
  • The difference between static and dynamic planning.
  • Advanced planning strategies like Tree-of-Thoughts and Graph-of-Thoughts.

Let's start with the foundational skill of any good planner: breaking things down.

The Foundation: Task Decomposition

As a software engineer, you know that tackling a large project begins with breaking it down into smaller, manageable tickets or functions. AI agents must learn the same skill. A vague user request needs to be transformed into a concrete series of steps. This process is called task decomposition.

Without it, an agent facing a complex prompt might get confused, miss crucial steps, or execute them in the wrong order. Task decomposition is the bridge between understanding a high-level goal and creating an actionable plan.

The following article provides an excellent introduction to this concept, explaining why it's essential and what makes a good subtask.

Breaking Down Tasks: Master Task Decomposition for AI Agents

The article 'Breaking Down Tasks: Master Task Decomposition for AI Agents' by Michael Brenndoerfer clearly explains the 'what' and 'why' of this fundamental planning step.

Please read the first three sections, starting from the top down to 'The Core Idea: Think First, Act Second'. Focus on why decomposition is necessary and the three characteristics of an effective subtask: specific, achievable, and ordered.

As the article highlights, the goal is to transform ambiguity into a clear, executable plan. The simplest way to do this is to have the agent create a complete plan before it starts working.

Strategy 1: "Decomposition-First" or Static Planning

In this approach, the agent first decomposes the entire goal into a list of sub-goals and then executes them, typically one by one. This is a straightforward and predictable pattern.

LLM Agent Planning Strategies: Decomposition-First vs. Interleaved
This diagram compares two planning approaches. On the left (a), 'Decomposition-First' shows the agent creating a full plan of all sub-goals before starting execution. On the right (b), 'Interleaved' planning shows the agent dynamically mixing planning and execution steps, which we will discuss later.

For now, let's focus on the 'Decomposition-First' model. The agent's first job is to generate the plan. With modern LLMs, we can prompt the model to output this plan in a structured format like JSON, which your application can then parse and use to guide the agent's execution.

Let's continue with the same article to see a practical example of how this is implemented.

Breaking Down Tasks: Master Task Decomposition for AI Agents

This next section of the 'Breaking Down Tasks' article demonstrates how to prompt an LLM to generate a structured list of subtasks.

Please read the sections 'A First Example: Breaking Down a Complex Request' and 'Making Decomposition Practical'. Observe how the prompt explicitly asks for a JSON output and how the resulting plan is structured with IDs and status fields, making it ready for an execution loop in your code.

This static, upfront planning is effective for tasks where the steps are predictable. However, many real-world problems are not so straightforward. What happens if a step fails, or if the result of one step changes the requirements for the next? This requires a more dynamic approach.

Strategy 2: "Plan and Execute" with Replanning

A more robust strategy is the Plan and Execute pattern. Here, the agent still creates an initial plan, but it has the ability to revise or re-plan as it executes. This introduces a feedback loop that makes the agent more adaptive.

The core components are:

  1. Planner: An LLM call that takes the user request and creates an initial plan (a list of tasks).
  2. Executor: A component that takes a single task from the plan and executes it, often using a tool.
  3. Replanner: An optional LLM call that assesses the progress so far and decides whether to modify the rest of the plan, add new steps, or finish.

This video from LangChain introduces the concept and how it serves as an improvement over simpler agent architectures.

LangGraph: Planning Agents

The video 'LangGraph: Planning Agents' introduces the 'plan and execute' design pattern and its components.

Please watch the segment from 00:02:32 to 00:03:35. This section explains the roles of the planner, executor, and the optional replanner, which together form a more dynamic and robust agent.

This ability to re-plan is a step towards more sophisticated reasoning. But what if we want the agent to consider multiple possible plans from the very beginning?

Strategy 3: Exploring Multiple Futures with Tree-of-Thoughts (ToT)

For complex problems, the first plan you think of isn't always the best. The Tree-of-Thoughts (ToT) framework allows an agent to explore multiple reasoning paths simultaneously. Instead of committing to a single sequence of steps, the agent generates several possible "next steps" at each stage, forming a tree of possibilities.

Tree of Thoughts (ToT) Prompting
This image shows the evolution of prompting techniques. On the far right, Tree of Thoughts (d) illustrates how an agent can generate multiple intermediate thoughts, explore different branches of reasoning, and ultimately select the most promising path to the solution.

ToT treats planning as a search problem over a tree of ideas.

  1. Generate: The LLM proposes multiple possible thoughts or sub-goals.
  2. Evaluate: A separate process (or another LLM call) scores how promising each thought is.
  3. Search: The agent uses a search algorithm (like breadth-first or depth-first search) to decide which branch of the tree to explore next. It can backtrack from dead ends and pursue more promising routes.

This approach is powerful for puzzles or strategic tasks where lookahead is critical. The following article provides a concise explanation of how ToT improves upon simpler linear reasoning.

Dynamic Planning in LLM Agents: From ReAct to Tree-of-Thoughts

The article 'Dynamic Planning in LLM Agents' by Tao-HPU explains how Tree-of-Thoughts moves beyond the linear constraints of simpler frameworks.

Read the section titled 'Tree-of-Thoughts: Deliberate Exploration'. Focus on the core idea: treating reasoning as a search problem and the ability to backtrack from unpromising paths.

Strategy 4: Advanced Structures with Graph-of-Thoughts (GoT)

Human thought isn't always a neat, branching tree. Sometimes we merge ideas from different lines of reasoning or loop back to refine an earlier thought. The Graph-of-Thoughts (GoT) framework generalizes ToT to allow for these more complex reasoning structures.

In GoT, thoughts are nodes in a graph, and dependencies are edges. This enables operations that a tree structure can't handle, such as:

  • Aggregation: Merging the results from multiple reasoning paths.
  • Refinement: Creating cycles to iteratively improve a thought.

A key concept in some GoT implementations is the separation between the plan's structure and its state. As an engineer, you can think of this as defining a program (Graph of Operations) and then executing it while tracking its variables (Graph Reasoning State).

The following video explains these components using a clear, practical example.

Graph-of-Thoughts (GoT) for AI reasoning Agents

The video 'Graph-of-Thoughts (GoT) for AI reasoning Agents' by Discover AI breaks down the architecture of a GoT system.

Please watch these two key segments: Core Components (21:59 - 25:22): This part introduces the 'Controller' and its two crucial units: the 'Graph of Operations' (GoO), which is the user-defined plan structure, and the 'Graph Reasoning State' (GRS), which tracks the live state of the reasoning process. A Simple Example (25:22 - 28:37): This segment walks through a 'planet classification' example, showing exactly how the pre-defined GoO dictates the flow and how the GRS is updated at each step. This makes the abstract concepts very concrete.

The GoT approach represents a highly structured and powerful method for planning, where the reasoning flow itself is an engineered component. It's especially useful for complex domains where the problem-solving steps are well-understood and can be encoded into a graph by a domain expert.

Conclusion

In this lesson, we explored how AI agents move from simple reaction to deliberate planning. You've learned that handling complex tasks requires breaking them down into smaller pieces and having a strategy to execute them.

Key Takeaways:

  • Task Decomposition is Foundational: All planning starts with breaking a large, ambiguous goal into small, specific, and actionable subtasks.
  • Plans Can Be Static or Dynamic: The simplest strategy is to create a full plan upfront ("Decomposition-First"). More robust strategies like "Plan and Execute" allow the agent to adapt and re-plan as it goes.
  • Advanced Strategies Treat Planning as Search: Tree-of-Thoughts (ToT) allows an agent to explore multiple potential plans in parallel, like a search algorithm. Graph-of-Thoughts (GoT) generalizes this to support even more complex reasoning patterns like merging and refinement.
  • There's a Trade-off: More sophisticated planning strategies offer more power and flexibility but come with increased complexity and computational cost.

Now that we understand how an agent can create and follow a plan, a new question arises: how does it keep track of what it has done, what it has learned, and what it needs to do next? This brings us to our next lesson on agent memory.

Can't find a good explanation? Sign up and we'll make it for you

Sign up