Worked examples — Planning and task decomposition
This page is the "throw everything at it" companion to Planning and task decomposition. Before we work examples, let's list every kind of situation a planning problem can throw at you, so that no scenario surprises you later.
Two ideas from the parent note power everything below. Let us re-earn them in plain words:
The one formula we lean on (parent note, re-stated):
The scenario matrix
Every planning problem this chapter can pose falls into one of these cells. The examples afterward each announce which cell they cover.
| # | Case class | What makes it special | Covered by |
|---|---|---|---|
| A | Independent split ( clean pieces) | subgoals share no data → full speedup | Ex 1 |
| B | Degenerate | "decomposition" that splits nothing | Ex 2 |
| C | Extreme | one subgoal per step → over-splitting | Ex 3 |
| D | Dependent chain (backward chaining) | step B needs step A's output | Ex 4 |
| E | Mixed DAG (parallel + serial) | some independent, some dependent | Ex 5 |
| F | Failure + replanning | a branch dies, retry only that branch | Ex 6 |
| G | Real-world word problem | pick strategy + count savings | Ex 7 |
| H | Exam twist: is splitting worth it? | overhead per step beats raw path count | Ex 8 |
The examples below hit every cell A–H.
Example 1 — Cell A: the clean independent split
Forecast: guess now — will the improvement be a small factor like , or something dramatic?
- Naive cost. With no split, count all routes of depth 6: . Why this step? This is the baseline — every complete path explored.
- Depth per subgoal. Each of the 3 subgoals is only steps deep. Why this step? Independence means we never need one subgoal's later steps while solving another; each is a shorter, self-contained search.
- Cost per subgoal. routes. Why this step? Same rule, but now with the smaller depth 2.
- Total decomposed cost. Pay that 3 times: . Why this step? We solve 3 separate small searches, not one big one.
- Speedup. .

Verify: the general formula . Matches . ✓ The savings are dramatic, not linear — the exponent collapsed from 6 to 4.
Example 2 — Cell B: the degenerate
Forecast: should the decomposed cost equal the naive cost exactly, or differ?
- Plug . . Why this step? A single "piece" of full depth 6 is just the original problem.
- Speedup. . Why this step? kills the exponent, so speedup : no gain.
Verify: decomposed cost equals naive ; speedup exactly . ✓ The formula degrades gracefully — is a no-op, exactly as intuition demands.
Example 3 — Cell C: the extreme (over-splitting the math)
Forecast: does making every step its own subgoal give the biggest possible speedup?
- Depth per subgoal. . Each subgoal is a single action. Why this step? Maximal splitting means each piece is one step deep.
- Cost. . Why this step? Six one-step searches of 10 options each.
- Speedup vs naive. .
Verify: . Matches . ✓
Example 4 — Cell D: a dependent chain (backward chaining)
Forecast: will a 2-hop dependent chain of options behave like independent split (cost ) or like a chain (cost but forced serial)?
- Backward chain from the goal. Goal "Grammy AotY winner in year ". This needs first. Why this step? Reasoning must respect what depends on what — you cannot search step 2 before step 1 resolves.
- Resolve .
search("1989 Taylor Swift release year")→ . Why this step? This is the precondition of the final query. - Resolve winner.
search("Grammy Album of the Year 2015")→ Morning Phase by Beck (2015 ceremony honours 2014 albums). Why this step? Now that is known, the second hop is well-posed. - Cost structure. Two hops, each ~ candidate queries: tries, but they are serial — the second cannot start early. Why this step? Dependency forbids parallelism; you still avoid because you never combinatorially pair every hop-1 with every hop-2.

Verify: naive joint search ; chained search ; ratio . A real speedup, but only , far below Example 1's — because dependency forbids independent multiplication. ✓ Answer to the trivia: Beck.
Example 5 — Cell E: mixed DAG (parallel + serial)
Forecast: with 5 tasks, does the agent need 5 serial rounds, or fewer?
- Build the dependency graph (DAG). Edges: , , , . Why this step? A multi-agent/parallel scheduler needs to know which arrows point where before it can run anything.
- Topological sort into layers.
- Layer 1: (no incoming edges).
- Layer 2: (their inputs are ready).
- Layer 3: . Why this step? Tasks in the same layer share no dependency, so they run at once.
- Critical path. Longest chain is (length 3). That's the minimum number of serial rounds. Why this step? You can never finish faster than the longest dependency chain.

Verify: 5 tasks, but only serial rounds. Serial-everything would take rounds → parallelism saves rounds. ✓ Layer sizes = total task count (no task lost or duplicated). ✓
Example 6 — Cell F: failure and localized replanning
Forecast: how much work does backtracking save here — a little, or most of it?
- Restart-from-scratch cost. Redo everything: (already done!) plus = units. Why this step? Naive agents with no memory re-execute succeeded steps. Wasteful.
- Replan-from-failure cost. Keep outputs (this is where agent memory earns its keep), regenerate only from onward with an alternative method: = units. Why this step? Failure isolation means only the broken branch is redone.
- Saved work. units, i.e. the two already-completed steps are not repeated.
Verify: restart , replan , saving ; saving fraction = 40% less work. ✓
Example 7 — Cell G: real-world word problem (pick the strategy + count)
Forecast: independent fetches → do we get the multiplicative blow-up, or the additive savings?
- Identify independence. The 3 fetch sources don't depend on each other → this is Cell A structure with . Why this step? Correctly labelling independence is what unlocks the additive (not multiplicative) cost.
- Naive joint search. Treating all three fetches as one depth- search with : . Why this step? This is the "explore every combination of every source's every endpoint" trap.
- Decomposed search. . Why this step? Each independent fetch is its own depth-2 search; solve, then move on.
- Then serial tail. Parse and plot are one dependent chain after the fetches — cheap, unaffected by the split.
Verify: speedup ; and formula . ✓ Decomposition helps enormously → use it.
Example 8 — Cell H: exam twist ("but is it actually worth it?")
Forecast: the exponent math from Ex 3 loved — will overhead overturn that?
- Cost model. , with . Why this step? Real agents pay per step, so we add once per subgoal — the piece the pure path-count formula ignored.
- : paths , overhead → total .
- : paths , overhead → total .
- : paths , overhead → total . Why this step? Beyond the shrinking path count can't outrun the growing overhead.
- Winner. () beats both () and ().

Verify: min over is at . ✓ This is the quantitative face of the parent's "over-decomposing" mistake: the sweet spot is interior, not .
Recall Quick self-test
Cloze the pattern, then reveal:
Decomposed path cost for independent subgoals ::: Speedup vs naive ::: Why gives speedup ::: the exponent becomes , so — no split, no gain What Example 8 adds that the pure formula omits ::: per-subgoal overhead , which makes very large expensive Why a dependent chain (Ex 4) beats naive by only a small factor ::: dependency forbids independent multiplication, so cost is additive not divided-exponent
See also: 6.2.01-Tool-augmented-LMs · 5.3.02-Chain-of-thought-prompting · back to Planning and task decomposition.