← Back to glossary
+Suggest a term
Concept·Patterns & Practices·Added 1 month ago

Prompt chaining

Also known as: LLM chaining, sequential prompting, pipeline prompting, chained prompts

Breaking a complex task into a sequence of smaller LLM calls, where each call feeds its output into the next one. Instead of asking one prompt to do everything, you decompose the work into steps.

Prompt chaining is one of the earliest and most durable patterns in building with LLMs. The idea is simple: rather than loading one enormous task into a single prompt and hoping the model handles every sub-problem correctly, you break the job into stages. Each stage gets its own focused prompt, and its output becomes the input for the next.

This pattern solves several real problems. A single mega-prompt is hard to debug because you can't easily tell which part failed. Chaining makes failures visible and localized. It also lets you validate and transform outputs between steps, for instance, parsing JSON from step one before passing it to step two, so errors don't compound.

In practice, prompt chaining is the backbone of most non-trivial AI workflows. Document processing pipelines, multi-step research tasks, and anything that requires routing or conditional logic all end up looking like prompt chains. As workflows grow, they often evolve into full agent systems, but chaining is usually where builders start.

This definition is AI-generated and refreshed weekly. It may contain inaccuracies. Use your own judgment, especially for production decisions.
Related terms
OrchestrationAgentic loopContext engineeringStructured OutputRAG