What Is Agentic AI, and Why Are Agentic Workflows Powerful?

Lecture 02 notes: from one-pass answers to workflows that plan, research, draft, review and revise, and what that means for the engineer building them.

Notes on the second lecture 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 — Lecture 02: What is agentic AI?

What if an AI could review its own work?

Most of us first meet a language model as a box that takes a question and returns an answer. One request, one response. It is easy to assume that this is simply what the technology is. But what if the model could review and improve its own work instead of producing everything in one attempt?

From the lecture

Andrew Ng compares asking a language model to write a whole essay in one pass to asking a person to write an essay from the first word to the last without ever pressing the backspace key: no outline, no going back, no second draft.

Put that way, it is surprising that one-pass answers are as good as they are. Very few people do their best work like that.

Iteration matters because most good work is a sequence of smaller decisions, each one checked before the next is made. A writer outlines, notices a gap, looks something up, drafts, rereads, and fixes. Each pass has a narrower job than “write the whole thing”, and each one gives a chance to catch a mistake before it is built upon.

Pause and think

Think of the last piece of writing or code you were proud of. How many times did you go back and change it before it was finished?

My current answer

For me, almost every piece of code I trust went through at least one round of “run it, read the result, fix what is wrong”. The first version was rarely the one I kept. If that is how I work, it seems strange to expect a model to get it right in one go.

One pass, or many

Here are the two ways of working side by side. The first is a single exchange. The second spreads the same task over several steps. Select any step of the agentic workflow, or walk through it in order, to see what each one receives and produces.

One pass: Prompt → LLM → Answer

Agentic workflow:

  1. Prompt (Input) — The task arrives: for example, “write a short report on how heat pumps work”.
  2. Plan (LLM) — Break the task into an outline and a list of questions that need answering.
  3. Research (Search tool + LLM) — Look things up instead of relying only on what the model remembers.
  4. Draft (LLM) — Write a first version that follows the outline and uses the sources.
  5. Review (LLM) — Read the draft critically: what is unsupported, unclear or missing?
  6. Revise (LLM) — Fix the problems the review found. Review again if needed.
  7. Final output (Output) — Return the result once it passes review, or a limit on revisions is reached.
Figure 1. The same request handled in one pass and as a workflow. The stages follow my lecture notes; the detail inside each stage is my own illustration.

Iterative workflows can produce better results, but the cost side is worth saying plainly. Every extra step is another model call or tool call, so an agentic workflow usually takes more time and more computation than a single answer. Whether that trade is worth it depends on the task. For a quick factual question it probably is not. For a report someone will rely on, it often is.

Going deeper: why do more steps help?

My current understanding, as an engineer, is that splitting the work helps for at least four reasons:

  • Narrower instructions. A prompt that asks only for an outline is easier to follow well than one that asks for everything at once.

  • Fresh context per step. The drafting step can be given retrieved sources that the model never saw in training.

  • Visible intermediate results. An outline or a list of sources can be inspected, logged and tested. A single long answer hides where it went wrong.

  • A place for criticism. A review step, given explicit criteria, can catch problems that the drafting step was not looking for.

There is a caution too. A loop needs a way to stop. Without a limit or a clear “good enough” test, a review-and-revise cycle can keep changing things without improving them.

What exactly is an agentic workflow?

From the lecture

In the course’s terms, an agentic AI workflow is a process in which an LLM-based application carries out multiple steps to complete a task.

The definition is deliberately modest. It does not say the system is intelligent, independent or human-like. It says the work happens in several steps rather than one. That makes it something an engineer can design, inspect and test.

Multiple steps do not mean multiple models

A point that confused me at first: “several steps” does not require several language models. Very often it is one model called several times, each time with a different instruction and different input. Some steps are not model calls at all: a web search, a database query, or a few lines of ordinary code.

Here is a sketch of a research workflow in Python. llm() and web_search() are placeholders for whichever model API and search tool you use. What matters is the shape: one model, several calls, one tool, and a bounded feedback loop.

