CertSafari
    Anthropic Claude Certified Architect – Foundations (CCAR-F)· Lessons

    Domain 1 · Lesson 6/30

    Task decomposition: prompt chaining vs adaptive decomposition

    Design task decomposition strategies for complex workflows

    18 min read
    3.86% of exam
    8 sources
    Published 20 Oct 2026
    Docs as of 14 Oct 2026

    What you will be able to do

    • Decide whether a workflow needs a fixed prompt chain, fixed parallel sectioning, or adaptive decomposition, based on whether its subtasks can be listed before the run
    • Split a large code review into per-file local passes plus a cross-file integration pass, and explain why a bigger context window does not fix attention dilution
    • Design an adaptive investigation where each finding decides the next subtask, with a stopping condition
    • Break an open-ended task such as adding tests to a legacy codebase into three phases: map the structure, prioritize, then follow a plan that changes as dependencies turn up

    Key concept

    Predictable vs discovered subtasks — The main decomposition choice turns on one question: can you write the subtask list before the run starts? If you can, code sequences the steps in a fixed chain. If the subtasks only show up as the work goes on, an orchestrator has to generate them from what each step finds.

    1.Fixed prompt chains for predictable work

    Every complex workflow has to be broken into smaller tasks, and the first design decision is who does the breaking. One option is to do it yourself, in code, before the run starts. The other is to let a model do it at runtime, based on what it finds. Getting this wrong costs you in one of two ways. A fixed pipeline can't follow a lead it didn't plan for, and a dynamic planner spends tokens and adds variation to work that never changes.

    Prompt chaining is the fixed option. It splits a task into a sequence of steps, and each LLM call processes the output of the previous one. Between steps you can add programmatic checks, called gates, to ensure that the process is still on track. Chaining works best when the task divides cleanly into fixed subtasks. It deliberately accepts extra latency in exchange for accuracy, because each individual call has an easier job. One canonical example is generating marketing copy and then translating it into a different language.

    Consider a support pipeline that turns a raw transcript into a structured summary and then translates the summary into three fixed languages, with the same steps in the same order on every run. A fixed chain fits this exactly: summarize, run a code-based check on the summary, then translate. The alternatives each fail for a specific reason:

    • An orchestrator that plans the summary and translation subtasks for each transcript works out the same plan on every run and pays for that planning call each time.
    • An adaptive agent that first inspects the transcript and then generates subtasks has the same flaw. The transcript's content never changes what the steps are.
    • A single pass that folds summarization into translation removes the intermediate summary. That leaves nothing for a gate to check, and one call now does two jobs.

    This is the legitimate use of a predefined path over Model-driven tool selection vs pre-configured sequences. Normally the model picks its next tool. For predictable work with several distinct aspects, though, a path fixed in advance beats letting the model choose, because there is nothing for it to decide.

    A chain is only fixed if code enforces it. Deterministic hooks vs probabilistic prompt instructions covers why instructions alone aren't guarantees. For decomposition, this means a system prompt that says "first summarize, then check, then translate" is a request the model can blend or skip. Separate API calls, sequenced by your orchestration code, are a structure. Explicit chaining earns its place when you need to inspect intermediate outputs or enforce a fixed pipeline. Each step is its own call, so you can log, evaluate, or branch at any point.

    Checkpoint 1 of 9· Check yourself

    Every night a job takes each new product spec and runs the same steps in the same order. It writes a product description, code checks the length and banned terms, and then the description is translated into German and French. The content of a spec never changes which steps run. Which decomposition fits best?

    Checkpoint 2 of 9· Check yourself

    An agent's system prompt says: "First extract the fields, then validate them, then format the report." The team needs to log the validated fields and stop the run before formatting if validation fails. What change gives them that?

    Checkpoint 3 of 9· Exam question

    A team is building an automated pipeline that takes a raw customer support transcript, produces a structured summary, then translates that summary into three fixed target languages. The steps and their order never change between runs. Which decomposition strategy best fits this workflow?

    Sources12

    2.Per-file passes plus a cross-file integration pass

    Large reviews fail because of attention dilution. A model's context is a finite resource with diminishing returns, and its ability to recall information from that context drops as the token count rises. The degradation is a gradient, not a cliff: the model stays capable but loses precision on retrieval and long-range reasoning. Put 40 files in one pass and each file gets a thinner share of attention. That is why comments drift toward generic advice and the subtle interaction between two distant files goes unnoticed.

    The standard prompt-chaining fix splits the review in two stages. First, each file gets its own pass that looks only for local issues. Second, a separate integration pass reads those findings and checks how the files interact. Per-file passes plus a cross-file integration pass covers how to run those passes. For decomposition, the point is that this review is predictable: the file list is known, and so is the order of the stages. A fixed chain therefore beats adaptive decomposition here. Models generally do better when each consideration gets its own call and focused attention, and Claude Code's workflow examples include this exact shape: review every changed file, then merge the per-file findings into one ranked summary.

    Two other restructurings look plausible but leave the problem in place:

    • Ranking the files by risk inside one pass keeps all 40 files in the same diluted context. It also directs effort away from low-ranked files, which may hold the other half of a cross-file bug.
    • Rerunning one pass with the file order shuffled and keeping the comments that recur is voting. Voting raises confidence across several attempts, but every attempt is still a single diluted pass, and an issue that every run misses can't recur.
    A Claude Code workflow script. The per-file step runs over every file because the script calls agent() for each one, not because a prompt asks the model to be thorough.javascript
    const found = await agent('List every .ts file under src/routes/.', {
      schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },
    })
    
    const audits = await pipeline(found.files, file =>
      agent(`Audit ${file} for missing authentication checks.`, { label: file }),
    )
    
    return audits.filter(Boolean)

    Checkpoint 4 of 9· Fill the gap

    This workflow script should give each changed file its own focused audit pass. Which token belongs in the blank inside the audit prompt?

    const found = await agent('List every .ts file under src/routes/.', {
      schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },
    })
    
    const audits = await pipeline(found.files, file =>
      agent(`Audit ${ ? } for missing authentication checks.`, { label: file }),
    )
    
    return audits.filter(Boolean)

    Checkpoint 5 of 9· Exam question

    A reviewer is designing an agentic code review for a pull request that touches 40 files across a monorepo. Reviewers have noticed that when a single pass tries to hold all 40 files in context at once, subtle cross-file issues are missed and comments become generic. What restructuring addresses this attention dilution problem?

    Sources342

    3.Adaptive decomposition for open-ended investigation

    Some tasks have no subtask list until the work starts. In the orchestrator-workers pattern, a central LLM breaks the task down, delegates the pieces to workers, and synthesizes their results. The orchestrator decides at runtime which subtasks to create. That is the difference from a pre-defined parallel workflow, even though the two look alike on a diagram. Coding changes that touch an unknown number of files fit this pattern, and so do searches that gather information from many sources.

    Anthropic's Research system shows the loop in practice. A lead agent plans an approach, spawns subagents with specific research tasks, and synthesizes what they return. It then decides whether more research is needed, and if so it can create additional subagents or refine its strategy. This kind of work depends on the path taken: the model has to keep choosing which directions to pursue based on intermediate findings. A linear, one-shot pipeline cannot handle it.

    Take an incident where the only input is a vague alert and nobody knows which service is at fault. An adaptive plan starts with whatever the alert points to, such as the services that logged errors around that time. Each result then shapes the next task. If the errors trace back to a recent deploy, the next subtask inspects that change. If they trace to a downstream timeout, the plan follows that dependency instead. The other designs all fix the subtasks before any evidence arrives:

    • A fixed set of parallel subagents for the database, cache, and load balancer only looks where someone guessed. If the fault is in a fourth service, no subagent checks it.
    • A prompt chain with predefined stages for collecting logs, correlating errors, and inspecting code runs the same stages whatever the logs say.
    • A single prompt loaded with logs from the "main services" guesses what to load and gets no chance to follow up.

    An adaptive loop needs an explicit stopping rule, because nothing about the task tells it when it's done. Agent designs commonly add conditions such as a maximum number of iterations. Claude Code's workflow examples use a rule based on progress: stop once two rounds in a row find nothing new. Adaptive decomposition also costs more. Multi-agent systems are only economical when the task is valuable enough to pay for the improved performance.

    Checkpoint 6 of 9· Check yourself

    Customers report that some paid orders vanish without a trace, and nobody knows which part of the system drops them. Which design is adaptive decomposition for this investigation?

    Checkpoint 7 of 9· Exam question

    An architect is asked to design an agent that investigates why a production incident occurred, given only a vague alert message and no prior knowledge of which service is at fault. The number of logs, services, and code paths to inspect cannot be known ahead of time. Which decomposition approach is most appropriate?

    Sources356

    4.Map, prioritize, then adapt: tests for a legacy codebase

    "Add comprehensive tests to a legacy codebase" is open-ended, but it isn't an investigation with one answer. Starting to write tests on the first file returned spends effort wherever the listing happens to begin. A fixed chain can't help either, because nobody knows the modules, their coupling, or their risk in advance. The workable decomposition has three phases, and each phase produces the input for the next.

    Map the structure first. Ask for an overview of the codebase, its main architecture patterns, its key data models, and how its components interact. Start with broad questions and narrow down to specific areas. The map is the work list. Claude's orchestration guidance treats this as the default hybrid: scout inline to discover the work list, then fan out over it.

    Identify the high-impact areas and order the plan. Rank the areas the map turned up and put the highest-impact ones first. Size each subtask to a distinct concern or component rather than a slice of a file, so each worker owns something it can test end to end. Multiphase sequencing keeps the phases separate: understand, design, implement, and review are run as separate calls, with the results read between phases.

    Let the plan change as dependencies turn up. Writing tests for the first priority module might show that it opens its own database connection. That means a test fixture or seam has to come first, so the plan moves it ahead. Another module might turn out to be a thin wrapper, so it moves down the list. Keep the plan somewhere outside the model's context so revisions don't get lost. Anthropic's Research lead agent saves its plan to memory for this reason, because a long run can push the plan out of a truncated context.

    Checkpoint 8 of 9· Put it in order

    A team is asked to add comprehensive tests to a large legacy codebase that nobody on the team knows. Put their decomposition steps in the order they should happen.

    1. 1.Start writing tests for the top-priority component
    2. 2.Get an overview of the architecture, key data models and how the components interact, starting broad and then narrowing
    3. 3.Rank the areas the overview turned up by impact, and build a plan with one subtask per component, highest impact first
    4. 4.Revise the stored plan when a dependency appears, for example by moving a database test fixture ahead of the module that needs it

    Sources786

    5.Choosing the pattern for the workflow

    Three decomposition patterns, set against who decides the subtasks and when each one fits
    PatternWho decides the subtasksUse it whenExample
    Prompt chaining (fixed sequence)Your code, before the runEach step needs the previous step's output and the order never changesWrite marketing copy, then translate it; per-file review, then a cross-file pass
    Parallelization: sectioning (fixed fan-out)Your code, before the runSubtasks are independent and none depends on another's resultOne call screens a query for inappropriate content while another answers it
    Orchestrator-workers (adaptive)An orchestrator LLM, at runtimeThe needed subtasks depend on the input or on what earlier steps foundCoding changes across an unknown number of files; multi-source research

    Two questions settle most cases. First, can you list the subtasks before the run? If so, decomposition belongs in code. Second, does any step need another step's output? If it does, chain the steps. If not, section them and run them in parallel. Only when the first answer is no does an orchestrator earn its planning call.

    A dynamic orchestrator added to fixed work is the most common mistake here. Suppose a content pipeline always runs the same tone check and the same profanity filter, and someone proposes an orchestrator that decides their order from the content. That adds a planning call, latency, and run-to-run variation, and buys nothing, because the steps and their outcomes don't depend on the order. The orchestrator pattern specifically lists predictable, pre-definable subtasks as a reason not to use it. Applying the same eleven-rule checklist to every Terraform file every quarter is the same situation: a fixed fan-out over known rules and files.

    Use only as much decomposition as the work needs. The simplest solution is the recommended starting point, and Claude already handles most multistep reasoning internally. Chain explicitly when you need to inspect intermediate outputs or guarantee a fixed pipeline structure. Decompose adaptively when the work is open-ended enough that a fixed path would miss what it can't predict.

    Checkpoint 9 of 9· Match them up

    Match each workflow to the decomposition pattern that fits it. Ask two questions: can the subtasks be listed before the run, and does any step need another step's output?

    Tap a term, then the definition that fits it.

    Sources152

    Sources

    (8)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “is still useful when you need to inspect intermediate outputs or enforce a specific pipeline structure”
      ↩︎ Fixed prompt chains for predictable work
      “Each step is a separate API call so you can log, evaluate, or branch at any point.”
      ↩︎ Fixed prompt chains for predictable work
      “With adaptive thinking and subagent orchestration, Claude handles most multistep reasoning internally.”
      ↩︎ Choosing the pattern for the workflow
      “Each step is a separate API call so you can log, evaluate, or branch at any point.”
      ↩︎ Exam trap 2
    2. 2.
      “The main goal is to trade off latency for higher accuracy, by making each LLM call an easier task.”
      ↩︎ Fixed prompt chains for predictable work
      “to ensure that the process is still on track”
      ↩︎ Fixed prompt chains for predictable work
      “Generating Marketing copy, then translating it into a different language.”
      ↩︎ Fixed prompt chains for predictable work
      “LLMs generally perform better when each consideration is handled by a separate LLM call, allowing focused attention on each specific aspect.”
      ↩︎ Per-file passes plus a cross-file integration pass
      “when multiple perspectives or attempts are needed for higher confidence results”
      ↩︎ Per-file passes plus a cross-file integration pass
      “This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks.”
      ↩︎ Choosing the pattern for the workflow
      “Workflows are systems where LLMs and tools are orchestrated through predefined code paths.”
      ↩︎ Key concept
      “This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks.”
      ↩︎ Checkpoint
      “the key difference from parallelization is its flexibility—subtasks aren't pre-defined, but determined by the orchestrator based on the specific input.”
      ↩︎ Checkpoint
    3. 3.
      “use a workflow to review every file changed in this PR for correctness issues, then merge the per-file findings into one ranked summary”
      ↩︎ Per-file passes plus a cross-file integration pass
      “stop once two rounds in a row find nothing new”
      ↩︎ Adaptive decomposition for open-ended investigation
    4. 4.
      “Context, therefore, must be treated as a finite resource with diminishing marginal returns.”
      ↩︎ Per-file passes plus a cross-file integration pass
      “Context, therefore, must be treated as a finite resource with diminishing marginal returns.”
      ↩︎ Exam trap 3
      “this characteristic emerges across all models”
      ↩︎ Prediction
    5. 5.
      “The orchestrator decides at runtime what subtasks to create, making this more adaptive than pre-defined parallel workflows.”
      ↩︎ Adaptive decomposition for open-ended investigation
      “Subtasks are predictable and can be pre-defined (use simpler parallelization)”
      ↩︎ Choosing the pattern for the workflow
      “Subtasks are predictable and can be pre-defined (use simpler parallelization)”
      ↩︎ Exam trap 1
    6. 6.
      “it can create additional subagents or refine its strategy”
      ↩︎ Adaptive decomposition for open-ended investigation
      “making decisions about which directions to pursue based on intermediate findings”
      ↩︎ Adaptive decomposition for open-ended investigation
      “For economic viability, multi-agent systems require tasks where the value of the task is high enough to pay for the increased performance.”
      ↩︎ Adaptive decomposition for open-ended investigation
      “saving its plan to Memory to persist the context”
      ↩︎ Map, prioritize, then adapt: tests for a legacy codebase
      “A linear, one-shot pipeline cannot handle these tasks.”
      ↩︎ Exam trap 4
      “The model must operate autonomously for many turns, making decisions about which directions to pursue based on intermediate findings.”
      ↩︎ Checkpoint
    7. 7.
      “Start with broad questions, then narrow down to specific areas”
      ↩︎ Map, prioritize, then adapt: tests for a legacy codebase
    8. 8.
      “scout inline first to discover the work-list, then fan out over it.”
      ↩︎ Map, prioritize, then adapt: tests for a legacy codebase
      “scope each subtask to a distinct concern, component, or question”
      ↩︎ Map, prioritize, then adapt: tests for a legacy codebase
      “review as separate workflow calls, reading results between phases”
      ↩︎ Map, prioritize, then adapt: tests for a legacy codebase
      “is hybrid: scout inline first to discover the work-list, then fan out over it.”
      ↩︎ Checkpoint

    Ready to test yourself?

    Practise the 16 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.