Forward-deployed / Learning zone
Prompt engineeringa standalone module
Lesson 06

Prompt chaining and multi-step workflows

TL;DR

Some tasks are too complex for one prompt to solve well. Prompt chaining breaks a task into a sequence of smaller prompts, each doing one thing, with the output of one feeding the input of the next. A chain that does "find the top three concerns in this document, draft an email addressing each, then rewrite in the CEO's voice" runs three prompts, not one — and each prompt does its one job better than any single prompt would do all three. Chaining trades one call for several, and one prompt to debug for several to debug, in exchange for higher-quality outputs and clearer failure modes. It's the last technique inside a single-user, single-thread workflow before you cross into the agentic territory of the next two lessons, where the model itself decides what to run next.

🎯 For the AI PM (or coding-agent user)

Why it matters — Most production LLM features you use are chains, whether their authors called them that or not. Naming the pattern is the difference between designing a chain on purpose and stumbling into one that half-works.

What it changes in your decisions — When a single prompt underperforms, the next move is to decompose the task before reaching for a bigger model. You spec chains as first-class product artifacts, not implementation details buried in engineering.

Ask yourself — "Is my prompt trying to do two verbs at once — and would splitting it in half improve the output enough to justify the second call?"

Risk if ignored — You ship a single-prompt feature that fails 20% of the time on complex inputs, when a two-step chain would have failed 3% of the time.

The mental model

Breaking one task into several prompts

Each box is one prompt, each arrow is a data handoff

A chain can check an intermediate output and fail early, rather than passing garbage forward.

Input
→
Prompt 1
extract concerns
→
Prompt 2
draft response per concern
→
Prompt 3
rewrite in house voice
⚠ Validated? Fail early if empty — the underappreciated dotted arrow: a one-prompt version has no place to stop and check.

Each box is one prompt. Each arrow is a data handoff. The dotted arrow is the underappreciated part: a chain can check an intermediate output and fail early rather than passing garbage forward. A one-prompt version has to succeed at all three steps in one shot, with no place to stop and check.

When to chain

Not every task benefits. Chain when:

Don't chain when the task is genuinely single-verb, or when the latency of N sequential calls kills the user experience.

Patterns that come up over and over

What changes when the chain runs itself

A hand-built chain is a script. A workflow is a hand-built chain given a name, error handling, retries, observability, and a runtime. Whether you build it in LangChain, LlamaIndex, a bespoke Python script, or a cloud step-function, the prompt-engineering discipline is the same:

The full mechanics of orchestrating this at scale — retries, parallel steps, human-in-the-loop checkpoints — live in the agentic workflows track. This lesson stays on the prompt-writing side.

Tradeoffs

Failure modes

Practitioner checklist