0Pricing
Claude Architect · Lektion

Feste Pipelines vs. adaptive Zerlegung

Prompt Chaining für bekannte Schritte, adaptive Zerlegung für offene Aufgaben

Feste Pipelines vs. adaptive Zerlegung ist eine kostenlose Claude Architect-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Claude Architect-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Claude Architect-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Two Ways to Break Down Work

When a task is too big for a single prompt, you decompose it. There are two fundamental strategies, and choosing the right one is a core architecture skill.

  • Fixed pipeline (prompt chaining): you hard-code a known sequence of steps. Step 1 feeds Step 2 feeds Step 3.
  • Adaptive decomposition: the model decides what to do next based on what it discovers, looping until the goal is met.

The rule of thumb: fixed pipelines for known sequential steps; adaptive for open-ended investigations. This lesson makes that decision precise.

Fixed Pipeline = Prompt Chaining

A fixed pipeline is just prompt chaining: you orchestrate a deterministic sequence in your own code. You know the steps in advance, so you wire them up explicitly. Each call does one focused job, and its output becomes the next call's input.

Because you control the order, the flow is predictable, debuggable, and cheap to reason about. There is no model-driven branching about what to do next — only the work inside each step.

# Fixed pipeline: extract -> classify -> summarize
from anthropic import Anthropic
client = Anthropic()

def step(system, user):
    r = client.messages.create(
        model="claude-sonnet-4-5",
        max_tokens=1024,
        system=system,
        messages=[{"role": "user", "content": user}],
    )
    return r.content[0].text

entities = step("Extract entities as JSON.", document)
category = step("Classify this record.", entities)
summary  = step("Write a one-line summary.", category)

When a Fixed Pipeline Wins

Reach for a fixed pipeline when the work has a stable, known shape:

  • The steps are the same every run (extract, then validate, then format).
  • Order matters and rarely changes.
  • You want predictable cost, latency, and easy debugging.
  • Each stage has a clear, narrow responsibility.

Classic example: structured data extraction. Extract fields, then run a validation/retry pass, then attach provenance. You always do those three things, in that order — so chain them.

Adaptive Decomposition = Model-Driven

Adaptive decomposition hands the planning to the model. You give it tools and a goal; it inspects results and chooses the next action. This is the agentic loop: send a request, inspect the stop_reason, and if it's tool_use, run the tools, append results to history, and repeat until end_turn.

You cannot pre-wire the path because you don't know it in advance — it depends on what each step reveals.

# Adaptive: the model decides which tool to call next
while True:
    resp = client.messages.create(
        model="claude-sonnet-4-5",
        max_tokens=2048,
        tools=tools,
        messages=messages,
    )
    if resp.stop_reason == "tool_use":
        results = run_tools(resp)          # execute requested tools
        messages.append({"role": "assistant", "content": resp.content})
        messages.append({"role": "user", "content": results})
        continue
    break  # terminate on stop_reason, never by parsing text

When Adaptive Decomposition Wins

Choose adaptive decomposition for open-ended investigations where the path can't be known ahead of time:

  • Debugging from a vague symptom — you grep, read, then grep usages based on what you find.
  • Multi-source research where follow-up queries depend on earlier answers.
  • Customer support where the next action depends on what a lookup returns.

Here the branching IS the work. A rigid pipeline would either miss paths or explode into unmaintainable conditionals.

Terminate on stop_reason, Not on Text

The single most common adaptive-loop mistake on the exam: ending the loop by scanning the model's text for words like "done" or "finished." Don't. Decisions are model-driven; terminate on the API stop_reason.

The loop ends when stop_reason is end_turn. While it's tool_use, you keep going. An iteration cap is a safety net only — never the primary stop mechanism. Reserve hard-coded control for guarantees, not for deciding when the work is conceptually complete.

# WRONG: parsing text for completion
if "done" in resp.content[0].text.lower():
    break

# RIGHT: drive on stop_reason; cap is only a safety net
MAX_STEPS = 25
for _ in range(MAX_STEPS):
    resp = client.messages.create(...)
    if resp.stop_reason != "tool_use":
        break  # end_turn / max_tokens / stop_sequence

Hybrid: Pipelines Containing Adaptive Stages

Real systems mix both. The outer flow is often a fixed pipeline, but one stage may be an adaptive agentic loop. You get the predictability of chaining at the macro level and flexibility where you genuinely need it.

