PUBLIC BETA OFFER

Save 50% off on an Eligible Learning PlanValid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026

Design task decomposition strategies for complex workflows

Choose fixed chains, parallel investigations, and adaptive plans from real dependencies.

Learn to define intermediate contracts and update decomposition when new evidence changes the work. A legacy import example shows why focused local analysis must be followed by a genuine cross-file check of missing values and transaction behavior.

Knowledge domain
Agentic Architecture & Orchestration
Topics & tags
Published
Author
LearningPathX Editorial TeamContent version 1.0
Resources

Design task decomposition strategies for complex workflows

Learning objectives

By the end of this topic, you should be able to:

  • Choose fixed chaining, independent parallel work or adaptive decomposition from actual dependencies.
  • Separate local file analysis from checks of cross-file behavior.
  • Update an investigation plan when findings reveal new work.
  • Use intermediate acceptance conditions to prevent errors propagating downstream.

Choose the pattern from what is known

A fixed prompt chain is appropriate when the stages and their relationships are predictable. For example, extract approved requirements, validate the extraction, compare proposals against those requirements and draft a recommendation. Each stage receives a checked output from the preceding stage.

Independent tasks can run in parallel when they do not need one another's results. Adaptive decomposition is useful when the work itself is discovered during investigation, such as tracing an unfamiliar legacy application's critical paths before deciding which tests to add. The source's fixed-parallel examples include predefined sectioning and voting assignments; their independence differs from discovering the next task from a worker result.

These patterns can combine. A stable outer workflow may contain a dynamically planned investigation, followed by a fixed verification gate. Do not select an elaborate orchestrator merely because a task is long. A clear single request may be enough for a small known transformation, while several short but dependent tasks may require careful sequencing.

Define the intermediate contract

For each stage, specify its input, output, prerequisite and acceptance condition. An extracted requirements list must preserve mandatory conditions and exceptions before it becomes the basis of a ranking. A repair to that extraction requires rechecking the dependent comparison, not only polishing the final recommendation.

Structured task descriptions make dependencies inspectable, but a particular syntax does not guarantee a valid plan. JSON or XML needs parsing and content validation. An empty task list needs an explicit interpretation. It can represent a verified no-work outcome, such as an unchanged artifact that already satisfies the request. If required work remains or the necessary inspection never occurred, it is an incomplete plan. A missing mandatory dependency or malformed worker result must remain blocked or failed under the workflow contract rather than becoming an apparently complete no-work result.

Fixed chaining introduces waiting and error-propagation risks; adaptive planning adds planning, monitoring and synthesis costs. Measure the actual workflow. In a teaching design with one planning call, three single-call workers and one synthesis call, the count is 1 + 3 + 1 = 5 model calls before any retries or further checks. A universal formula of workers plus one would omit that separate synthesis call.

Use a local pass and a genuine integration pass

A per-file review gives focused attention to local logic, conventions and test cases. Preserve the file version, finding location, supporting evidence and uncertainty. Independent read-only local reviews may be parallelized; a fixed workflow does not require unrelated file reviews to wait for each other unnecessarily.

The integration pass must examine behavior across boundaries. It is more than ranking and deduplicating local comments. Check caller and callee contracts, shared data structures, error propagation, authentication boundaries and whether the tests exercise the combined path.

A fresh review context can reduce anchoring to an implementation narrative, but does not guarantee independence or correctness. Supply the actual diff, relevant contracts and acceptance criteria, and compare findings with the code. Do not treat reviewer agreement as a substitute for a reproducible defect.

Let findings change the investigation plan

For an open-ended task, begin with a map of the repository or information space. Identify entry points, important dependencies, existing tests and areas whose failure would matter most. Mark unknowns instead of pretending the entire plan is already certain.

Each discovery should have a reason to create or reprioritize work. Finding that an endpoint writes to a shared transaction changes the needed recovery tests. A failed file search instead requires resolving the source path; it does not justify inventing an analysis of a file that was never read.

