Skip to main content

03. Core Components

Reasoning, Planning and Task Decomposition

Reasoning figures out what matters; planning orders the work; task decomposition breaks a goal into tool-sized steps. Together they turn vague requests into reliable agent loops.

What you will learn

  • Define reasoning, planning, and decomposition for agents
  • Choose plan-then-act vs interleaved vs hierarchical styles
  • Break a goal into leaf actions with dependencies
  • Explain when and how to replan after tool feedback
  • Answer interview questions with short, solid answers
Goal to reason to plan to act flow for AI agents
Interview staple: reason about the goal, plan steps, decompose to actions, then verify.

Definition

Reasoning is how the agent interprets the goal, constraints, and observations to decide what is relevant. Planning produces an ordered (or partially ordered) set of steps toward a done state. Task decomposition splits large steps into smaller ones until each leaf is executable β€” usually one tool call or a small human-checkable unit.

In LLM agents, β€œreasoning” often appears as chain-of-thought or structured scratchpads; β€œplanning” may be an explicit list of steps; decomposition is how you avoid one giant, brittle tool call.

Introduction

This lesson (#3 in Core Components) follows Prompts and Context Management. Good context feeds reasoning; good plans decide what context to fetch next.

Module 04 will deepen ReAct and workflow patterns β€” this page builds the mental model first.

Why planning matters

  • Prevents thrashing tool calls without a goal path
  • Makes progress visible (step checklist / state)
  • Enables parallelism and handoffs in multi-agent setups
  • Supports budgets: estimate cost before long runs

Reasoning in agents

Agent reasoning is practical, not philosophical: classify the task, spot missing info, pick a strategy, and justify the next action.

  • Understand - restate goal and done criteria
  • Gap analysis - what facts/tools are missing
  • Strategy - search, edit, ask user, or refuse
  • Risk check - irreversible actions need confirmation
  • Keep reasoning traces in logs for debugging (redact secrets)

Planning styles

Match style to uncertainty. Over-planning in a noisy environment wastes tokens; under-planning in a stable pipeline causes chaos.

Plan-then-act, interleaved ReAct-style, and hierarchical planning
Interleaved planning is the default for most tool-using LLM agents.
  • Plan then act - draft full plan, then execute (stable workflows)
  • Interleaved (ReAct-style) - think, act, observe, adjust
  • Hierarchical - high-level milestones with local replans
  • Hybrid - outline plan, then ReAct inside each milestone

Task decomposition

Decomposition continues until leaves are sized for one tool or one clear verification. If a step still says β€œfigure out the bug,” it is not decomposed enough.

Goal decomposed into reproduce, locate, and patch subtasks with leaf tool calls
Parent goals β†’ subtasks β†’ leaf actions. Track status on every node.
  • Vertical split - phases (investigate β†’ fix β†’ verify)
  • Horizontal split - independent workstreams (docs + tests)
  • Dependencies - what must finish before what starts
  • Acceptance - each node needs a done check
  • Anti-pattern - 30 micro-steps that add coordination noise

Replanning

Plans are hypotheses. Tool failures, new errors, or empty retrievals should trigger a controlled replan β€” not endless retries of the same step.

  • Detect - failed tool, unexpected observation, budget pressure
  • Diagnose - wrong assumption vs bad tool vs bad subgoal
  • Revise - replace subtree, not necessarily the whole plan
  • Cap - max replans / steps before escalate to human

Mapping to Agentic AI systems

  • Scratchpad / plan JSON in state - explicit planning
  • ReAct prompts - interleaved reason+act
  • LangGraph nodes - hierarchical or phased plans
  • Crew roles - decompose across agents (research/write/review)
  • Todo tools - externalize the checklist the model follows

Program / implementation notes

Store the plan as structured data (id, status, depends_on), not only prose in the chat. Let the orchestrator advance the pointer.

  • Require done criteria before planning starts
  • Log plan version + step status each loop
  • Prefer verify steps after mutate steps
  • Separate β€œplanner” and β€œexecutor” prompts when plans get long
  • Next: Agent Memory Types

Advantages and limitations

  • Advantage: clearer progress and fewer random tool calls
  • Advantage: easier parallelization and review
  • Advantage: better cost control with step budgets
  • Limitation: stale plans in dynamic environments
  • Limitation: over-decomposition increases latency
  • Limitation: LLM plans can look good but miss critical steps β€” verify

Key points

  • Reasoning interprets goals and observations; planning sequences work.
  • Decomposition splits work until leaves are executable.
  • Interleaved planning fits uncertain tool environments.
  • Replan on failed assumptions β€” do not blind-retry forever.
  • Store plans as structured state with done checks.
  • Verify after mutate; escalate when replan caps hit.

FAQs

Is chain-of-thought the same as planning?

Not exactly. CoT is a reasoning trace. Planning is an explicit (often structured) sequence of steps with status and dependencies toward a goal.

Should every agent write a full plan first?

No. Use full upfront plans for stable pipelines; use interleaved plan/act when observations will change the path.

How small should decomposed tasks be?

Small enough for one tool call or one clear verification, but large enough that coordination overhead stays reasonable.

How does this relate to ReAct?

ReAct is an interleaved style: reason about the next step, act with a tool, observe, and repeat β€” a practical planning loop.

Interview questions

  1. What is task decomposition in AI agents?

    Answer Breaking a high-level goal into smaller subtasks and leaf actions that can be executed and verified, often with dependencies.

  2. Reasoning vs planning?

    Answer Reasoning analyzes the situation and options; planning commits to an ordered set of steps to reach the goal.

  3. Plan-then-act vs ReAct-style planning?

    Answer Plan-then-act builds a full plan before execution. ReAct interleaves thinking with tool use and updates based on observations.

  4. When should an agent replan?

    Answer When observations invalidate assumptions β€” tool failures, unexpected errors, missing data, or budget pressure β€” and retries alone will not help.

  5. What is hierarchical planning?

    Answer Maintaining a high-level milestone plan while allowing local replanning inside each milestone.

  6. How do you represent a plan in code?

    Answer As structured tasks with ids, status, dependencies, and acceptance checks β€” updated by the orchestrator each loop.

  7. Common planning failure modes?

    Answer Vague goals, missing verify steps, over-decomposition, ignoring tool feedback, and infinite retry without revising the plan.

Related topics

Practice task

Complete each numbered practice step in a notebook or doc before opening the next lesson.

  1. Write definitions for reasoning, planning, and task decomposition in one sentence each.
  2. Decompose β€œadd password reset to our app” into a tree with at least six leaf actions.
  3. Mark dependencies and a done check on every node.
  4. Choose a planning style for a flaky-CI debugger and justify in three lines.
  5. Answer interview questions 1, 3, and 4 in two sentences each.