AppsGuidesAI DictionarySmall FixesOn RecordAboutFollow the lab

Prompt chaining

Also called chain prompts

Prompt chaining splits a big AI task into small steps, where each step's answer becomes the input for the next prompt.

Using AICurious

In plain words

Ask an AI to "read these 30 reviews, find the main complaints, write a reply to each, and translate it into Hindi" in one go, and it may rush or skip a part. Prompt chaining does it one step at a time instead.

Step one: list the complaints. Step two: take that list and draft a reply for each. Step three: take the drafts and translate them. Each prompt does one small job, and its answer is passed into the next prompt.

Because you can see every step, you can check the middle before moving on: is the complaint list right? If not, fix that step without redoing everything. The trade-off is time: several calls take longer than one. Newer reasoning models handle more steps on their own, so chaining is used most when you want control over each stage.

Everyday example

An assembly line for a laptop bag order

A small leather workshop doesn't give one person an order for 50 bags. One cuts the leather, the next stitches, another fixes zips, a last one checks quality. Each passes the half-done bag to the next. If zips fail, you know exactly which table to visit. A prompt chain is that line, with each table being one prompt.

Where the example breaks: Workers on a line see the whole bag and can spot a cutting mistake. Each prompt only sees what the previous step handed over, so an early error flows quietly downstream unless you add a check.

Go deeper

How it actually works

Anthropic's engineering guide defines it plainly: prompt chaining "decomposes a task into a sequence of steps, where each LLM call processes the output of the previous one".

  1. Split the task

    Find natural stages with a clear output each: extract, then analyse, then write, then format. Each stage gets its own focused prompt, so the model does one easy thing well.

  2. Pass the output along

    Code takes the answer from step one and slots it into the prompt for step two. Clear labels or tags around the handed-over text help the next prompt know what it is looking at. Structured output makes this reliable.

  3. Add gates

    Between steps, a simple program check can stop the chain if something is off: the list is empty, the JSON doesn't parse, a required field is missing. This is where chaining beats one giant prompt.

  4. Draft, review, refine

    A common chain asks the model to write a draft, then review it against criteria, then improve it, each as a separate call. Anthropic's guide calls this self-correction, and notes that separate calls let you log, evaluate or branch at any point.

Described in research
"AI Chains" by Tongshuang Wu, Michael Terry and Carrie Cai (2021), where the output of one step "becomes the input for the next"
Finding
In that 20-person study, chaining improved results and people's sense of control and transparency
Trade-off
More calls and more waiting, in exchange for higher accuracy and easier debugging
Not the same as
Chain of thought, where one prompt asks the model to reason step by step inside a single answer

A chain follows steps fixed by its builder. When the AI itself decides which step comes next, that is an agent.

Questions people ask

What is the difference between prompt chaining and chain of thought?

Chain of thought happens inside one answer: the model reasons step by step before replying. Prompt chaining uses several separate prompts, with code passing each answer to the next.

Can I do prompt chaining in ChatGPT without code?

Yes, by hand. Ask for step one, check it, then paste or refer to it in your next message for step two. Code just automates the passing along and the checks.

Is prompt chaining still needed with reasoning models?

Less often. Newer models handle many multi-step tasks internally. Anthropic's guide says chaining is still useful when you need to inspect intermediate outputs or enforce a fixed pipeline.

How is a prompt chain different from an AI agent?

In a chain, the builder fixes the steps in advance. An agent decides its own next step as it goes, choosing tools and actions. Chains are more predictable; agents are more flexible.

Was this clear?

1 is confusing, 5 is crystal clear. One tap, no account needed.

Spotted something wrong, or know a better example? Suggest a change

Further reading