Record the current plan and checked findings outside an overflowing conversation when needed. Preserve the evidence and unresolved questions in a handoff. Avoid repeatedly rebuilding a full plan from an increasingly compressed recollection.

Prioritize coverage and dependencies together

A useful plan favors high-impact behavior while keeping prerequisites visible. Risk-based priority does not mean skipping a lower-level dependency needed to test the critical path. Distinguish necessary tests from attractive but unrelated improvements.

Assign distinct objectives and boundaries to avoid duplicate searches or conflicting edits. If workers will modify overlapping files, establish ownership or an isolated checkout before parallel work. Capability restrictions should follow the delegated task; a read-only review does not require write or network access.

Reassess effort after evidence arrives. A fixed number of workers, a particular model family or an effort setting is not a universal answer to every complex task. The right decomposition is the simplest one that preserves coverage, reliable handoffs and the required quality.

Worked example: a legacy import path

In this invented repository, parser.py parses rows, service.py validates and coordinates imports, and storage.py commits accepted records. The goal is to add tests for the import path, not to rewrite the application. The initial repository map establishes these dependencies before the plan is expanded. Assume this teaching revision has tests for one well-formed parser row and one successful single-record commit, but no invalid-row propagation or shared-transaction commit-failure test. This is an explicit fictional existing-test inventory, not an inspected real repository. The missing error-path coverage makes those two behaviors higher priorities than cosmetic cases.

Stage Concrete result Acceptance condition
Local analysis Parser findings, service findings and storage findings, each tied to the inspected revision. Relevant inputs, outputs, failure paths and unreviewed areas are identified.
Integration analysis A map of how invalid rows and storage failures travel through the whole import path. Caller assumptions agree with returned values and transaction behavior.
Prioritized tests Tests for invalid rows and failed commits before low-impact formatting cases. Each expected behavior is supported by the intended contract.

Suppose the parser can return None for an invalid row, while the service unconditionally accesses a dictionary field. Local reports that merely say each function has clear names miss the cross-file defect. The integration result should identify that contract mismatch and request a test showing the intended invalid-row behavior. It must not assume that returning None is always the correct application policy.

A second discovery shows that records share a transaction. The plan adds a commit-failure check rather than continuing with parser-only tests. A supported expected test result is: "When the documented transaction fails, the import reports failure and does not claim the batch committed." The actual rollback assertion must follow the storage contract and observed system behavior.

This example provides an adaptive plan and checkable expectations. It does not claim that repository files were inspected or tests executed in a real project.

Specify transformations and the real worker contract

In the source's fixed copy-and-translation example, the first stage produces approved English marketing copy. A gate checks its factual claims and mandatory content; the translation stage receives that actual accepted text, the requested target language and the constraints it must preserve. It must not translate a different draft or invent missing product facts. In the outline example, the generator returns the proposed outline, the criteria gate checks required sections and scope, and the document stage consumes only the accepted outline plus the underlying evidence. A label saying “outline checked” is not that actual input or a substantive gate result.

Dynamic work has three responsibilities even when a source description groups them into two phases: planning derives bounded tasks from the original objective and current evidence; workers execute the accepted tasks; synthesis checks the actual returned findings and missing/failed portions against the whole objective. A planned task is not completed work. Each worker needs the original objective, its own distinct instruction, actual relevant input/source references, allowed tools, required output and boundaries.

For the invented import review, one complete custom task record could be:

{
  "task_id": "W-parser",
  "original_objective": "Prioritize tests for the existing import path without rewriting the application.",
  "instruction": "Inspect parser input, output, invalid-row behavior and existing assertions at the stated revision; report evidence and unresolved cases.",
  "input_refs": ["parser.py@R8", "parser tests@R8"],
  "allowed_operations": ["authorized local reads"],
  "required_output": ["inspected_revision", "findings", "evidence_locations", "limitations"],
  "boundary": "Do not modify files, use the network, infer storage rollback or repeat the service worker's assignment."
}

