AI builder glossary
Prompt chaining
Splitting a task into a sequence of focused model calls, where your code passes each step's output to the next, instead of one prompt that does everything.
Prompt chaining breaks a complex job into steps, each handled by its own prompt. One call extracts the facts, the next decides what to do, a third writes the result. Your code runs the steps in a fixed order and can check, transform, or branch on each intermediate output.
Chains earn their keep through focus and visibility. Each prompt does one thing, so it is easier to write, test, and fix. You can use a small, cheap model for simple steps and a stronger one only where it matters. And when the final output is wrong, you can see which step went off the rails instead of debugging one giant prompt.
The costs are latency and plumbing. Every step is a round trip, so a four-step chain is slower than one call, and errors can compound if a bad early output feeds later steps. Validate intermediate outputs (structured outputs help a lot here), run independent steps in parallel, and don't split tasks that a single well-written prompt handles fine.
A chain is the simplest kind of AI workflow: the order is decided by your code, not the model, which keeps it predictable and easy to price.
A refund feature chains three calls: extract order number and reason from the customer email, check the extracted order against policy in code, then draft a reply explaining the decision for an agent to approve.
Learn more in the course
Related terms
Go from definitions to doing
Learn to build AI-powered apps in 132 practical lessons.