def research_report(question: str, max_revisions: int = 2) -> str:
    # One model, called several times, each time with a narrower job.
    sub_questions = llm(f"List 3-5 sub-questions needed to answer: {question}").splitlines()
    sources = [doc for q in sub_questions for doc in web_search(q)]  # a tool, not a model
    notes = llm(f"Rank these sources by relevance and summarise the best:\n{sources}")
    draft = llm(f"Write a Markdown report on '{question}' using only these notes:\n{notes}")

    for _ in range(max_revisions):  # the feedback loop, with a hard limit
        review = llm(f"As an editor, list unsupported claims or gaps. Reply NONE if none:\n{draft}")
        if review.strip() == "NONE":
            break
        draft = llm(f"Revise the draft to address this review:\n{review}\n\nDraft:\n{draft}")

    return draft

Nothing in that function is exotic. It is a sequence of calls, a list comprehension and a for loop. Most of the engineering work is deciding what each step should be told, and how to tell when the result is good enough.

Breaking a problem into responsibilities

How would you build a system that researches a question and writes a report? “Write a report” is too large to do well in one step. Task decomposition means splitting it into smaller responsibilities, each with a clear input and a clear output.

I will use a research agent as the running example. Here is how I would break one down. Read it from top to bottom, and notice the loop on the right.

  1. Research planning [LLM] — Turn the question into sub-questions and a search plan.
  2. Web search and retrieval [Tool] — Run searches and fetch the most promising pages.
  3. Synthesis and ranking [LLM] — Rank sources by relevance and reliability; extract key points.
  4. Report drafting [LLM] — Write a structured first draft from the ranked notes.
  5. Editor review [LLM] — Check claims against sources; list gaps and unclear passages.
  6. Revision [LLM] — Address each point raised by the editor.
  7. Final Markdown report [Output] — Format, add citations, return the finished report.

Feedback loop: from step 6 back to step 5. until the review passes

Figure 2. A research agent decomposed into seven responsibilities. Revision returns to review until the editor finds no issues or a revision limit is reached. My own diagram.

Seen as a software design, each box behaves like a function with a contract:

  • It can be tested on its own. Does search return relevant pages for these ten sample questions?

  • It can be improved on its own. A better ranking prompt does not require touching the drafting step.

  • It fails visibly. If the report is wrong, the intermediate outputs show whether the problem began in search, ranking or drafting.

Pause and think

The editor review step is itself a language model call. Why might a separate “editor” call catch errors that the drafting call made?

My current answer

My guess: the editor receives a different instruction and only one job. It is asked to look for unsupported claims, not to produce fluent text. That changes what it attends to. It is not a guarantee, though. Both calls share the same model and some of the same blind spots, which is one reason to keep checks that do not depend on the model at all, such as verifying that every cited URL actually exists.

Where does a person belong in the loop?

Some decisions are too important, too uncertain or too hard to undo to leave entirely to software. Human-in-the-loop design means placing review points where a person checks the work before the system continues.

In the research agent, two places seem natural to me: after the sources are chosen, before anything is written on top of them, and before the final report leaves the system.

  1. Research planning [LLM] — Sub-questions and search plan.
  2. Web search and retrieval [Tool] — Candidate sources.
  3. Synthesis and ranking [LLM] — Ranked sources with key points.
  4. Person checks the sources [Human] — Remove unreliable sources; add any that are missing.
  5. Draft, review and revise [LLM] — The loop from Figure 2.
  6. Person approves the report [Human] — Approve, or send back with comments.
  7. Published report [Output] — Released only after approval.

Feedback loop: from step 6 back to step 5. sent back with comments

Figure 3. The same workflow with two human checkpoints, shown with dashed borders. My own diagram.

When deciding where a checkpoint belongs, I find three questions useful:

  • What does a mistake cost here? A wrong source early on corrupts everything built on it.

  • How confident is the system? Low-confidence or conflicting information is worth a person’s attention.

  • Can the action be undone? Sending, publishing and paying are hard to reverse; drafting is not.

Human review has a cost of its own: it is slower, and people tire of approving things that are almost always fine. Good checkpoints are few and placed where judgement actually changes the outcome.

How much should the system decide for itself?