This is an illustrative application contract, not an Agent SDK request or proof those repository artifacts were read. Service and storage workers need their own nonoverlapping responsibilities. Compare actual task descriptions and returned locations: if both workers inspect only parser syntax while neither checks transaction propagation, the coverage gap remains despite two completion messages. Reassign the omitted interface check and remove redundant work without dropping required objective dimensions. The source also suggests a subagent description such as “use proactively” to encourage supported automatic delegation. That wording guides selection; it neither invokes a worker, supplies authority nor proves a delegated result.

Explain the incomplete parser before relying on it

The source parse_tasks fragments contain broken newline-string displays. Reconstructing the intended split and indentation yields this still-incomplete skeleton:

def parse_tasks_incomplete(tasks_xml):
    tasks = []
    current_task = {}
    for line in tasks_xml.split("\n"):
        line = line.strip()
        if not line:
            continue
    return tasks

No branch extracts a task, constructs required fields or appends to tasks. Under this literal skeleton, even <tasks><task id="W1">Inspect parser</task></tasks> returns an empty list. Fixing the display syntax does not produce a working task parser. The source FlexibleOrchestrator references missing initialization/configuration/helpers and stops at parsing or truncated diagnostic printing; its parallel-execution docstring does not implement worker dispatch or synthesis. The named claude-sonnet-4-6 constant is a source configuration example, not a verified installed model or performance result.

XML and JSON are representation choices. A real accepted parser must implement the selected grammar, required fields, dependencies and semantic checks. XML friendliness and a broad glossary statement about structured JSON do not guarantee any of those. Inspectable planning decisions, task boundaries and evidence-quality checks can explain why a plan changes without exposing or requiring private hidden scratchpad reasoning. Named extended/interleaved-thinking support depends on the actual model/interface. More specifically, the source's lead-agent planning stage assesses tool fit, query complexity, worker count and each role before the relevant tool calls. After tool results arrive, workers assess source/result quality, identify remaining gaps and refine the next queries. Record those inspectable choices and evidence; this role/timing distinction does not require disclosure of a private scratchpad, and the actual thinking feature must be supported.

The glossary supplies terminology definitions; when its wording conflicts with factual content in a Dxx domain file, the Dxx file is the factual primary source. A structured JSON response does not by itself establish a complete parser or semantically correct task.

For an explicit custom result contract, these expected cases have different meanings:

Actual input or returned shape Expected handling under the teaching contract
A well-formed task with required scope, inputs and valid dependencies Accept for authorized dispatch; it is still not an executed result.
Malformed XML/JSON or a task missing required evidence references Retain parse/validation failure; correct or use a supported bounded retry before dependent work.
An empty list from the incomplete parser above Parser deficiency, not evidence no work is required.
A verified no-work result with inspected scope and a concrete reason Accept only when the original objective is actually satisfied.
A completed authorized inspection with findings: [], revision and checked scope Valid empty findings under that contract, not a failed task and not proof every system path is safe.
Nonempty text saying “done” without required findings/evidence fields Invalid result for this contract; text length does not establish correctness.
A worker reports the source unreadable Retain failed inspection and its missing coverage; do not synthesize it as no findings.

Gate, integrate and recover actual results

Before the import integration stage, require every mandatory local result to identify its inspected revision, relevant interface behavior, evidence locations and unresolved areas. An incomplete worker can undergo a declared bounded correction, such as at most one corrected resubmission in this invented workflow; re-evaluate the same substantive criteria afterward. On exhaustion, stop the dependent conclusion or route the specific gap to authorized review. A fallback must preserve the objective and permission requirements rather than simply rename a failure a pass. For this invented repository, two complete expected custom result records are {"status":"completed","inspected_revision":"R8","findings":[],"evidence_locations":["parser.py@R8:1-30"],"limitations":["Only the declared parser scope was checked."]} and {"status":"failed","inspected_revision":null,"findings":null,"evidence_locations":[],"limitations":["parser.py@R8 could not be read."]}. Their status fields distinguish completed empty findings from unperformed inspection, and both expose the promised revision/findings/evidence/limitations fields. The locations and states are teaching fixtures, not actual repository observations.