Example: an extraction pipeline whose middle stage is an adaptive "resolve ambiguities" agent that may call lookup tools an unknown number of times — wrapped by a deterministic validate-and-format stage before and after.

# Outer = fixed chain; one stage = adaptive loop
raw      = extract_stage(document)        # fixed
resolved = adaptive_resolver(raw)         # agentic loop inside
final    = validate_and_format(resolved)  # fixed

Multi-Pass Code Review: A Decomposition Choice

Decomposition isn't only about pipelines vs loops — it's also about how you split a task to protect the model's attention. Multi-file code review is the canonical case.

A single pass over many files dilutes attention and misses both local bugs and integration issues. The fix is a deliberate decomposition: a per-file local pass first, then a separate cross-file integration pass. Two focused passes beat one unfocused pass.

# Decompose review into focused passes
for f in changed_files:
    review_local(f)          # pass 1: per-file, focused

review_cross_file(changed_files)  # pass 2: integration concerns

Coordinators Decompose Adaptively

In a hub-and-spoke multi-agent system, the coordinator decomposes the goal, delegates to subagents, then aggregates. This is adaptive decomposition at the orchestration layer — the coordinator decides how to split based on the request.

Critical: subagents do not inherit the coordinator's conversation history. Every subagent prompt must carry its full context explicitly. Multiple Task calls in one response run in parallel — useful when sub-problems are independent.

# Coordinator delegates with explicit, self-contained context
subagent_prompt = f"""You are researching ONE sub-topic.
Context (do not assume shared history):
  Goal: {goal}
  Sub-topic: {subtopic}
  Constraints: {constraints}
Return findings with source citations."""

Sessions: Resume, Fork, or Start Fresh

Adaptive work often spans sessions. Claude Code gives you --resume <name> to continue a named session and fork_session to branch from a shared point and explore alternatives in parallel.

But beware: resumed tool results can be stale if the codebase changed since. Sometimes a fresh session seeded with a structured summary beats resuming — you get current state plus the distilled context, without dragging outdated tool output along.

# Continue a named session
claude --resume refactor-auth

# Branch to explore an alternative path
# fork_session creates a sibling from the shared point

# When code moved on, prefer a fresh session + summary
claude -p "Here is a structured summary of prior work: ..."

A Decision Checklist

Before you build, ask:

  • Do I know the steps in advance, in a fixed order? -> fixed pipeline / prompt chaining.
  • Does the next step depend on what earlier steps reveal? -> adaptive agentic loop.
  • Mostly fixed with one uncertain stage? -> hybrid: chain the outer flow, embed an adaptive loop.
  • Reviewing many files? -> decompose into per-file then cross-file passes.

And always: terminate adaptive loops on stop_reason, with iteration caps only as a safety net.

Quick Check

A scenario-based decision on choosing a decomposition strategy.

Recap

Key takeaways:

  • Fixed pipeline (prompt chaining) for known, ordered steps — predictable, debuggable, cheap.
  • Adaptive decomposition for open-ended investigations where the next step depends on what you discover.
  • Hybrid is common: a fixed outer flow with an adaptive stage embedded.
  • Always terminate adaptive loops on stop_reason (end_turn); iteration caps are a safety net, never the primary stop. Never parse text for "done."
  • For multi-file review, decompose into a per-file pass then a separate cross-file pass.
  • Subagents don't inherit history — pass context explicitly. Resume sessions carefully; a fresh session with a structured summary can beat stale resumed tool results.

Häufig gestellte Fragen

Ist die Lektion „Feste Pipelines vs. adaptive Zerlegung“ kostenlos?

Ja — der vollständige Text von „Feste Pipelines vs. adaptive Zerlegung“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Claude Architect-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Claude Architect-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Feste Pipelines vs. adaptive Zerlegung“?

Prompt Chaining für bekannte Schritte, adaptive Zerlegung für offene Aufgaben Du übst Claude Architect mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Claude Architect zu starten?

Keine Vorkenntnisse erforderlich. Claude Architect auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.

Wie lange dauert die Lektion „Feste Pipelines vs. adaptive Zerlegung“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Claude Architect-Lektion Code schreiben und ausführen?

Ja. Jede Claude Architect-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Feste Pipelines vs. adaptive Zerlegung
  2. Mehrstufige Zerlegung
  3. Sitzungsverwaltung
  4. Veralteter Context und Neustart
← Zurück zu Claude Architect