So far, every workflow in this note has a fixed shape: a developer decided the steps and their order in advance. That is not the only option.

Fixed workflow

The developer decides the steps and their order.

  • Predictable and easier to test
  • The model fills in each step
  • Less flexible when a task does not fit

More autonomous agent

The model decides which steps to take, and when it is done.

  • Adapts to unfamiliar tasks
  • Harder to predict and to test
  • Needs stronger limits and monitoring
Figure 4. Two ends of a spectrum. Most real systems sit somewhere in between. My own summary.

Autonomy is a range, not a switch. The next lecture explores it in detail, so I am keeping this short for now.

Engineering reflection: delivery temperature records

Imagine an AI assistant reviewing food-delivery temperature records. A chilled-food business wants a daily report: which deliveries stayed cold enough, which did not, and which need someone to look into them.

It is tempting to paste the records into a model and ask for a report. But most of this task is not language. It is parsing, unit conversion and comparing numbers, and ordinary code does those exactly and the same way every time. Run the pipeline below one step at a time and notice which steps need a model.

DeliveryTimeRecordedResult
D-10112:053.8 °CWithin the limit.
D-10212:184.6 °CWithin the limit.
D-10312:31—No reading recorded. Cannot be judged either way.
D-10412:477.2 °C7.2 °C is above the 5 °C limit.
D-10513:0239.2 °FRecorded as 39.2 °F, converted to 4 °C.
D-10613:152.9 °CWithin the limit.
D-10713:295.6 °C5.6 °C is above the 5 °C limit.
D-10813:44-40 °C-40 °C is outside the plausible range. Likely a sensor fault.

8 deliveries checked against a 5 °C limit.

4 passed.

Above the limit: D-104, D-107.

Could not be judged (missing or implausible reading): D-103, D-108.

Converted from °F before checking: D-105.

Recommendation: a person should review the listed deliveries before this report is shared.

Illustrative data. The 5 °C limit is chosen for this example and is not a regulatory value.

Step

Best done by

Why

Retrieve records

A database query (tool)

The data already exists in structured form.

Validate data

Deterministic code

Missing values, impossible readings and unit conversion have exact rules.

Check safety rule

Deterministic code

Comparing a number with a limit should never be approximate.

Identify anomalies

Deterministic code

Grouping flagged records is a filter, not a judgement.

Draft report

Language model

Turning findings into clear prose is where a model helps.

Human review

A person

Deciding what to do about D-103 and D-108 needs context the data does not have.

In this example only one step out of six needs a language model. The rest are better done by code, and that is a design decision, not a limitation. Deterministic steps can be unit-tested, give the same answer every run, and keep the numbers in the report trustworthy. The model’s job is narrowed to the part it is good at.

Pause and think

Suppose the model were asked to do the threshold check as well, by reading the readings and deciding which are above 5 °C. What could go wrong, and how would you notice?

My current answer

It might be right almost every time, which is exactly what makes it risky: an occasional misread number would look plausible in a fluent report. I would only notice by re-checking with code, and at that point the code might as well do the check in the first place.

Key takeaway

Key takeaway

The engineering challenge is not simply calling an LLM. It is designing the sequence of steps, tools, decisions and feedback mechanisms that reliably produce the desired result.

What I learned

  • One-pass generation is like writing without a backspace key. Iteration (plan, research, draft, review, revise) gives the work room to improve.

  • An agentic workflow is an LLM-based application that completes a task in multiple steps. Those steps can all use the same model.

  • Decomposing a task into responsibilities makes each part testable, replaceable and easier to debug.

  • Human checkpoints belong where mistakes are costly, information is uncertain, or actions are hard to undo.

  • Not every step needs a model. Deterministic code is often the more reliable choice.

  • More steps cost more time and computation. That cost has to be earned by better results.

Questions I am taking into Lecture 03

Every workflow in this note had steps that I chose in advance. That raises the questions the next lecture is about:

  • When should the model, rather than the developer, decide what the next step is?

  • How do you test a system whose sequence of steps can change from one run to the next?

  • Where along the range from fixed workflow to autonomous agent should a given application sit?

These are the threads I want to follow next.