Five runnablemulti-agent patterns.Full code. Two SDKs.
The Agent Orchestration Cookbook is a pattern reference for dev teams shipping multi-agent AI systems. It holds five patterns: Orchestrator-Worker, Routing, Retry-with-Reflection, Code Review Agent, and Hierarchical Supervisor. Each pattern ships with full code in Claude Agent SDK and LangGraph, in both Python and TypeScript, plus a control-flow eval, failure-mode notes, and a directional cost analysis.
Every team is building agents. Almost everyone is reinventing the same patterns badly.
Your team ships its first agent. It works in the demo. It fails in three weeks of production because nobody handled the retry-with-reflection edge case where the model loops forever. You patch it. The next agent ships. Same loop happens.
Multi-agent patterns are not new. The orchestrator-worker pattern, the hierarchical-supervisor pattern, the parallel map-reduce — these are solved problems with known failure modes. The problem is the knowledge lives in Anthropic engineering blogs, LangChain Discord threads, a handful of conference talks, and the memories of senior engineers who learned the hard way.
The cookbook is what your senior engineer would build on their best week — written down, with a control-flow eval, a cost model, and failure notes. Drop the patterns into your repo. Stop reinventing.
- 01Engineer writes a multi-step agent in 4 days; works in dev
- 02Production: agent loops forever on edge case in ticket 23
- 03Team adds max_iterations=10 as a band-aid; ticket 47 hits limit silently
- 04Adds reflection step that doubles token costs without measurable quality gain
- 05Reads a blog post about supervisor patterns; rewrites half of it
- 06Six weeks later: still no eval harness, no failure-mode docs, no cost dashboard
Six deliverables. Engineered to ship together.
The Five-Pattern Library
Orchestrator-Worker, Routing, Retry-with-Reflection, Code Review Agent, Hierarchical Supervisor. Each lives in its own folder with the same layout, and each README says when to use it and when not to.
Full Implementation Code
Each pattern in four paths: Claude Agent SDK (Python + TypeScript), LangGraph (Python + TypeScript). Real implementations, not pseudocode. The LangGraph copies run offline on a deterministic mock; the Agent SDK copies need Claude Code and an API key.
Control-Flow Evals
A run_eval.py and a golden.json per pattern, 18 cases across the five. They run offline on the mock and exit 0 or 1. They check the orchestration (who fired, how many times, what merged), not the quality of a model's answer.
Failure-Mode Notes
Five failure modes per pattern: how it breaks, how to catch it, how to mitigate it. Written as engineering notes; they are not incident reports from a named deployment.
Directional Cost Analysis
The cost formula for each pattern, what it scales with, and the levers in rough order of impact. A model of cost structure with no dollar figures and no latency measurements; you plug in your own prices.
Architecture Decision Records
One ADR per pattern: the decision, why this shape, what was rejected, and the consequences. The reasoning written down so you can defend the choice in code review.
Five patterns. Every one in four implementation paths.
Orchestrator-Worker
- ·One ask, independent sub-asks, one merged answer
- ·The orchestrator decomposes; one worker fires per subtask
- ·Fan-out is sized at runtime, not hard-wired
- ·The aggregator sorts by subtask id before merging
- ·Eval: no dropped or duplicated worker results
Routing
- ·Classify one input, send it to exactly one handler
- ·Reference categories: billing, technical, sales, general
- ·A single conditional edge picks the one target
- ·An unknown class falls back to the general catch-all
- ·Eval: one router call, one handler, the right handler
Retry-with-Reflection
- ·Draft, critique, revise, until it passes or hits the cap
- ·The critic returns PASS or a revision note
- ·Hard iteration cap, set to 3 in the reference code
- ·Stops on the first PASS
- ·Eval: the loop terminates; draft calls equal critic calls
Code Review Agent
- ·One diff reviewed on four fixed aspects in parallel
- ·Correctness, security, style, performance
- ·Findings merged and sorted by severity
- ·Verdict is block when any blocker finding exists
- ·Eval: one reviewer per aspect, sorted merge, verdict
Hierarchical Supervisor
- ·A supervisor routes a goal to one or more teams
- ·Each team lead coordinates its own workers
- ·Reference teams: research and writing
- ·Team results bubble up to one assembler
- ·Eval: the right teams engaged, no team result dropped
What Every Pattern Folder Holds
README.md, ADR.md, failure-modes.md, cost-analysis.md, an eval folder with golden.json and run_eval.py, and the code under langgraph and claude-agent-sdk, each in python and typescript. A shared mock model backs the offline runs.
Five patterns ship in this release. More patterns are planned and are not in it. Additions and corrections released in the 12 months after your purchase are included. To get them, reopen the purchase page from your delivery email or sign in at redhub.ai/rig. No update email is sent.
Sample: Pattern 02, Routing. Code, eval output, failure notes, cost model.
Routing
A router classifies one input into exactly one category, and a conditional edge dispatches it to the single matching handler. No fan-out, no merge. An unrecognized class falls back to the general catch-all, so an off-menu label cannot send the input to a handler that does not exist.
Incoming message
│
▼
┌──────────────┐
│ Router │ ← classifies into one category
│ (category) │
└──────┬───────┘
│ one conditional edge, one target
├──→ billing handler
├──→ technical handler
├──→ sales handler
└──→ general handler ← catch-all for an unknown classCATEGORIES = ["billing", "technical", "sales", "general"]
def build_graph(model):
def router(state: State) -> dict:
# The router CLASSIFIES — it returns a bare category string, nothing else.
raw = model.complete("router", f"Classify this message into one category: {state['message']}")
category = raw.strip().lower()
if category not in CATEGORIES:
category = "general" # fail safe: an unknown class lands on the catch-all
return {"category": category}
def choose_handler(state: State) -> str:
# The conditional edge returns the NAME of the one handler node to run.
return state["category"]
def make_handler(category: str):
def handler(state: State) -> dict:
reply = model.complete("handler", f"[{category}] Reply to: {state['message']}")
return {"reply": reply}
return handler
g = StateGraph(State)
g.add_node("router", router)
for cat in CATEGORIES:
g.add_node(cat, make_handler(cat))
g.add_edge(START, "router")
# One input -> exactly one handler. The conditional edge picks the single target.
g.add_conditional_edges("router", choose_handler, CATEGORIES)
for cat in CATEGORIES:
g.add_edge(cat, END)
return g.compile()$ python patterns/02-routing/langgraph/python/routing.py category: billing Billing: I've pulled up your account — here's how to resolve that charge. [trace] router calls=1 handler calls=1 $ python patterns/02-routing/eval/run_eval.py [PASS] billing-double-charge [PASS] technical-login-error [PASS] sales-pricing-demo [PASS] general-greeting [PASS] technical-broken-feature 5/5 cases passed
Captured from the shipped zip on 2026-10-07 with Python 3.13.7 and langgraph 1.2.5, against the deterministic mock model. PASS means the control flow held on the mock. It does not measure how accurately a real model routes.
- ·The router mis-classifies. A billing question gets labeled technical, and the handler gives a fluent answer from the wrong specialist. Catch it by evaluating the router’s choice, not the final reply.
- ·An out-of-distribution input has no home. An off-menu label would dispatch to a node that does not exist. The reference code maps any unrecognized class to the general catch-all.
- ·The router becomes the bottleneck. Every request pays for one router call before any work happens. Tier the router onto the cheapest model that holds your eval accuracy, or pre-filter the obvious cases.
cost_per_run = router_call + handler_call
Two calls per run, always: one to classify, one to handle. The cost is flat in the number of categories, because only one handler fires. No dollar figures ship; plug in your own token shapes and your provider’s current prices.
| Lever | Effect | Note |
|---|---|---|
| Tier the router to a cheap model | Largest — paid on 100% of traffic | Verify accuracy holds on your routing eval first |
| Deterministic pre-filter (keyword/regex) | Skips the router call on obvious inputs | Only model-classify the ambiguous remainder |
| Tier handlers per category | Matches spend to class difficulty | Cheap model for easy categories, strong for hard |
| Prompt-cache the router's category rubric | Cuts repeated input tokens on every classify | Savings depend on cache-hit rate — verify with your provider |
| Collapse router + handler for trivial cases | Removes the router call entirely | Only when one model can classify-and-answer cheaply |
One pattern of five. Each one ships with the same parts: a README, code in four implementation paths, a control-flow eval, failure-mode notes, a cost analysis, and an architecture decision record.
Two platforms. Two languages. Four implementation paths per pattern.
Two platforms keep the scope manageable. Claude Agent SDK is Anthropic’s agent runtime: it owns the model loop and subagent delegation, so those copies need Claude Code and an API key. LangGraph is an open-source graph runtime you drive with your own model calls, so those copies take an injected model client and run offline against the included deterministic mock. Pick the path that matches your stack. Ignore the rest.
$ pip install claude-agent-sdk
Anthropic-committed stack. The SDK is the agent runtime, so these copies need Claude Code on PATH and an ANTHROPIC_API_KEY (or a logged-in subscription).
$ npm install @anthropic-ai/claude-agent-sdk
The same patterns on Node, written against the TypeScript SDK. Needs Claude Code on PATH and an ANTHROPIC_API_KEY.
$ pip install langgraph
Provider portability. Takes an injected model client, so it runs against the included deterministic mock with no key. The shipped evals run this copy.
$ npm install @langchain/langgraph
Provider portability on Node. The twin of the Python copy: the same injected model client and the same deterministic mock.
The patterns themselves translate. If your stack is on a different framework — OpenAI Agents SDK, Mastra, CrewAI, bare provider APIs — the architectures, failure-mode notes, and cost analysis still apply. You’ll port the code yourself, but you don’t reinvent the patterns.
Be honest about what the $79 buys you. And what it doesn’t.
- Five patterns, full code in four implementation paths each.
- A control-flow eval per pattern: 18 cases that run offline on a mock.
- Five failure modes per pattern, each with how to catch and mitigate it.
- A directional cost analysis per pattern: the formula and the levers.
- Architecture decision records explaining why each pattern was designed this way.
- Not a managed platform. No UI, no hosted runtime, no observability dashboard. The cookbook is code and documentation; deployment is your problem.
- Not OpenAI Agents SDK, Mastra, or CrewAI. Two platforms deliberately. Patterns translate; ports are your problem.
- Not voice agents. Different product category. See the Voice Agent Deployment Kit if that’s your scope.
- Not fine-tuning or training. The cookbook assumes you’re using off-the-shelf models. Custom training is a separate discipline.
- Not a RAG cookbook. None of the five patterns covers retrieval. RAG architecture is a different category with its own cookbook-shaped book somewhere out there.
The cookbook is one thing — a pattern reference for multi-agent orchestration — and it does that one thing thoroughly. The boundaries are deliberate. Other RedHub AI products cover other parts of the AI engineering stack.
Be honest with yourself before you click buy.
- Your team ships multi-agent features in production or is about to.
- You’re using Claude Agent SDK, LangGraph, or considering either.
- You’ve already reinvented at least one pattern badly.
- You’re a senior engineer, AI/ML engineer, eng manager, or technical founder.
- You want runnable patterns to own, not blog-post snippets to translate.
- You’re using OpenAI Agents SDK exclusively (patterns translate, code doesn’t).
- You haven’t shipped a single agent to production yet — start simpler.
- You want a managed platform with a UI and dashboards.
- You want done-for-you implementation, not a cookbook to own.
- Nobody on your team reads TypeScript or Python.
Orchestrate the agents, then prove they hold.
The patterns here stitch agents together; the rest of the reliability stack proves they work. The Agent Reliability Harness stress-tests the orchestrated flow end-to-end, the Prompt Eval System scores the prompts each step depends on, and the RAG Retrieval Grader grades the retrieval feeding them.
The questions engineers actually ask before pulling out the company card.
Two platforms keep the scope manageable. Claude Agent SDK is Anthropic's agent runtime: it owns the model loop and subagent delegation, so those copies need Claude Code and an Anthropic API key. LangGraph is an open-source graph runtime you drive with your own model calls, so those copies are not tied to one provider and run offline against the included mock. OpenAI Agents SDK, Mastra, and CrewAI are not covered. The patterns themselves translate: if you're on a different stack, the architecture decision records and failure-mode notes still apply, and the port is yours.
Five: Orchestrator-Worker, Routing, Retry-with-Reflection, Code Review Agent, and Hierarchical Supervisor. Each pattern folder holds a README, an architecture decision record, failure-mode notes (five per pattern), a directional cost analysis, a control-flow eval (golden.json plus run_eval.py), and the code in four paths: LangGraph in Python and TypeScript, and Claude Agent SDK in Python and TypeScript. The zip's own README calls this the MVP release. More patterns are planned and are not in this release.
No. Pick the implementation path that matches your stack: Claude Agent SDK if you're committed to Anthropic, LangGraph if you want provider portability. The LangGraph copies run offline against a deterministic mock model, so you can watch the control flow without an API key. The Claude Agent SDK copies need Claude Code and an Anthropic API key; they are written against the SDK's API, and the live run with your credentials is yours to do. The four paths exist so you don't have to translate; pick yours and ignore the rest.
You get lifetime access, 12 months of updates. A revised cookbook replaces the zip at the same download, so two routes reach the current files: reopen the purchase page linked in your delivery email (its download links refresh on every visit), or sign in at redhub.ai/rig with the email you paid with. RedHub AI does not email you when the cookbook changes, and the zip carries no changelog and no version-pin file, so download again when you want to check, or email support@redhub.ai for a fresh copy. Because both SDKs change often, the README tells you to verify current package names and model IDs in the vendor documentation instead of quoting a version that could age out.
No. Each pattern's cost-analysis.md is a model of the cost structure, not a measurement: the per-run formula (for Routing, one router call plus one handler call), what the cost scales with, and the levers in rough order of impact. It quotes no dollar figures, token counts, or latency numbers, and no benchmark runs ship. You plug in your own token shapes and your provider's current prices.
Yes, but no composition guide ships. Each pattern README has a when-to-use table that names the alternative pattern for the cases it handles badly, and two patterns are described in terms of another: Code Review Agent is a specialization of Orchestrator-Worker's parallel fan-out, and Hierarchical Supervisor adds a second level of delegation to it. Some alternatives those tables name, such as prompt chaining, are not among the five. Wiring two patterns into one system is your work.
The Claude Agent SDK copies are Anthropic-only by design. The LangGraph copies accept any object with a complete(role, prompt) method that returns a string, so you can put the Anthropic SDK or another provider's SDK behind that one method. Each pattern README sketches the Anthropic version; an adapter for any other provider is yours to write and test. No provider benchmark ships: the evals run against a deterministic mock, not a model, and they check control flow, not answer quality.
Yes. The cookbook is licensed for single-operator use across unlimited projects — your own products, your agency clients, your portfolio. Team licensing for multi-operator engineering teams is available on request through the RedHub AI support inbox.
30-day no-questions refund. If the cookbook doesn't save you the engineering weeks your team would otherwise spend reinventing these patterns badly, you shouldn't have paid. Email RedHub AI support and the $79 comes back.
Stop reinventing patterns.
Ship the ones that work.
$79 once. Five patterns. Full code in Claude Agent SDK and LangGraph, Python and TypeScript. Control-flow evals, failure notes, cost models. Your senior engineer’s best week, written down.
Sold by RedHub AI LLC · Secured by Stripe · redhub.ai