Task Decomposition: Identifying the Steps in a Workflow
Notes on the task decomposition lecture: turning real work into steps, the question to ask of each one, and the building blocks that can carry them out.
Notes on the Task decomposition: identifying the steps in a workflow lecture in Module 1 of Andrew Ng’s Agentic AI course (DeepLearning.AI). This is my personal study notebook; it is not affiliated with or endorsed by the course or its authors. Paraphrases of the lecture are marked From the lecture. Everything else is my own working.
Agentic AI — Module 1: Task decomposition
From useful work to discrete steps
People and businesses do a great deal of useful work. An agentic workflow can only follow steps. So how do you turn the first into the second?
The previous lecture ended by naming this as the key skill: looking at a complex task and working out its individual steps. This lecture shows how Andrew Ng does it, and the answer turns out to be a question he asks of every step.
The question to ask of every step
From the lectureWhen he breaks a task into steps, Andrew Ng asks of each one: can this be done by an LLM, by a short piece of code, by a function call, or by a tool?
If the answer is no, he asks how he would do that step as a human, and whether it can be broken into even smaller steps that an LLM or a tool can handle.
- Observe How does a person or business do this work today?
- Split Write it down as steps, the way a human would do them.
- Test each step Can an LLM, short code, a function call or a tool do it?
- Decompose further If not, how would a human do this step? Split it again.
- Build and read Implement it and look closely at the results.
Not good enough? Return to Split and decompose the weakest step further.
What I like about this question is that it is practical rather than philosophical. It does not ask whether a step is intelligent. It asks whether one of the building blocks you actually have can carry it out reliably. If it cannot, the step is too big.
Decomposition is iterative: the research agent
The clearest example in the lecture is a research agent that writes an essay on a topic. It goes through three versions, and each one exists because the previous one fell short. Step through them in the tabs.
v1 · Direct
One prompt, one answer. For deeply researched topics, the result tends to stay at the surface.
- Topic (User input; person decides) — “Write an essay on topic X.”
- LLM writes the essay (LLM call; developer decided) — Covers the obvious facts, but does not go deep.
v2 · Three steps
How would a person write it? Outline, research, then write. Each step passes the building-block test.
- Topic (User input; person decides)
- LLM writes an outline (LLM call; developer decided) — An LLM can write a decent outline for many topics.
- LLM generates search terms; web search (Software / tool; developer decided) — Search terms from an LLM, results from a search tool.
- LLM writes the essay from the results (LLM call; developer decided) — Deeper, but can still feel disjointed.
v3 · Writing decomposed
The weak step, “write the essay”, is itself broken into draft, critique and revise.
- Topic (User input; person decides)
- LLM writes an outline (LLM call; developer decided)
- Search the web (Software / tool; developer decided)
- LLM writes a first draft (LLM call; developer decided) — New: a draft, not the final essay.
- LLM reads it and decides what needs revision (LLM call; developer decided) — New: an LLM is fairly good at critiquing a draft.
- LLM revises the draft (LLM call; developer decided) — New: revision based on that critique.
From the lectureAndrew Ng describes having built a research agent with the three-step version himself. When he read its essays, they felt disjointed: the beginning, middle and end did not feel fully consistent. Asking how a person would fix that led him to break the writing step into first draft, critique and revision.
He adds that, depending on how satisfied you are with the results, you may keep modifying the process further.
Notice the pattern: you do not decompose everything at once. You decompose the step whose output disappoints you. Reading the results tells you where to look next.
Two smaller examples
The lecture also decomposes two tasks from the applications lecture. Both turn out to need very few steps:
Task | Steps | What makes each step doable |
|---|---|---|
Customer order inquiry | 1. Extract key information (sender, order, order number) | An LLM can extract this. |
2. Find the customer records | An LLM that can call a function to query the orders database. | |
3. Write and send the response | An LLM, given an API to send email. | |
Invoice processing (after PDF-to-text) | 1. Pull out biller, address, due date, amount due | An LLM can extract the fields. |
2. Check and save a new database record | An LLM calling a function to update the database. |
What building blocks do you have?
The test “can this step be done?” only works if you know what you can do it with. The lecture lists the building blocks:
Building block | Examples | Use cases |
|---|---|---|
Models | LLMs | Text generation, tool use, information extraction |
Other AI models | PDF-to-text, text-to-speech, image analysis | |
Tools | API | Web search, real-time data, send email, check calendar |
Information retrieval | Databases, retrieval augmented generation (RAG) | |
Code execution | Basic calculator, data analysis |
From the lectureAndrew Ng describes much of his work on agentic workflows as looking at what a person or business does, then working out how to sequence these building blocks to carry it out. Knowing what blocks are available is what lets you imagine which workflows you can build. Later modules cover the most important tools in detail.
Try it: which block fits each step?
A short exercise of my own, using the food-delivery example from earlier notes. I have added one block that is not on the slide, ordinary code: code you write yourself, as opposed to code an LLM writes and runs. Earlier notes argued it is often the most reliable choice.
- Turn a scanned delivery note into text
My choice
Other AI model — A specialised model for PDF or image to text, used before any LLM sees the content.
- Check whether a 7.2 °C reading exceeds a 5 °C limit
My choice
Ordinary code — A comparison with exact rules. Code you wrote and tested gives the same answer every time.
- Find the paragraph of the company SOP that covers late deliveries
My choice
Information retrieval — Searching a large body of text for the most relevant passage is what RAG is for.
- Email the finished report to the depot manager
My choice
API — Sending email is an action in another system, done through its API.
- Explain the day’s exceptions in plain language
My choice
LLM — Turning findings into readable prose is a text-generation task.
- Work out the average temperature per depot from an uploaded CSV file
My choice
Code execution or Ordinary code — Arithmetic over data should be computed, not estimated. Either an LLM writes and runs code, or you write it in advance if the analysis is always the same.
Engineering reflection: what makes a good step?
Putting this lecture together with the earlier ones, a well-decomposed step seems to me to have four properties:
One responsibility. It does one thing, so a failure points to one place.
A clear input and output. The next step knows exactly what it receives.
A matching building block. An LLM, a tool or code can do it reliably, which is Andrew Ng’s test.
Something you can check. You can look at its output and tell whether it is right.
The last property is the bridge to the next lecture. The research agent improved because someone read its essays and noticed they were disjointed. That kind of judgement, made systematic, is what evaluation means.
Think before you continue
Think before you continue1. Why not decompose a task into as many small steps as possible from the start?
Reveal an explanation
Every step adds latency, cost and another place for things to go wrong, as well as more to test. The lecture’s approach is to start simple, look at the results, and decompose further only where the output falls short. Decomposition is driven by evidence, not by a wish for more boxes.
Think before you continue2. A step fails the test: no LLM, tool or piece of code can do it reliably. What are your options?
Reveal an explanation
Ask how a person would do it and break it into smaller steps, as the lecture suggests. If even the smaller steps cannot be automated reliably, that part may belong to a person: a human-in-the-loop step, as in Lecture 02.
What I learned
Task decomposition means turning work that people do into discrete steps an agentic workflow can follow.
The test for each step: can an LLM, a short piece of code, a function call or a tool do it? If not, decompose it further.
Decomposition is iterative. Build, read the results, and break down the step that disappoints.
The building blocks are models (LLMs and other AI models) and tools (APIs, information retrieval, code execution). Knowing them is what makes good decomposition possible.
My engineering takeawayDecompose until every step matches a building block you trust, then let the results tell you which step to decompose next.
The lecture ends where the research agent’s story began: you only knew the essays were disjointed because you read them. Improving a workflow depends on measuring it, which is the subject of the next lecture: evaluating agentic workflows.