Agentic AI trackLesson 4 of 6

Task Decomposition: From a Goal to Steps

How a wish like "find me a job" turns into six steps you can build, and how to tell when a step is small enough.

By Parastoo Mosayebi8 min readBased on the Agentic AI course (opens in a new tab)

The short answer

Task decomposition means splitting a goal into steps until every step can be done by an LLM, a short piece of code, a function call or a tool. If a step fails that test, you ask how a person would do it and split again. Then you build it, run it and fix what breaks.

Why the split matters more than the model

In lesson 1 the same model went from 48.1% to up to 95.1% on a coding benchmark, and the only thing that changed was the workflow around it. That result has a hidden condition: somebody had to decide what the steps are. Decomposition is that decision.

It is the same move as turning a feature request into tickets. "Build a shop" is not a ticket. "Add a product to the cart" is. The skill is knowing when a piece is small enough to hand over, and in agentic AI you hand it to a model or a tool.

Andrew Ng's method, in four moves

This comes from the lesson "Task decomposition: Identifying the steps in a workflow" in Module 1 of the course. In my words:

  1. Write down how a person would do it.

    Not how an AI would. The steps a careful human takes are the first draft of the workflow.

  2. Test every step.

    Can it be done by an LLM, a short piece of code, a function call or a tool? Those are the only four answers that count.

  3. Split what fails.

    If the answer is no, ask how you would do that one step yourself, and break it into smaller steps. Then test again.

  4. Build, run, refine.

    The first split is a guess. You run it, look at where the output is weak, and change the steps. How to measure that is lesson 5.

Ng's example: writing an essay

Asked for an essay in one go, a model writes something that stays on the surface. So the first split is: write an outline, search the web, write a draft. The draft has the facts now, and it reads disjointed. That weakness tells you where to split next: read the draft and critique it, then revise.

Nobody planned five steps at the start. Three steps were built, the output showed a problem, and the problem became two more steps. The lesson shows two more cases with the same shape:

Ng's example: writing an essay
TaskSteps
Answer a customer's order emailExtract the key facts (sender, item, order number). Look up the customer record with a database query. Write the reply and send it through an email API.
Process an invoiceTurn the PDF into text. Extract biller, address, due date and amount due. Save the fields to a database with a function call.

What you are allowed to build with

The test in move two only works if you know your building blocks. Ng names two groups:

Models
LLMs for writing, extracting and deciding what to call. Multimodal models for images and audio. Specialised models such as PDF-to-text, text-to-speech and image analysis.
Tools
APIs such as web search, weather, email and calendar. Retrieval, meaning database queries and RAG. And code execution, for anything that must be exact.

A step is small enough when you can point at one block and say: this does it.

The same test on my Job-Match Agent

My agent from lesson 1 has six steps. To check that the six are not arbitrary, I started again from the goal with a rough split of three parts and ran Ng's test on each. This is an exercise on paper. The agent is still not built.

GoalFind jobs that fit my CV

First rough split, then the test

  • Read the CV

    Passes as it is: one LLM call can do it.

    1. 1Extract skills, keywords and job titlesLLM
  • Find jobs

    Fails. No single block finds jobs. A person would think of search words, search, then open each ad.

    1. 2Write 3 to 5 search queriesLLM
    2. 3Search the web for job linksTool
    3. 4Fetch each full job descriptionTool
  • Pick the good ones

    Fails. It mixes judging with applying a rule, and those need different blocks.

    1. 5Score the fit from 0 to 100, with reasons and skill gapsLLM
    2. 6Keep only scores of 70 or higherCode
LLMToolCode
From one goal to six steps. Each dashed box is a part of my first rough split, and the coloured rows inside are the steps that pass the test.

Two things I notice. First, "find jobs" felt like one step until I had to name the block that does it. Second, the split in the last branch puts the judgement in the LLM and the rule in code, so the cut-off behaves the same on every run. Whether 70 is the right number is a different question, and the test cannot answer it.

Is there evidence that splitting helps?

Yes, with limits. In 2022 Denny Zhou and colleagues tested a method called least-to-most prompting: the model first breaks a hard problem into easier subproblems, then solves them in order and uses each answer for the next. On SCAN, a benchmark where short commands must be translated into long action sequences, the difference was large:

Chain-of-thought prompting16%
Least-to-most promptingat least 99%
SCAN benchmark, accuracy with GPT-3 code-davinci-002 and 14 examples in the prompt. Source: Zhou et al., Least-to-Most Prompting, 2022 (opens in a new tab).

This is one benchmark and a 2022 model, so I read it as proof of the principle and nothing more. A second paper from the same year, Decomposed Prompting by Khot and colleagues, adds the engineering reason: when a task is split into sub-tasks, each one can be handled by a prompted LLM, a symbolic function or a trained model, and each can be improved, split further or replaced on its own.

Anthropic describes the same idea for products. Prompt chaining splits a task into a sequence where each call works on the output of the one before, and you can put a programmatic check between two steps. The stated goal is to trade latency for higher accuracy by making each call an easier task.

When to stop splitting

More steps are not free. Each one adds waiting time, cost and another place where an error can enter and travel on. So I use three stop rules:

  1. Stop when every step passes the test. Splitting further only adds calls.
  2. Split again only where the output is weak. Ng's essay got its critique step because the draft read disjointed, and for no other reason.
  3. Keep rules in code. If a step is a fixed rule, such as a cut-off or a format check, it does not need a model.

Anthropic's advice fits here too: find the simplest solution possible and add complexity only when it is needed.

What comes next

A split is a guess until you measure it. Lesson 5 is about evaluation: how to find out which step is the weak one, and whether a change made the result better or only different.

Test yourself

Take a moment to guess each answer in your head, then open the correct answer and compare.

Question 1 of 5

What is the test for whether a step is small enough?

Show the correct answer

Correct answer. Ask whether the step can be done by an LLM, a short piece of code, a function call or a tool. If yes, it is small enough. If no, ask how a person would do it and split it into smaller steps.

Question 2 of 5

In Ng's essay example, why were the critique and revise steps added?

Show the correct answer

Correct answer. Because the draft written from the outline and the web search read disjointed. The weakness in the output showed where the next split was needed. The steps were not planned from the start.

Question 3 of 5

Which two groups of building blocks does Ng name?

Show the correct answer

Correct answer. Models (LLMs, multimodal models and specialised models such as PDF-to-text) and tools (APIs such as search or email, retrieval such as database queries and RAG, and code execution).

Question 4 of 5

What did least-to-most prompting achieve on the SCAN benchmark, and why should you read the number carefully?

Show the correct answer

Correct answer. At least 99% accuracy with GPT-3 code-davinci-002 and 14 examples, against 16% for chain-of-thought prompting. It is one benchmark and a 2022 model, so it shows that splitting can help. It does not predict the gain on your own task.

Question 5 of 5

Why did "pick the good ones" in the Job-Match Agent become two steps?

Show the correct answer

Correct answer. Because it mixed a judgement with a rule. Scoring the fit needs an LLM. Keeping only scores of 70 or higher is a fixed rule, and code applies a rule the same way on every run.

Sources

Updated 14 November 2026

Update log

  • : First published.

Next in the track

Lesson 5: Evaluating an Agent

Coming soon

All lessons in this track →

Comments

No comments yet — be the first to add one.

Comments are reviewed before they appear.