Intermediate

Prompt Chaining and Orchestration

Build a multi-step content pipeline (research, draft, critique, revise) as a LangGraph state graph with conditional branching, so the model can loop back and self-correct instead of running once through a fixed sequence.

~2.5h
0 / 7 steps
🚀
Intro

What you're building

Prerequisites: Build a Chatbot with Memory (for LangGraph familiarity); an Anthropic API key.

Targeted versions: LangChain 1.0, LangGraph (current release), langchain-anthropic — verified against LangChain documentation, mid-2026.

A single LLM call is good at one well-scoped task; it's noticeably worse at doing five different things at once inside one prompt. Prompt chaining breaks a complex task into a sequence of focused calls, each with a narrower job, where later steps consume the output of earlier ones. Orchestration adds the harder part: branching, retries, and loops based on what a step actually produced, rather than always running the same fixed sequence.

You'll build a four-stage pipeline — research, draft, critique, revise — as a LangGraph StateGraph. The interesting part isn't the linear path; it's the conditional edge that routes back from critique to revise-and-recheck when the critique step flags a real problem, and only exits to "done" once the draft passes.

🔨

Define the shared state and the LLM client

🔨

Write the research, draft, and critique nodes

🔨

Wire the graph with a conditional loop-back edge

🔨

Run it and inspect the trace

🎯
Secret Mission

Secret Mission: add a human-approval interrupt

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock