Pattern essence
Task Decomposition is a pattern that allows an agent to break a complex task into smaller subtasks before execution.
When to use it: when a complex task cannot be reliably completed in one step and must be split into subtasks.
Instead of solving everything at once, it:
- analyzes the task
- defines steps
- executes them in sequence
Each step is a separate subtask.

Problem
Imagine the agent receives a task:
"Prepare a monthly sales report."
In practice, this is not one step but a sequence of subtasks:
- collect data
- clean and validate it
- calculate metrics
- create the conclusion
Without an explicit plan, a complex task quickly becomes opaque: steps get lost and logic breaks.
If the agent tries to do everything "in one pass", chaos usually appears:
- missing intermediate steps
- wrong execution order
- mixing planning and execution
- weak error controllability
That is the problem: without structure, a complex task is easy to execute unstably and with errors.
Solution
Task Decomposition adds a separate planning stage before execution.
Analogy: it is like assembling furniture with instructions. Without instructions, it is easy to mix up the order or miss a part. With instructions, each step is transparent and errors are easier to find.
Key principle: First plan, then action. This is what makes the process controllable.
To prevent the agent from jumping straight to the final answer, decomposition-policy defines:
- which subtasks are mandatory
- in which order they should run
- when
re-planis required
The controlled process looks like this (as shown in the diagram):
- Goal: clarify goal and constraints
- Plan: split the task into subtasks and dependencies
- Step execution (Step 1..N / Execute): run subtasks according to the plan
- Combine Results: merge step outputs into one result
- Done: produce the final output
Intermediate result capture (checkpoint) happens inside the execution stage.
Task Decomposition helps to:
- increase predictability
- avoid missing important stages
- localize errors at a specific step
- get more stable results in long tasks
It works best if:
- there are clear step boundaries and dependencies
- each step has a completion criterion
- re-plan rules are set for changing conditions
- the execution stage does not bypass the approved plan
Even if the model "wants" to give a final answer immediately, decomposition-policy returns the process to structured steps.
How it works
Task Decomposition does not execute steps by itself.
It only defines which subtasks must be done, and each of them can be executed via a separate ReAct loop.
So the agent first builds a plan, then usually solves subtasks sequentially, step by step.
Full flow description: Plan β Execute
Planning (Plan)
The agent determines which steps are required to complete the task.
Execution (Execute)
The system executes each step based on the agent plan, often through a separate ReAct loop, and then combines the result.
In code it looks like this
steps = plan(goal)
for step_no, step in enumerate(steps, start=1):
result = execute(step, context=context) # each step sees outputs from previous steps
if not result.ok:
return stop_or_replan(step_no=step_no, reason=result.error)
context.append(result.data)
return build_final_output(context)
The agent splits the task into subtasks and executes them in sequence.
How it looks during execution
Goal: prepare a monthly sales report
Plan:
1. collect sales data
2. clean data
3. calculate key metrics
4. build charts
5. write a conclusion
Execute step 1: system calls fetch_sales_data(month)
Observe: raw data received
Between steps: raw_data becomes input for cleaning
Execute step 2: system calls clean_sales_data(raw_data)
Observe: data cleaned and validated
Between steps: clean_data becomes input for metric calculation
Execute step 3: system calls calculate_metrics(clean_data)
Observe: metrics calculated
Execute step 4: system calls build_charts(metrics)
Observe: charts built
Execute step 5: system composes summary
Observe: final report is ready
Stop: after the final step, the loop ends
Each step is executed separately, and intermediate output becomes input for the next stage.
Full Task Decomposition agent example
When it fits - and when it does not
Fits
| Situation | Why Task Decomposition fits | |
|---|---|---|
| β | The task has multiple stages | The pattern breaks a large goal into clear subtasks that can be executed in sequence. |
| β | Order of actions matters | The plan fixes step order and reduces the risk of skipping a critical stage. |
| β | The result depends on intermediate steps | Each subtask has its own output that becomes input for the next one. |
Does not fit
| Situation | Why Task Decomposition does not fit | |
|---|---|---|
| β | The task is simple | Decomposition adds extra steps where the task can be solved directly. |
| β | A fast response is required | Building and executing a plan adds latency compared to one-shot execution. |
| β | The plan cannot be built in advance | If task structure changes continuously, a rigid plan quickly loses relevance. |
Because the plan may be inaccurate or unnecessary.
When to use Task Decomposition among other patterns
Use Task Decomposition when you need to first split a large goal into smaller executable subtasks.
Quick test:
- if you need "first break a complex task into subtasks" -> Task Decomposition
- if you need "after each step decide what to do next" -> ReAct Agent
Comparison with other patterns and examples
Quick cheat sheet:
| If the task looks like this... | Use |
|---|---|
| After each step, you need to decide what to do next | ReAct Agent |
| First, you need to split a large goal into smaller executable tasks | Task Decomposition Agent |
| You need to run code, verify results, and iterate safely | Code Execution Agent |
| You need to analyze data and return conclusions based on that analysis | Data Analysis Agent |
| You need research from multiple sources with structured evidence | Research Agent |
Examples:
ReAct: "Find the cause of the API outage: check logs -> inspect errors -> run the next check based on the result".
Task Decomposition: "Prepare a new pricing launch: split the task into subtasks for content, engineering, QA, and support".
Code Execution: "Calculate 12-month retention in Python and verify formula correctness on real data".
Data Analysis: "Analyze a sales CSV: find trends, anomalies, and provide short conclusions".
Research: "Collect data on 5 competitors from multiple sources and produce a comparative summary".
How to combine with other patterns
- Task Decomposition + ReAct - each subtask is executed step by step, so errors are easier to control.
- Task Decomposition + Routing - for each subtask, the most suitable executor is selected automatically.
- Task Decomposition + Orchestrator - the Orchestrator manages dependencies and parallelism, so the plan runs without blocking.
How it differs from ReAct
| ReAct | Task Decomposition | |
|---|---|---|
| What it decides | What to do next | Which steps are needed |
| Level | Execution | Planning |
| How it works | Executes one step | Splits a task into subtasks |
| Uses | Tools for execution | ReAct loops to execute subtasks |
ReAct helps execute a step.
Task Decomposition defines which steps should be executed at all.
In short
Task Decomposition Agent:
- analyzes the task
- breaks it down into steps
- executes in sequence
Pros and Cons
Pros
splits a large task into clear steps
easier to estimate timelines and risks
easier to delegate and test subtasks
reduces execution chaos
Cons
decomposition itself also takes time
the plan can become too detailed
if the initial plan is wrong, it is harder to recover later
FAQ
Q: Is a plan always required?
A: No. For simple tasks, it may be unnecessary.
Q: Can the agent change the plan?
A: Yes. If new data appears during execution or one step fails, the agent can revise the initial plan: add new subtasks, change order, or create a new plan before next actions.
Q: Does Task Decomposition work without ReAct?
A: Yes. Subtask planning can run separately, for example if each step has a fixed Workflow. But in more complex tasks, each subtask is often executed through a ReAct loop.
What next
Task Decomposition allows splitting a task into steps.
But what should you do if you need to choose between multiple agents?