What is hierarchical task decomposition and what failure mode does flat planning expose?
Define hierarchical task decomposition in the context of an LLM agent. What problem does it solve that flat (non-hierarchical) planning cannot handle well?
Hierarchical decomposition splits a goal into a recursive sub-goal tree so each tier reasons at one abstraction level; flat planning crushes strategy and tool syntax into one confused context.
Imagine planning a big dinner party alone. If you try to hold the whole thing in your head at once, the guest list, the menu, the shopping, and the exact stove temperature all blur together, and you forget why you were chopping onions in the first place. It is easier to think in layers. First decide the theme. Then pick the dishes. Only then worry about which knife to grab. An agent does the same. A flat plan asks the model to juggle the grand strategy and the tiny details in one breath, and it gets muddled. A hierarchical plan lets a planner think about the big picture, hand each piece down to a helper, and let the helper sweat the small stuff without ever losing the thread of the overall goal.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define the recursive sub-goal tree and the strategic, tactical, operational tiers, then explain the context confusion that flat planning causes. Move to the engineering axes: independent vs dependency aware sub-goals, who decomposes, static vs interleaved expansion, and when to replan. Close on the key risk that a flawed top-level split caps achievable quality no matter how well the leaves execute.
Real products, models, and research that use this idea.
- Devin and similar coding agents decompose a feature request into a plan, then into per-file edits, then into individual tool calls, expanding lower tiers only as earlier steps land.
- Claude Opus 4.7 in agentic coding mode writes a high-level plan first, executes sub-steps, and revises the plan when a test failure invalidates an earlier assumption.
- LangGraph supervisor graphs model decomposition explicitly: a planner node emits sub-tasks as graph state and routes each to specialist worker nodes with their own contexts.
- OpenAI's Deep Research breaks a query into research sub-goals, runs them with partial independence, and synthesizes the branches, replanning when a branch returns thin evidence.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow do you decide between static decomposition up front and interleaved decomposition that expands nodes on demand?
QIf a flawed top-level split caps achievable quality, how do you defend the strategic tier?
QHow do you model dependencies so the agent does not run a sub-goal before its inputs exist?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Describing decomposition as a flat checklist of steps. The point is recursion into abstraction tiers, not a longer to do list, and a bad top-level split caps every result below it.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.