Skip to content

CONCEPT Cited by 1 source

Prompt chaining

Definition

Prompt chaining is the LLM prompting technique in which an application programmatically threads the assistant's response at step N into the user prompt at step N+1, turning a sequence of independent single-shot LLM calls into a structured multi-turn dialogue the application — not the model — drives.

The chain is code on the caller side: each step has its own system prompt + user prompt template + output contract; the caller parses each reply and builds the next prompt. The LLM stays stateless between calls; the chain is the state.

The canonical external reference is the Prompt Engineering Guide's page on prompt chaining, cited directly by the Expedia STAR post as one of three named prompting techniques (alongside role prompting and generated knowledge prompting).

Why teams choose it

Prompt chaining sits at a specific altitude between two alternatives:

Altitude Shape Trade-off
Single-shot prompt One call, one answer Simple, cheap; bad at multi-hop reasoning; output format risk
Prompt chain N hardcoded calls, caller assembles Deterministic ordering, per-step model / prompt flexibility, no agent failure modes
Agent loop with tool use LLM drives orchestration Flexible, brittle; hard to bound failure modes

Prompt chaining is the "reasoning-in-the-middle" point: more structured than a single call, more predictable than an agent. Expedia's explicit rationale for choosing it over an agent loop: a chain "avoids the additional and currently less understood failure modes of an agent" (Source: sources/2026-04-28-expedia-expedias-service-telemetry-analyzer).

Canonical shape — Expedia STAR

STAR's chain encodes its RCA workflow:

  1. Collect telemetry (deterministic; no LLM call).
  2. Per-metric analysis — one call per metric stream with a per-metric system prompt + role (concepts/role-prompting).
  3. Aggregated RCA — single call with the prior step's outputs folded in as context; this is the "generated knowledge" application (concepts/generated-knowledge-prompting).
  4. Return insights + recommendations (deterministic; format the reply).

The ordering is hardcoded — the LLM does not decide what to do next. This is the load-bearing difference versus an agent loop.

Relationship to context engineering

Prompt chaining is a discipline within context engineering — each chain step has its own context budget; the caller decides what from previous steps is carried forward, what is summarised, what is dropped. Compared to agent-loop context engineering (which must manage an unbounded conversation), chain context engineering is bounded by construction: you know statically how many steps there are and what each step sees.

When to use it

  • Multi-step reasoning where the step structure is known in advance. RCA workflows (STAR), extraction pipelines, code migration pipelines — any workload where the ordering is predictable.
  • High-precision domains with known failure surfaces. When agent-level non-determinism is unacceptable, a chain is the closest you can get to LLM reasoning with deterministic orchestration.
  • When token budget needs to be knowable up front. See concepts/token-heavy-system. A chain's token envelope is computable because the step count + per-step output cap are fixed.

When not to use it

  • When the next step depends on the model's judgement. If the model should decide what to do next (file reads, external lookups, multi-path search), use an agent loop with tool calling.
  • When the problem shape is unbounded. Open-ended exploration doesn't fit a fixed chain.
  • When you need to gracefully degrade. Chains fail if any step emits a format the next step can't parse; agent loops can recover by re-planning.

Seen in

  • Expedia STAR (2026-04-28) — canonical wiki instance. Explicitly cites the Prompt Engineering Guide article as the definitional reference. STAR uses chaining instead of tool use + agent orchestration, and names the choice as the load-bearing architectural decision that keeps the system in the "precise" and "avoids agent failure modes" envelope.
Last updated · 433 distilled / 1,256 read