Learn how AI agents break down complex goals into manageable subtasks. Understand task decomposition strategies, sequential vs parallel tasks, and practical implementation with Claude Sonnet 4.5.

This article is part of the free-to-read AI Agent Handbook
Breaking Down Tasks (Task Decomposition)
Here's a question you've probably faced in your own life: when someone gives you a big, complicated task, what's the first thing you do?
Most of us don't just dive in randomly. We pause. We think. We break the big task into smaller, more manageable pieces. If someone asks you to "plan a weekend getaway," you don't immediately book a hotel. You first figure out where you might go, then check transportation options, then look at accommodations, and so on. You decompose the large goal into a sequence of concrete steps.
Our AI assistant needs to learn this same skill. Up until now, we've built an agent that can reason, use tools, remember context, and navigate its environment. But when you give it a complex, multi-step request, it needs a way to organize its approach. It needs to plan.
Task decomposition is the foundation of planning. It's the art of taking a big, fuzzy goal and breaking it down into specific, achievable subtasks. In this section, we'll explore why this matters, how agents can do it, and what it looks like in practice.
Why Agents Need to Decompose Tasks
Let's see what happens when an agent tries to handle a complex request without decomposition. Imagine you ask your assistant:
"Help me prepare for my client presentation next Friday. I need to research the client's industry, create a slide deck, practice my delivery, and send a meeting invite to the team."
That's actually four different subtasks bundled into one request. If the agent tries to do everything at once, it might:
- Miss one of the subtasks entirely
- Start working on steps in the wrong order (like practicing before creating the slides)
- Get overwhelmed and produce a confused or incomplete response
Here's what an unprepared agent might output:
The model might respond with something like:
That's not terrible, but notice what's missing: the agent hasn't actually done anything. It's given you advice, but it hasn't organized the work into actionable steps, determined what order to tackle them, or begun executing any of them.
Compare that to what we want: an agent that breaks down the request into clear subtasks and can work through them systematically.
The Core Idea: Think First, Act Second
Task decomposition follows a simple but powerful principle: before you start working, figure out what work needs to be done.
This is different from the chain-of-thought reasoning we covered earlier. Chain-of-thought helps an agent think through a single problem step by step. Task decomposition is one level higher: it's about identifying multiple distinct problems that need to be solved, and organizing them into a coherent plan.
Think of it like the difference between:
- Reasoning: "How do I calculate the answer to this math problem?" (thinking through one task)
- Decomposition: "This assignment has three math problems, a written explanation, and a graph. Let me tackle them one at a time." (organizing multiple tasks)
For our assistant, task decomposition means taking a user request and generating a list of subtasks. Each subtask should be:
- Specific: Clear enough that the agent knows exactly what to do
- Achievable: Something the agent can actually accomplish with its available tools and capabilities
- Ordered: Arranged in a logical sequence where later steps can build on earlier ones
Let's see what this looks like in practice.
A First Example: Breaking Down a Complex Request
Let's build an agent that can decompose a multi-step request. We'll use Claude Sonnet 4.5 because of its strong reasoning capabilities, and we'll explicitly prompt it to break down the task before doing anything else.
First, we'll create a function that prompts the model to decompose a task:
Now let's test it with our presentation example:
When you run this, the agent might produce:
Notice what happened here. The agent took our messy, compound request and turned it into a clean, ordered list. Each item is specific enough to guide action, and they're arranged in a sensible sequence (you wouldn't practice your delivery before creating the slides).
This is the heart of task decomposition: transforming ambiguity into clarity.
Decomposing Different Types of Tasks
Task decomposition isn't one-size-fits-all. Different kinds of requests need different kinds of breakdowns. Let's explore a few scenarios to build intuition.
Sequential Tasks
Some tasks have a natural order where each step depends on the previous one. Our presentation example is like this: you need to do research before creating slides, and you need slides before you can practice.
Notice the dependencies: you can't book accommodation until you've chosen a destination. You can't create a packing list until you know the weather. The agent needs to recognize these logical dependencies.
Parallel Tasks
Other tasks can be done simultaneously or in any order. If someone asks you to "clean up my inbox, check my calendar, and get a weather update," there's no dependency between these subtasks. The agent could do them in any sequence, or even (in a more advanced system) do them in parallel.
The first three subtasks can happen in any order. Only the last one (compiling the summary) depends on the others.
Nested Tasks
Sometimes a subtask is itself complex enough to need further decomposition. This is where planning gets interesting: you might break down a task, then break down one of the subtasks, creating a hierarchy.
For now, we'll keep things simple with flat lists. But as we build more sophisticated agents, this kind of hierarchical decomposition becomes powerful.
Guiding the Agent's Decomposition
The way you prompt the agent significantly affects the quality of its task breakdown. Here are a few techniques that work well:
Be Explicit About What You Want
Tell the agent to decompose the task. Don't assume it will do so automatically.
Ask for Ordering and Dependencies
Encourage the agent to think about sequence:
Specify the Level of Detail
Sometimes you want high-level subtasks; sometimes you want very granular steps. Make this clear:
Making Decomposition Practical
Let's build a more complete version of our decomposition system that our assistant can actually use. We'll add structure to make it easier to work with the resulting subtask list.
First, here's a class that handles task decomposition:
Now let's use it:
This gives us a structured plan that we can later execute. Each subtask has an ID (for reference), a description (what to do), and a status (to track progress).
Output might look like:
Now our assistant has a concrete plan. In the next sections, we'll see how to actually execute these steps.
When Decomposition Goes Wrong
Task decomposition is powerful, but it's not foolproof. Let's look at some common issues and how to address them.
Too Vague
Sometimes the agent creates subtasks that are still too broad:
These aren't specific enough to guide action. You want concrete, actionable steps. To fix this, prompt for more detail or give examples of the level of specificity you want.
Wrong Order
The agent might list steps in an illogical sequence:
Obviously, you need to decide where to go before booking flights. If this happens, you can either prompt the agent to reconsider the ordering or manually reorder the steps.
Missing Steps
The agent might overlook important subtasks:
What about planning the menu? Buying groceries? Setting the table? If you notice gaps, you can prompt the agent to expand its list or add missing steps manually.
The good news is that as models get better at reasoning, these issues become less frequent. And even when they occur, having some plan (even an imperfect one) is usually better than having no plan at all.
Connecting to What We've Learned
Task decomposition builds directly on the concepts we've covered in earlier chapters:
From Reasoning (Chapter 4): We learned that agents can think step by step using chain-of-thought prompting. Task decomposition applies this same idea at a higher level: instead of thinking through the steps to solve one problem, we're identifying the multiple problems that need to be solved.
From Tools (Chapter 5): When the agent breaks down a task, it can identify which subtasks need tools. "Research the client's industry" might require a web search tool. "Send a meeting invite" might require a calendar API. Decomposition helps the agent figure out what tools it needs and when.
From Memory (Chapter 6): As the agent works through a plan, it needs to remember what it's already done and what comes next. Task decomposition creates a structure that memory can track.
From State (Chapter 7): The list of subtasks becomes part of the agent's state. The agent knows "I'm currently on step 3 of 5" or "I've completed the first two subtasks and I'm waiting for user input before continuing."
Task decomposition ties all these pieces together. It's the bridge between understanding what the user wants and actually getting it done.
Looking Ahead
We've now seen how an agent can break down a complex request into manageable subtasks. This is the first and most crucial step of planning: figuring out what work needs to happen.
In the next section, we'll explore how the agent can execute this plan. We'll see how it can work through the subtasks one by one, using its tools and reasoning capabilities to complete each step, and how it can handle situations where things don't go quite as expected.
For now, remember this: when faced with complexity, the best first move is often to step back and break things down. Our assistant is learning to do exactly that.
Glossary
Task Decomposition: The process of breaking down a complex goal or request into smaller, specific, actionable subtasks. This makes large problems more manageable and ensures nothing important gets overlooked.
Subtask: An individual, concrete step within a larger task. Good subtasks are specific enough to be directly actionable and are arranged in a logical order.
Sequential Dependency: When one subtask must be completed before another can begin. For example, you must choose a destination before you can book a hotel there.
Parallel Tasks: Subtasks that can be completed in any order or simultaneously because they don't depend on each other. For example, checking the weather and checking your calendar can happen in any sequence.
Plan: An ordered list of subtasks that, when completed in sequence, accomplish a larger goal. The plan is the output of task decomposition.
Quiz
Ready to test your understanding? Take this quick quiz to reinforce what you've learned about task decomposition for AI agents.






Comments