Prompt chaining
Prompt chaining splits a complex task into a sequence of smaller LLM calls — each step's output feeds the next — improving reliability over a single mega-prompt.
Instead of asking the model to do everything in one prompt, prompt chaining decomposes a task into discrete steps (extract → classify → summarise → format). Each step is its own LLM call with focused context, simpler instructions, and easier evals. The technique dramatically improves reliability on complex workflows because each step is independently testable and replaceable. Modern agent frameworks (LangGraph, OpenAI Agents SDK, Mastra) treat prompt chaining as the foundation pattern. Best practice in 2026: chain when steps need different models or independent quality control; keep within one prompt when the task is simple enough for end-to-end quality to be good.
When to use prompt chaining
- Complex workflows where a single prompt fails reliability tests.
- Tasks where intermediate steps need to be inspected or branched.
Common mistakes
- Over-chaining trivial tasks — adds latency and cost without benefit.
- Skipping per-step evals — chains hide where quality fails.
FAQ
What is prompt chaining?
Prompt chaining splits a complex task into a sequence of smaller LLM calls — each step's output feeds the next — improving reliability over a single mega-prompt.
When should I use prompt chaining?
Complex workflows where a single prompt fails reliability tests. Tasks where intermediate steps need to be inspected or branched.
What are the most common mistakes with prompt chaining?
Over-chaining trivial tasks — adds latency and cost without benefit. Skipping per-step evals — chains hide where quality fails.
Related terms
- AI agent — An AI agent is a system where a language model autonomously plans and executes a sequence of tool calls to accomplish a goal.
- Agent loop — An agent loop is the repeating cycle of an AI agent — observe state, decide on an action (usually a tool call), execute, observe the result, and repeat — until a goal is reached or a stop condition fires.
- System prompt — A system prompt is the high-priority instruction block that defines a model's role, constraints, and default behaviors for an entire conversation.
- Context distillation — Context distillation summarises an agent's growing conversation history into a compact representation, so each step's input stays small while preserving the relevant signal.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/prompt-chaining.md.