Prompt Chains

Wire multiple prompts together into a pipeline, passing each step's output into the next via {{ step_N_output }}.

What is a chain?

A chain is an ordered sequence of steps, where each step is a prompt. A later step can reference the output of an earlier one with {{ step_N_output }} — so you can, for example, extract data in step 1 and summarize it in step 2.

text
Step 1  →  Extract the key facts from: {{ document }}
Step 2  →  Write a tweet based on: {{ step_1_output }}

Building and running

  • Add, reorder, and edit steps in the step builder. Each step has its own content and system prompt.
  • Run the whole chain and watch it stream: you'll see step_start / step_complete events as it progresses.
  • Commit a version to snapshot the full steps array, just like prompt versioning.

Full feature parity

Chains support the same production lifecycle as prompts:

  • Deployments — pin a chain version to dev/staging/prod.
  • A/B testing — split traffic between two chain versions.
  • Evaluation — batch-eval and auto-eval-on-commit, scoring the final step's output.
  • Optimizer — improve any individual step.
  • Analytics — per-version run stats.
Fallback version
Chains have no “active” flag, so when no deployment slot is set the API falls back to the latest committed version.