GTM Engineering term, AI and agents

Prompt chaining

Prompt chaining is a technique where a task is broken into ordered steps, each handled by its own prompt, with the output of one step passed as input to the next.

Also called: chained prompts, LLM chains, prompt pipeline

Prompt chaining sits under every stage: it's part of the data and systems the whole funnel runs on, near related terms like Prompt engineering, Agentic workflow and Structured output (the blue squares).

Prompt chaining is a technique for breaking one AI task into a fixed sequence of smaller prompts, where each step's output becomes the next step's input. It matters because models are far more reliable at five narrow jobs than at one sprawling one, and a chain shows you exactly where quality breaks.

How it works

You design the chain the way you would design any workflow automation: map the job into stages, decide what each stage receives and returns, then wire them together.

A typical GTM chain looks like this:

  1. Extract. Pull facts from raw input (a homepage, a 10-K, a job post) into fields.
  2. Classify. Decide something about those facts, such as industry, fit tier or buying stage.
  3. Reason. Connect the facts to your offer: which pain applies, which proof point fits.
  4. Generate. Write the output, such as an opening line or a research brief.
  5. Check. A separate prompt grades the draft against rules and flags anything to fix.

Every handoff should use structured output so the next prompt gets clean fields, not prose. Between steps you can add plain code: skip the rest of the chain when step 2 says "not a fit", look up a CRM field, or stop if a required value is empty. That conditional logic is what keeps a chain cheap.

Example

Say a team wants first lines for 5,000 target accounts. A one-shot prompt ("research this company and write a personalized opener") produces usable lines about 60% of the time in their review (assumption), and nobody can tell why the rest fail.

They rebuild it as a four-step chain for account research: extract three recent facts from the site, pick the one most tied to their product, write the line, then grade it. Step 2 drops 1,200 accounts as poor fit before any writing happens. Of the remaining 3,800, reviewers accept 85%, or 3,230 lines.

Cost math, using an assumed $0.004 per step per account: the one-shot approach costs 5,000 × $0.004 = $20 for about 3,000 usable lines. The chain costs 5,000 × $0.004 for step 1, the same for step 2, then 3,800 × $0.004 × 2 for steps 3 and 4, for a total of $20 + $20 + $30.40 = $70.40. That is about $50 more for roughly 230 more usable lines, plus a clean "not a fit" list and a log that shows where each failure happened.

Prompt chaining vs agentic workflows

A chain is a recipe with a fixed path. An agentic workflow lets the model pick its next step, call tools and loop. We default to chains for anything that runs on a schedule against your CRM, because they are predictable, testable with evals step by step, and cheap to rerun. Use an agent when the steps genuinely differ from record to record, like open-ended research.

Common mistakes

  • Passing paragraphs between steps instead of named fields, so each prompt has to re-parse the last one's prose.
  • No early exit, so you pay to write emails for companies a classifier already rejected.
  • Testing only the final output and never measuring which step drags quality down.
  • Letting a check step rewrite the output instead of flagging it, which hides the real failure.
  • Changing an upstream prompt without rerunning the downstream test set.

FAQ

Why use prompt chaining instead of one long prompt?

Smaller steps are easier for a model to do well and much easier for you to debug. When a chain fails you can see which step broke, fix that prompt and rerun from there. One giant prompt fails as a black box.

Is prompt chaining the same as an AI agent?

No. In a chain, you decide the order of steps in advance and the path is fixed. An AI agent decides its own next step at run time, choosing tools and looping until it reaches a goal. Chains are more predictable; agents are more flexible.

Can I build prompt chains without code?

Yes. Workflow tools such as n8n, Zapier and Make let you place several AI steps in sequence and map fields between them. Code gives you more control over retries, caching and testing once a chain runs at volume.

See all AI and agents terms ↳

Used in these articles