Skip to main content

Prompt Chaining and Iterative Prompting

Splitting a task into a sequence of focused prompts, refining prompts and outputs over several rounds, and when each beats one big prompt.

IntermediateVerdeshell Team · 8 min read · Last reviewed

Prompt chaining splits a task into a fixed sequence of focused prompts, each taking the previous output as input. Iterative prompting improves a prompt or an output over several rounds. Both trade one clever prompt for several simple ones you can test.

Key takeaways

  • Prompt chaining splits one complex task into a sequence of focused prompts, each using the previous output.
  • Each step can be tested and fixed on its own, and checks between steps stop errors compounding.
  • Iterative prompting refines a prompt — or an output — over several rounds against clear criteria.
  • A chain is a sequence you designed; it is not an agent, because nothing is choosing its own next step.
Prompt chaining with checks between steps, and iterative refinementPrompt chaining: the input goes to a first prompt that extracts the facts, a check validates the result, a second prompt analyses it, another check, and a third prompt writes the output. Each step is small enough to test on its own. Iterative refinement: a draft is reviewed against criteria and revised, repeating until it passes.PROMPT CHAINING — A FIXED SEQUENCE YOU DESIGNInput1 · Extractthe facts2 · Analysethe facts3 · Writethe outputOutput✓✓checks between steps catch errors before they compoundITERATIVE REFINEMENTDraftReviewagainst criteriaDonewhen it passesrevise
A chain is a fixed sequence you design, with checks between steps. Iteration repeats one step until it meets the bar.

What prompt chaining is

Prompt chaining breaks a task into steps, gives each step its own prompt, and feeds the output of one into the next. Summarise a document, then extract the action items from the summary, then draft an email from the action items: three prompts, each simple, instead of one prompt asked to do everything at once.

All three major model providers recommend breaking complex tasks down this way, and Anthropic’s guidance on building agents describes prompt chaining as one of the basic workflow patterns — with programmatic checks between steps to keep the process on track.

Why a chain beats one big prompt

Each prompt does one thing, so it does it better. A model asked to summarise, classify and write at once will compromise on all three.

Each step can be tested on its own. When the final output is wrong, you can see which step failed instead of guessing which part of a long prompt the model ignored.

You can check between steps. Validate that the extraction step returned every required field before the writing step runs; stop or retry if not. Errors caught early do not compound.

Different steps can use different models — a small, fast one for extraction, a stronger one for the step that needs judgement.

A chain is not an agent

In a chain, you decided the steps and their order in advance. The model fills in each step; it does not choose what happens next. That makes chains predictable, cheap and easy to test — and for most business workflows, the better engineering choice.

An agent, by contrast, chooses its own next action based on what just happened. The difference, and why it matters, is covered in generative AI, agentic AI and AI agents.

Iterative prompting: improving the prompt

Iterative prompting usually means refining a prompt over several rounds. Run it on real inputs, read the worst outputs, work out what the prompt failed to say, change one thing, and run it again.

The discipline that makes it work is a fixed set of test inputs. Without one, each change fixes the case in front of you and quietly breaks others. With one, you can see whether the prompt actually improved.

Iterative refinement: improving the output

The model can also iterate on its own output: draft, critique the draft against stated criteria, revise. A 2023 paper (Madaan et al., “Self-Refine”) showed that this generate–feedback–refine loop improved results across a range of writing and reasoning tasks without any extra training.

Step 1 — Draft a reply to this customer complaint.
Step 2 — Review the draft against these criteria: acknowledges the problem, offers a specific fix, no blame, under 120 words. List any failures.
Step 3 — Rewrite the draft to fix every failure listed.

It works best when the criteria are concrete and checkable. “Make it better” gives the model nothing to test against; a short list of requirements does.

Combining techniques

You will also see “hybrid prompting” used for prompts that combine several techniques — a role, few-shot examples, a request for step-by-step reasoning and a strict output format in one prompt. It is an informal label rather than a distinct method: most good production prompts combine techniques, and each part can be judged on whether it measurably helps.

Next in the pathRole, Negative and Structured-Output Prompting

Want this built properly?

We design and build AI systems for clients. Tell us the problem and we will tell you honestly whether AI — and which kind — is the right fit for it.