Prompt Chaining

Prompt chaining is a technique for using AI models in which a task is broken into a sequence of steps, each handled by its own prompt, with the output of one step passed as input to the next. A contract might be summarized, the summary checked against the original for omissions, and a plain-language email drafted from it, in three separate calls.

Origins

Developers chained model calls from the early days of GPT-3. In a paper posted in 2021 and presented at the CHI conference in 2022, Tongshuang Wu and colleagues at the University of Washington and Google described “AI Chains”; in a 20-person user study, breaking tasks into linked steps improved results and made the system more transparent and controllable. Frameworks such as LangChain, launched in late 2022, made chaining a standard building block.

Chains, workflows and agents

In a December 2024 guide, Anthropic distinguished “workflows”, in which code follows predefined paths, from agents, in which the model decides its own steps. Prompt chaining is the first workflow pattern the guide describes; others include routing requests to different prompts or models (see Model Router), running steps in parallel, having one model split up work among others, and having one model evaluate another’s output. The guide recommended starting with the simplest approach that works and adding autonomy only when needed (see Orchestration).

Trade-offs

Chains are predictable, easier to test and debug, and allow checks between steps. But they add delay and cost, errors can compound from step to step, and fixed sequences cope poorly with tasks whose steps cannot be known in advance – which is where agents come in (see Agentic AI).

Why it matters

Prompt chaining shows that much of the value of AI in practice comes from how tasks are structured around a model, not only from the model itself (see Context Engineering).

Written with Claude, made by Anthropic, whose guide on workflows and agents is described here and whose models are used in such chains, as are those of competitors OpenAI and Google (also an Anthropic investor).

Related

Prompt Engineering · Orchestration · AI Agent · Agentic AI · Model Router · Context Engineering

Sources: Tongshuang Wu, Michael Terry and Carrie J. Cai: AI Chains: Transparent and Controllable Human-AI Interaction by Chaining Large Language Model Prompts (arXiv) (2021) · Anthropic: Building effective agents (December 19, 2024)

Leave a Reply

Your email address will not be published. Required fields are marked *