Kolkata ·  
AI engineering
workflows
short · 3 min

Prompt chaining

The output of one LLM call becomes the input to the next, with checks in code in between.

updated 29 Sept 2026

We ask a model for a short technical document in one prompt. It comes back long, well written, and missing the section on limits that we needed. We now have a whole document to throw away, and we paid for every token of it.

What if we'd seen the plan first?

Outline, check, write

So let's split the job. Call 1 only writes an outline. Then, before anything else happens, a bit of our own code looks at that outline: does it have the sections we require, is it under the length limit? If it fails, we stop or retry right there, and it cost us an outline. If it passes, call 2 writes the document from the approved outline.

That's prompt chaining: a fixed line of calls, each working on the output of the one before, with checks in code between them. It's the simplest of the LLM workflows, and in code it's barely more than a loop. Writing marketing copy and then translating it is another one.

Notice the steps were known before we saw any input. That's what makes it a chain. If we can't say what the steps are until the input arrives, we're looking at routing or an agent instead.

The check is half the point

It's tempting to think the two calls are the interesting part. But take the check out and a bad outline goes straight into call 2, and we're back to a bad document with nothing to catch it. The check can be very plain: parse the outline against a schema (structured output) and look for the required headings.

The calls do get something from the split, too. Each one has a smaller, easier job, so it's more likely to do it well. We pay for that in time, since the calls run one after another and their times add up. (If two steps don't depend on each other, there's no reason to wait; run them at the same time with parallel calls.)

And because every step is its own API call, we can log it, test it on its own, or branch on what it returned. When the final document is bad, we can see which step went wrong. With one big prompt we only ever see the end.

Do we still need it?

In 2024, Anthropic's advice treated chaining as a main way to get better accuracy out of a model. Its prompting guide from 2026 is more careful. Its newer models, with adaptive thinking, handle most multistep reasoning inside one call, and explicit chaining is kept for when we want to inspect the in-between outputs or force a fixed pipeline.

What happened in between was reasoning models, which do their own step-by-step work (chain of thought) before answering. So "the model can't do it all at once" is a weaker reason to chain than it was. "We want to see and check each step" hasn't changed at all. We found no published test of one call against a chain on 2025 or 2026 models, so if accuracy is the reason, it's worth measuring on our own task with and without the chain.

The chain that same guide calls the most common now is draft, review against criteria, refine. That's a writer and a reviewer laid out as fixed steps, and whether the review helps depends on what the reviewer can check against. That story continues in evaluator-optimizer.

Further reading

  • Building effective agents, Erik Schluntz and Barry Zhang (Anthropic), 2024. The outline, check, write example and the idea of a gate between steps come from here.
  • Prompting best practices, Anthropic docs, current as of 2026-09. See "Chain complex prompts" for the newer, narrower case for chaining.