The integration reviewer checks parser→service and service→storage behavior, then reconciles overlap, ranks by supported impact and deduplicates genuinely identical findings. Two reports on the same null dereference may become one finding with both evidence contributions; two different failure paths must not be merged because they share a keyword. A fresh reviewer receives the named actual work/diff, applicable plan, acceptance criteria and definition of a reportable finding: a supported behavior mismatch under stated inputs with location and impact. It does not inherit the implementer's reasoning as its answer, but a fresh context alone guarantees neither unbiased judgment nor correctness. The source bundled /code-review skill is an interface example, not an actual review performed here. Here SKILL refers to a SKILL.md definition with YAML frontmatter and Markdown under .claude/skills; this terminology does not add skill-authoring objectives. In the source context-isolation account, a worker's intermediate tool calls stay in that worker context and its final report returns to the parent; this supplies neither live shared memory nor filesystem isolation or proof that personal configuration files are shared.

When a slow or failed boundary needs resilient recovery, an implemented asynchronous queue can record task identity, input version, state, actual result and receipt. Preserve still-valid completed tasks; retry only the permitted affected task and recheck dependent synthesis against the actual replacement result. Unknown effects require reconciliation first. The source's preference for asynchronous handoffs does not invalidate every synchronous dependent chain, and asynchronous syntax alone supplies neither durable storage nor a completed repair.

For a cross-worker recovery or artifact-access diagnosis, record only the needed nonsecret workspace/project, account and worker identities, with a credential identity or approved secret reference only when relevant to the actual operation. Never copy actual keys, tokens or passwords into prompts, logs or handoffs. Sharing configuration does not by itself authorize sharing or using credentials, and knowing a locator or secret reference does not grant access. If the required identity, permission or artifact is unavailable, keep the boundary blocked; do not silently switch accounts, widen permissions or invent the missing result.

Before expensive fan-out, reserve a conservative amount from an actual available budget in a declared unit, such as model tokens. Count failed attempts and verification, reconcile actual usage and release only verified unused allocation. Currency and tokens need an explicit conversion before comparison. An inspectable receipt can record task/source/result identity and sequence; calling it signed or tamper-evident requires an implemented integrity/signature mechanism and actual verification. Three agents is a source debugging example, not a signing or sufficiency threshold. For the source debugging purpose, an inspectable handoff record can identify sender, recipient, message/result, sequence and the referenced context-window snapshot. Recording those references is still not a cryptographic integrity check, and no private or secret context bytes need be copied into a receipt.

Enforce actual child capability narrowing before dispatch: the child stays within authorized parent/task capabilities, and a read-files-only role actually lacks unauthorized writes and network operations through every retained tool. A prompt label does not implement these limits. Capability narrowing concerns effective authority, not merely a smaller count of named permissions.

Interpret effort and performance claims in their scope

The source CLI (Command Line Interface) review-command snapshot describes low/medium as reporting its more confident findings and high through max as broader coverage that may include less certain findings. An explicitly typed level such as /code-review high updates that command's remembered interactive level. With no level typed, it reuses the last typed level; if there is none, it uses the session's current effort. In that account, ultra neither uses nor updates the remembered level, and a noninteractive -p effort does not update future interactive memory. Inspect actual support/configuration instead of guessing the remembered value. These are source-interface details, not current CLI verification or evidence that findings are correct. For an omitted level after an explicit high choice, the source notice example is “Reusing high effort, the level you typed last time”. It illustrates that client snapshot, not an observed notice or proof of remembered state in a new runtime.

