What you will be able to do
- Decide whether a business requirement calls for a single call, a fixed workflow or an autonomous agent, given its error tolerance
- Match a task to prompt chaining, routing, parallelization, orchestrator-workers or evaluator-optimizer
- Decide when to split work across an orchestrator and subagents, and what that costs
- Choose between the Client SDK, the Agent SDK and Claude Managed Agents, and between a managed and a self-hosted sandbox, under audit and compliance constraints
Key concept
Workflow versus agent — In a workflow, your code fixes the path that model calls and tools follow. In an agent, the model decides its own next step and which tool to use. Every architecture decision here comes down to how much of that path you hand to the model, and what that costs in predictability, tokens and auditability.
1.Workflow or agent: how much control to hand the model
Before choosing a runtime, decide who controls the path of the work. A workflow sends model calls and tools down code paths you wrote in advance. An agent lets the model direct its own process: it picks the next tool, reads the result and decides what to do next, until it judges the task complete. Anthropic files both under "agentic systems". The difference matters because it decides who owns each decision, and so who answers for it when it goes wrong.
Start with the simplest design that works, and add complexity only when the simpler design falls short. Often that means building no agentic system at all: a single model call improved with retrieval and in-context examples handles many applications. Agentic systems trade latency and cost for better task performance, and that trade only pays off on some tasks.
When more structure is warranted, the requirement tells you which side to pick. Workflows give predictability and consistency on well-defined tasks. Agents fit when you need flexibility and model-driven decisions at scale. On the API side, the same split shows up as a product choice. The Messages API is for teams that want custom agent loops and fine-grained control. Claude Managed Agents provides a ready-made harness for long-running, asynchronous work.
Frameworks deserve the same caution. They simplify the low-level work of calling models, parsing tools and chaining calls. But they add layers of abstraction that hide the actual prompts and responses, which makes failures harder to debug, and they make it tempting to add complexity that isn't needed. Many patterns take only a few lines against the API directly. If you do adopt a framework, know what it does underneath, because wrong assumptions about the internals are a common source of errors.
Checkpoint 1 of 9· Check yourself
A team needs to automate a well-defined task. The steps are the same every time, and compliance reviewers require consistent, predictable results. A single optimized model call is not enough. Which design fits these requirements best?
When the task is well-defined and the requirement is predictability and consistency, a workflow fits, because your code fixes the path. Agents fit when you need flexibility and model-driven decisions at scale. Frameworks hide the prompts and responses, which makes failures harder to debug, not more consistent.
“workflows offer predictability and consistency for well-defined tasks, whereas agents are the better option when flexibility and model-driven decision-making are needed at scale”Source: www.anthropic.com
2.The five workflow patterns and what each one fits
Five patterns cover most agentic systems in production. Each is built from an LLM given retrieval, tools and memory, and each fits a different shape of task. Learn each one by the situation it fits, because on the exam the situation is the only clue you get.
| Pattern | How it works | Use it when |
|---|---|---|
| Prompt chaining | A fixed sequence of calls, each processing the previous output, with optional programmatic gates between steps | The task splits cleanly into fixed subtasks; you accept extra latency for higher accuracy |
| Routing | Classify the input, then send it to a specialized follow-up prompt, toolset or model | Distinct input categories are better handled separately and can be classified accurately |
| Parallelization: sectioning | Independent subtasks, split in code, run in parallel and are aggregated programmatically | Subtasks are independent, or each consideration deserves focused attention |
| Parallelization: voting | The same task runs several times to get diverse outputs | Multiple attempts are needed for higher-confidence results |
| Orchestrator-workers | A central LLM breaks the task down at runtime, delegates to workers and synthesizes their results | You can't predict the subtasks in advance, such as multi-file code changes |
| Evaluator-optimizer | One call generates, another evaluates and gives feedback, in a loop | Clear evaluation criteria exist and iterative refinement gives measurable value |
Routing fits support desks well. Separating the categories lets each one get its own prompt, so tuning for refund requests doesn't degrade answers to technical questions. The same classify-then-dispatch step can also choose a model tier: easy or common questions go to a smaller, cheaper model such as Claude Haiku 4.5, and hard or unusual ones go to a more capable model such as Claude Sonnet 4.5. Routing is a front door that sorts traffic. It doesn't split one ticket into parts, run a fixed sequence on every ticket, or take a vote.
Orchestrator-workers and sectioning are easy to confuse because they look alike: work fans out to several model calls, and the results come back together. The difference is who decides the split. In sectioning, your code defines the subtasks before any input arrives. In orchestrator-workers, the subtasks are not defined in advance: the orchestrator decides them from the specific input. Neither feature separates them: both can run workers in parallel, and both combine the outputs. Voting differs from both. It runs the *same* task several times, where the other two hand out different parts.
No. It is sectioning: the three subtasks were fixed in code before the diff arrived. It would become orchestrator-workers only if a central model read the diff and decided for itself which checks to run, and how many.
Evaluator-optimizer fits when two conditions hold. Responses get demonstrably better when a human articulates feedback, and a model can give that kind of feedback itself. Literary translation is the typical case. Without clear evaluation criteria, the loop has nothing to improve toward.
Checkpoint 2 of 9· Match them up
Each scenario below fits one workflow pattern best. Match each pattern to its scenario.
Tap a term, then the definition that fits it.
Sectioning and orchestrator-workers both fan work out and combine the results. What separates them is who decides the split: in sectioning your code fixes it in advance, and in orchestrator-workers a central model decides it at runtime from the input. Voting repeats the same task, routing sorts inputs into categories, and evaluator-optimizer loops generation against feedback.
“the key difference from parallelization is its flexibility—subtasks aren't pre-defined, but determined by the orchestrator based on the specific input.”Source: www.anthropic.com
Checkpoint 3 of 9· Exam question
A support desk receives tickets that are either simple password or billing questions, or complex technical incidents. The team wants simple tickets answered cheaply and complex ones handled by a stronger model with different instructions. Which pattern applies?
Correct answer: D — Routing: classify each ticket first, then send it to a specialised prompt and model tier suited to that category
- A. Incorrect: orchestrator-workers decomposes one large task dynamically; these tickets are independent inputs that need categorising, not splitting.
- B. Incorrect: a fixed chain sends every ticket through every step, so simple tickets still pay for the strongest model.
- C. Incorrect: voting multiplies cost on every ticket to raise confidence, the opposite of the cost goal here.
- D. Correct: routing classifies the input and directs it to a follow-up task, which is how simple queries reach a cheaper model while hard ones reach a stronger one.
Checkpoint 4 of 9· Exam question
What distinguishes the orchestrator-workers pattern from a parallelization workflow that uses sectioning?
Correct answer: C — In orchestrator-workers, a central model decides how to split the task from the input, while sectioning uses a split defined in code
- A. Incorrect: passing results down a fixed chain of steps describes prompt chaining. In orchestrator-workers the orchestrator delegates subtasks to workers, which can run concurrently. What separates it from sectioning is who decides the subtasks.
- B. Incorrect: giving the same task to several workers and comparing the outputs is the voting variant of parallelization. Orchestrator-workers assigns different, dynamically chosen subtasks.
- C. Correct: the defining trait of orchestrator-workers is that the orchestrating model breaks the task down dynamically based on the input. In sectioning, the developer predefines the independent subtasks in code.
- D. Incorrect: in orchestrator-workers the orchestrator collects and synthesises the workers' results into the final output, so results are combined in both patterns.
3.Matching the architecture to error tolerance and audit needs
Error tolerance is the requirement that most often rules out an open-ended agent. Each step in an autonomous loop is a model decision, and the errors multiply. At 95 percent accuracy per step, a 25-step run finishes with no mistakes only about 28 percent of the time (0.95 to the power 25). When the business can tolerate almost no wrong actions, as with refunds, the fix is architectural: use fewer steps, fix the path in code, and add a validation gate before the irreversible action.
Prompt chaining provides exactly that gate. You can add programmatic checks between steps to confirm the process is still on track. Agents can also pause for human feedback at checkpoints. Where you do keep a loop, add stopping conditions such as a maximum number of iterations, to keep control. More turns don't make a loop more accurate. They give it more steps to get wrong. An instruction in the system prompt to "be careful" doesn't enforce anything. Duplicate subagents that repeat each step multiply token spend and add more points of failure. Enforcing these rules in code is covered under deterministic guardrails.
Audit constraints shape the runtime choice as well. In Claude Managed Agents, sessions are stateful resources: the service keeps each session's event history, you can fetch it in full, and transcripts persist until you delete them. That gives you a complete record of every user turn, tool result and status update to review later. The same persistence matters for data handling, which the runtime section below takes up.
Checkpoint 5 of 9· Check yourself
Your refund agent runs an autonomous loop of about 25 model-driven steps, and now and then it issues a refund it shouldn't. Refunds can't be reversed, and the business tolerates almost no wrong ones. Which change best addresses the requirement?
Every model-driven step is another chance for an error, so the fix is in the architecture: use fewer steps, fix the path in code, and gate the irreversible action with a check in code. More turns add steps that can go wrong. A prompt instruction enforces nothing. Duplicate subagents multiply token spend and add more points of failure.
“You can add programmatic checks (see "gate” in the diagram below) on any intermediate steps to ensure that the process is still on track.”Source: www.anthropic.com
Checkpoint 6 of 9· Exam question
An agent takes up to 25 autonomous steps to complete a refund workflow, and testing shows each step is right about 95 percent of the time. The business tolerates almost no wrong refunds. What is the most appropriate architectural response?
Correct answer: D — Replace the open-ended loop with fewer fixed workflow steps and a validation checkpoint before any refund
- A. Incorrect: more turns means more steps at which something can go wrong; the agent has no external signal to catch its own mistake.
- B. Incorrect: a prompt reminder does not change the per-step error rate or stop an incorrect refund from being issued.
- C. Incorrect: duplicating steps across subagents adds cost and coordination, and the loop has no reliable arbiter for disagreements.
- D. Correct: errors compound across many autonomous steps, so reducing model-chosen steps and gating the irreversible action with a check matches a very low error tolerance.
4.When to split work across an orchestrator and subagents
A multi-agent system runs several model instances, each with its own conversation context, coordinated through code. The usual pattern is orchestrator-subagent: a lead agent spawns specialized subagents for specific subtasks and manages them. It is the simplest way to coordinate multiple agents, but it doesn't come free, and teams have spent months building multi-agent systems only to find that better prompting on a single agent did as well.
Multiple agents reliably beat one agent in three situations:
- Context pollution. A subtask produces a lot of output the main task doesn't need, such as a 2,000-token order history pulled in while the agent diagnoses a technical fault. A subagent can process the full history and hand back a 50–100-token summary.
- Parallel exploration. A lead agent splits a research question into independent facets and gives each to its own subagent.
- Specialization. One agent has too many tools (often 20+), tools spanning unrelated domains, or performance on existing tasks drops when tools are added. Smaller agents with focused toolsets do better.
Outside those three situations, coordination costs usually outweigh the benefits. Multi-agent implementations typically use 3–10x more tokens than a single agent on the same task. The extra comes from context duplicated across agents, coordination messages, and summaries at each handoff. Pipelines that put planning, execution, review and iteration in separate agents also lose context at every handoff. Every added agent is another point of failure and another prompt to maintain. Over-delegation in a running system is a diagnosis topic, covered under agent pattern diagnosis.
Claude Managed Agents gives the lead agent three ways to share out work. It can delegate to subagents and read what each one reports. A subagent's thread persists, so the lead can send follow-up messages and the subagent keeps its earlier turns. It can write a dynamic workflow: a program the server runs in the background, which runs many agents in phases and combines their results. The lead can't send follow-ups to a run's threads, and the server archives each one when the run ends. Or it can consult an advisor model for guidance at key moments, such as planning or a final review, while doing the work itself.
These limits constrain the decomposition you can build. Delegation goes only one level deep: listing an agent that itself has multiagent set fails with a 400 error. A session can have at most 25 child threads at a time, idle ones included. Each predefined_agents list can name up to 20 unique agents. Inline agents (defined on the fly by the lead agent or by a workflow) are on by default, so to allow only agents you have reviewed, disable them explicitly:
{
"multiagent": {
"type": "multiagent_20261001",
"subagents": {
"type": "enabled",
"inline_agents": { "type": "disabled" },
"predefined_agents": ["agent_01J8XkN5uT3vHpLqRfWdY2", { "type": "self" }]
},
"workflows": {
"type": "enabled",
"inline_agents": { "type": "disabled" },
"predefined_agents": [
{ "type": "agent", "id": "agent_01Lm4cV8yQ2tNs7XbKdR5h", "version": 2 }
]
}
}
}Context is isolated between agents, but the environment is shared. Each agent runs in its own session thread with its own conversation history, yet all of them share one sandbox, filesystem and set of vault credentials. MCP servers are scoped to each agent, so you can keep a GitHub server away from the lead by declaring it only on a researcher subagent. An inline agent has no definition of its own and inherits the lead's MCP servers, so declaring fewer servers can't restrict it.
Checkpoint 7 of 9· Fill the gap
This lead agent may delegate only to reviewed agents, so inline agents are off. It still needs to hand work to copies of itself. Which entry type completes its subagents list?
{
"multiagent": {
"type": "multiagent_20261001",
"subagents": {
"type": "enabled",
"inline_agents": { "type": "disabled" },
"predefined_agents": ["agent_01J8XkN5uT3vHpLqRfWdY2", { "type": " ? " }]
},
"workflows": {
"type": "enabled",
"inline_agents": { "type": "disabled" },
"predefined_agents": [
{ "type": "agent", "id": "agent_01Lm4cV8yQ2tNs7XbKdR5h", "version": 2 }
]
}
}
}The {"type": "self"} entry lists the agent itself, so copies of it can take on work while inline agents stay disabled. Copies of the lead are not inline agents, and inline agents are switched off here anyway. The "agent" type needs an id and points to a different, previously created agent.
Source: platform.claude.comCheckpoint 8 of 9· Check yourself
Security review requires that only a reviewed researcher subagent can reach the GitHub MCP server in a Managed Agents session. Every other agent, including any agent the lead spawns on the fly, must be kept away from it. What setup meets this?
MCP servers are scoped to each agent, so declaring GitHub only on the researcher keeps it away from the lead. An inline agent has no definition of its own and inherits the lead's servers, which means only disabling inline agents and listing reviewed ones restricts them. Vault credentials apply to the whole session, and a prompt instruction enforces nothing.
“An inline agent has no agent definition, so it uses the MCP servers and tools of the agent that the session runs.”Source: platform.claude.com
5.Choosing where the agent runs: your harness or a managed runtime
Once the architecture is set, choose who runs the loop and where tools execute. The choices run from writing everything yourself to having Anthropic host the whole harness.
| Option | Who runs the loop | Where it runs | Wins when |
|---|---|---|---|
| Client SDK (Messages API) | You write the tool loop, or use the beta tool runner | Your code | You need custom agent loops and fine-grained control |
| Agent SDK | A library that runs the Claude Code binary, with built-in tools, permissions, sessions and hooks | In a process you operate, from Python or TypeScript | You want Claude Code's agent embedded in your own application or existing infrastructure |
| Claude Code CLI | Claude Code in the terminal | A developer's terminal | Interactive development or one-off tasks |
| Managed Agents | A hosted agent harness that runs the agent loop | An Anthropic-managed cloud sandbox, or a self-hosted sandbox on your own infrastructure | Long-running, asynchronous or scheduled work without building your own loop, sandbox or tool layer |
Match the runtime to the task. A nightly CI job that runs for a few minutes against a checked-out repository already has a host and a lifecycle, so running the Agent SDK in a process you operate fits it. What it adds there is hooks and permissions, configured as covered in Agent SDK construction and hooks. Managed Agents earns its place on tasks that run for minutes or hours with many tool calls, on stateful sessions with persistent filesystems and conversation history across interactions, and on recurring runs on a cron schedule. It provides built-in Bash, file operations, web search and fetch (optionally limited to an allowlist or blocklist of domains), and MCP servers, plus prompt caching and compaction.
The statefulness that makes Managed Agents convenient also limits where you can use it. Sessions store conversation history, sandbox state and outputs on the server, so Managed Agents is not eligible for Zero Data Retention or HIPAA BAA coverage. Zero Data Retention has one exception: self-hosted Claude Managed Agents, where the whole service runs on your own infrastructure and you store that data yourself. A self-hosted sandbox, where only the execution environment is yours, is meant for compliance and data-residency requirements. You keep control of retained data: you can delete sessions, and separately delete uploaded files, at any time through the API.
Checkpoint 9 of 9· Match them up
Four teams each have one requirement that decides where their agent runs. Match each runtime option to the requirement it fits best.
Tap a term, then the definition that fits it.
The Messages API is for custom loops and fine-grained control. Managed Agents in the cloud saves you from building a loop, sandbox or tool layer for long-running work. A self-hosted sandbox keeps only the execution environment on your infrastructure, which meets compliance and data-residency needs. The Zero Data Retention exception applies only when the whole service is self-hosted.
“Self-hosted execution: Sandboxes on infrastructure you control for compliance or data-residency requirements”Source: platform.claude.com
Sources
(5)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://www.anthropic.com/engineering/building-effective-agentsSecondary source
“Agents, on the other hand, are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks.”
↩︎ Workflow or agent: how much control to hand the model“Agentic systems often trade latency and cost for better task performance, and you should consider when this tradeoff makes sense.”
↩︎ Workflow or agent: how much control to hand the model“they often create extra layers of abstraction that can obscure the underlying prompts and responses, making them harder to debug.”
↩︎ Workflow or agent: how much control to hand the model“Routing classifies an input and directs it to a specialized followup task.”
↩︎ The five workflow patterns and what each one fits“Routing easy/common questions to smaller, cost-efficient models like Claude Haiku 4.5 and hard/unusual questions to more capable models”
↩︎ The five workflow patterns and what each one fits“Voting: Running the same task multiple times to get diverse outputs.”
↩︎ The five workflow patterns and what each one fits“This workflow is particularly effective when we have clear evaluation criteria, and when iterative refinement provides measurable value.”
↩︎ The five workflow patterns and what each one fits“on any intermediate steps to ensure that the process is still on track.”
↩︎ Matching the architecture to error tolerance and audit needs“Agents can then pause for human feedback at checkpoints or when encountering blockers.”
↩︎ Matching the architecture to error tolerance and audit needs“include stopping conditions (such as a maximum number of iterations) to maintain control.”
↩︎ Matching the architecture to error tolerance and audit needs“Workflows are systems where LLMs and tools are orchestrated through predefined code paths.”
↩︎ Key concept“subtasks aren't pre-defined, but determined by the orchestrator based on the specific input”
↩︎ Exam trap 1“workflows offer predictability and consistency for well-defined tasks, whereas agents are the better option when flexibility and model-driven decision-making are needed at scale”
↩︎ Exam trap 2“workflows offer predictability and consistency for well-defined tasks, whereas agents are the better option when flexibility and model-driven decision-making are needed at scale”
↩︎ Checkpoint“the key difference from parallelization is its flexibility—subtasks aren't pre-defined, but determined by the orchestrator based on the specific input.”
↩︎ Checkpoint“You can add programmatic checks (see "gate” in the diagram below) on any intermediate steps to ensure that the process is still on track.”
↩︎ Checkpoint - 2.
“Custom agent loops and fine-grained control”
↩︎ Workflow or agent: how much control to hand the model“The Managed Agents service keeps the event history, and you can fetch it in full.”
↩︎ Matching the architecture to error tolerance and audit needs“Sessions are stateful resources; transcripts persist until you delete them.”
↩︎ Matching the architecture to error tolerance and audit needs“Long-running execution: Tasks that run for minutes or hours with multiple tool calls”
↩︎ Choosing where the agent runs: your harness or a managed runtime“Self-hosted execution: Sandboxes on infrastructure you control for compliance or data-residency requirements”
↩︎ Choosing where the agent runs: your harness or a managed runtime“you can delete sessions, and separately delete any files you uploaded, at any time through the API.”
↩︎ Choosing where the agent runs: your harness or a managed runtime“Managed Agents is not currently eligible for Zero Data Retention or HIPAA Business Associate Agreement (BAA) coverage.”
↩︎ Exam trap 5“Not eligible for HIPAA. Applies to all Managed Agents sub-features.”
↩︎ Prediction - 3.
“Specialization: Route to agents with domain-focused system prompts and tools, such as a security agent or a documentation agent”
↩︎ The five workflow patterns and what each one fits“Parallelization: Fan out independent subtasks simultaneously (searching multiple sources, analyzing separate files) and have the agent synthesize the results.”
↩︎ The five workflow patterns and what each one fits“With subagents, it delegates tasks itself and reads what each subagent reports.”
↩︎ When to split work across an orchestrator and subagents“The agent writes a workflow: a program that runs many agents in phases and combines their results.”
↩︎ When to split work across an orchestrator and subagents“Delegation is one level deep, and a session can have at most 25 child threads at a time, idle ones included.”
↩︎ When to split work across an orchestrator and subagents“Inline agents are on by default under both settings.”
↩︎ When to split work across an orchestrator and subagents“All agents share the same sandbox, filesystem, and vault credentials, but each agent runs in its own session thread”
↩︎ When to split work across an orchestrator and subagents“To limit an agent’s access, declare only the servers it needs in its agent definition. You can’t limit an inline agent this way.”
↩︎ Exam trap 4“An inline agent has no agent definition, so it uses the MCP servers and tools of the agent that the session runs.”
↩︎ Checkpoint - 4.
“A multi-agent system is an architecture where multiple LLM instances run with separate conversation contexts, coordinated through code.”
↩︎ When to split work across an orchestrator and subagents“when context pollution degrades performance, when tasks can run in parallel, and when specialization improves tool selection or task focus.”
↩︎ When to split work across an orchestrator and subagents“An agent with too many tools (often 20+) struggles to select the appropriate one.”
↩︎ When to split work across an orchestrator and subagents“they suffered from lost context at each handoff and spent more tokens coordinating than executing”
↩︎ When to split work across an orchestrator and subagents“In our testing, multi-agent implementations typically use 3-10x more tokens than single-agent approaches for equivalent tasks.”
↩︎ Exam trap 3“The primary benefit of parallelization is thoroughness, not speed.”
↩︎ Prediction - 5.https://code.claude.com/docs/en/agent-sdk/overviewOfficial docs
“in a process you operate”
↩︎ Choosing where the agent runs: your harness or a managed runtime“You write the tool loop yourself”
↩︎ Choosing where the agent runs: your harness or a managed runtime“A hosted agent harness that runs the agent loop, with sessions in an Anthropic-managed cloud sandbox or a self-hosted sandbox on your own infrastructure.”
↩︎ Choosing where the agent runs: your harness or a managed runtime