The source one-agent/3–10-tool-call, more-than-ten-worker, 1,000–2,000-token summary and Opus-orchestrator/Haiku-worker suggestions are workload examples. They establish neither mandatory minimums nor a guaranteed quality/cost pairing. Worker exploration can consume tens of thousands of tokens while returning a short summary. Measure complete accepted work: planning, dispatch, actual worker/tool loops, synthesis, checks, waits and retries, with elapsed time separate from hands-on operator time. The slowest-worker comparison applies only to truly concurrent independent execution under its assumptions, not all workflow time. The earlier five-call example includes synthesis; a planner-plus-N-workers expression of N+1 omits any separate synthesis and extra calls. Here the 3–10 number counts tool calls, whereas the earlier five-call illustration explicitly counts model calls; those units must not be interchanged.

For the source's ideal worker-phase comparison, hold the same independent subtasks, accepted output quality and worker durations T_i fixed. Measure every T_i in the same unit from that worker's start to its accepted result, including any waiting and retries within that worker's interval, and assume the parallel workers start together with no scheduling queue or shared-resource contention. The parallel worker phase then takes max(T_i), whereas sequential execution of those same accepted subtasks takes sum(T_i). Planning, dispatch, synthesis/integration and orchestration waits or retries beyond those fixed worker intervals are outside this ideal worker-phase comparison. Measure actual end-to-end elapsed time from its stated workflow start to its accepted workflow outcome, using actual stage boundaries and overlaps so that each interval is counted once; do not add internal worker waiting or retry time again. This is not a measurement of this lesson's workflow or a claim of equivalent hands-on operator time saved.

Changes to lead-agent instructions can alter downstream behavior. Inspect actual assignments, source quality, returned evidence, duplicate/missing coverage and failure paths before and after a change. Use observed feedback to revise and recheck the affected objectives; strict prose, a short output or a larger worker pool cannot by itself prevent emergent interaction errors.

Read the partial coordinator as code, not as worker execution

This reconstruction restores readable newlines and closing punctuation in the displayed coordinator path. It assumes the still-incomplete parser shown earlier is named parse_tasks_incomplete. The source helpers and instance configuration are deliberately not invented:

from util import extract_xml, llm_call  # Source helpers are not supplied here.

MODEL = "claude-sonnet-4-6"  # Source example, not installed-model verification.

class FlexibleOrchestrator:
    def process(self, task, context=None):
        context = context or {}
        orchestrator_input = self._format_prompt(
            self.orchestrator_prompt, task=task, **context
        )
        orchestrator_response = llm_call(orchestrator_input, model=self.model)
        analysis = extract_xml(orchestrator_response, "analysis")
        tasks_xml = extract_xml(orchestrator_response, "tasks")
        tasks = parse_tasks_incomplete(tasks_xml)
        print("\n" + "=" * 80)
        print("ORCHESTRATOR ANALYSIS")
        print(f"\n{analysis}\n")
        print(f"IDENTIFIED {len(tasks)} APPROACHES")
        for i, task_info in enumerate(tasks, 1):
            print(f"\n{i}.", task_info)

There is no supplied initializer for self.model/self.orchestrator_prompt or implementation of self._format_prompt; the top-level MODEL constant does not initialize those attributes. The imported util helpers are also unavailable in the supplied listing. Even if an application provided them, the literal parser would still extract no tasks. The displayed path only formats an input, obtains/parses an orchestrator response and prints diagnostics; it contains no worker dispatch, concurrent runner, result collection, synthesis or explicit final return. Repairing the broken string displays therefore cannot justify the source parallel-execution docstring. This is explanatory reconstruction, not an executed or complete orchestrator.

Summary

Use fixed stages for known dependencies, parallel work for independent investigations and adaptive planning when evidence determines the next subtask. Validate intermediate outputs and reserve a real cross-file pass for interactions that local reviews cannot establish. Stop at accepted coverage or a specific unresolved dependency, rather than at an arbitrary number of workers or calls.

PUBLIC BETA OFFER

Save 50% off on an Eligible Learning Plan

Valid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026