What you will be able to do
- Turn a business requirement into the simplest Claude design that meets it, and say when a workflow or an agent is justified
- Trace a request from input through context assembly, the model call and tool execution to output
- Decide where each tool runs (your application or Anthropic's servers) and what your code is responsible for
- Design a feedback loop that grades output against explicit criteria and sends the feedback back for another iteration
Key concept
Workflows vs. agents — Both are agentic systems. A workflow sends the model and tools down code paths you fixed in advance. An agent lets the model decide its own steps and tool calls. Choosing between them is the first decision in any end-to-end design.
1.From business requirement to the simplest design that works
An end-to-end architecture starts with a requirement, not a pattern. Anthropic's guidance is to find the simplest solution that works and add complexity only when it is needed. Sometimes that means not building an agentic system at all. Complexity has a price: agentic systems often accept extra latency and cost in exchange for better task performance. So the architect's first job is to decide whether the requirement justifies that trade.
The basic building block is the augmented LLM: a model enhanced with retrieval, tools and memory, which it can use on its own initiative. For many applications, one well-optimized call to an augmented LLM is the whole architecture. Retrieval and in-context examples are often enough. Some tasks need no tools at all. The tool-use documentation says summarization, translation and general-knowledge questions do not need a tool round trip.
When more complexity is justified, the next choice is between a workflow and an agent. A workflow fits a well-defined task, because its fixed code path gives predictable and consistent results. An agent fits when you need flexibility and decisions made by the model at scale. If you use a framework such as the Claude Agent SDK, make sure you understand the code underneath. Frameworks can add layers of abstraction that hide the actual prompts and responses.
Checkpoint 1 of 6· Check yourself
A support team wants Claude to answer product FAQs using the company's help-centre articles. Answers have no side effects, and the questions are well understood. What should the architect try first?
The guidance is to start as simply as possible. For many applications, one call improved with retrieval and examples is enough, and complexity is added only when that falls short.
“For many applications, however, optimizing single LLM calls with retrieval and in-context examples is usually enough.”Source: www.anthropic.com
2.Input → processing → output: the agent loop
Once a design includes tools, every request goes through the same loop. On the input side, Claude receives more than the user's prompt. The system prompt, the tool definitions and the conversation history are assembled around it. That assembled context is everything the model knows when it decides what to do.
Processing is a cycle. Claude evaluates the current state and replies with text, one or more tool-call requests, or both. The tools run, and each set of results goes back to Claude for its next decision. Each full cycle is one turn, and turns repeat until Claude replies without calling a tool. Your application can also step in during the loop: hooks can intercept, modify or block a tool call before it runs. On the output side, the SDK emits a final result message containing the answer, token usage, cost and session ID. These are the figures you need to judge the design against its business targets.
| Stage | What happens | Message yielded |
|---|---|---|
| Receive prompt | Prompt arrives with system prompt, tool definitions and history | SystemMessage (subtype "init") |
| Evaluate and respond | Claude replies with text, tool calls, or both | AssistantMessage per content block |
| Execute tools | SDK runs each requested tool and returns results to Claude | UserMessage with tool result content |
| Return result | Final text-only response, then the run ends | ResultMessage with final text, token usage, cost, session ID |
If you call the Messages API directly instead of using the SDK, you write this loop yourself. It is keyed on stop_reason. As long as the reply comes back with "tool_use", you run the tools and continue the conversation. Any other stop reason ("end_turn", "max_tokens", "stop_sequence" or "refusal") ends the loop, and your application has to handle it.
Checkpoint 2 of 6· Put it in order
Put the steps of a client-side tool loop on the Messages API in order.
- 1.Execute each tool and format the outputs as tool_result blocks
- 2.Repeat while stop_reason is "tool_use"
- 3.Send a request with your tools array and the user message
- 4.Claude responds with stop_reason "tool_use" and one or more tool_use blocks
- 5.Send a new request with the original messages, the assistant's response and the tool_result blocks
The documentation fixes this order: request, tool_use response, execution, a follow-up request that carries the results, then repeat.
“Repeat from step 2 while stop_reason is "tool_use".”Source: platform.claude.com
Checkpoint 3 of 6· Exam question
A team is designing the processing stage of a customer-support architecture. Support tickets arrive continuously and must be triaged with strong reasoning about edge cases, but the team has a strict per-ticket cost ceiling and wants to avoid over-provisioning intelligence. Which approach best fits the input-to-processing handoff for this architecture?
Correct answer: A — Start triage on Claude Haiku 4.5, benchmark it against real tickets, and only route to a stronger model when a capability gap appears
- A. Correct. This mirrors Anthropic's documented model-selection approach: start with a fast, cost-effective model, benchmark against real use-case data, and upgrade only when a concrete capability gap is found, which fits a cost-constrained triage stage.
- B. Incorrect. Routing everything through the most capable, highest-effort model ignores the stated cost ceiling and is not the recommended starting point for high-volume, straightforward triage.
- C. Incorrect. Random alternation is not a model-selection strategy Anthropic documents; it introduces unpredictable accuracy without any evaluation basis.
- D. Incorrect. Replacing Claude entirely with an external classifier abandons the reasoning capability the scenario requires for edge cases and isn't a supported architecture pattern for this trade-off.
Sources3
3.Tool execution: who runs the code, and when tools belong in the design
Tool use is a contract. You declare which operations exist and what their inputs look like, and Claude decides when to call them. The model never executes anything itself. It emits a structured request, something else runs the operation, and the result comes back into the conversation. Claude sees only the schema and the result, never your implementation. The main architectural question is therefore where the code runs, because that decides what your application must build.
| Approach | When to use it | Your responsibility |
|---|---|---|
| User-defined client tools | Custom business logic, internal APIs, proprietary data | Write the schema, execute the call, drive the agentic loop |
| Anthropic-schema client tools (memory, bash, text_editor, computer, browser) | Standard dev operations | Execute the call; the schema is trained-in, so Claude calls it reliably |
| Server-executed tools (web_search, web_fetch, code_execution, tool_search) | Web search, code sandbox, web fetch | Enable the tool and read results; Anthropic runs the loop |
Server tools run their own loop on Anthropic's infrastructure, and that loop has an iteration limit. If the model hits the limit while it is still working, the response comes back with stop_reason: "pause_turn" instead of "end_turn". The work is unfinished, so you re-send the conversation to let it continue. Control also returns to you early when Claude calls a server tool and a client tool in the same parallel group.
Tools belong in a design when the model cannot do the job from text alone. That covers actions with side effects, fresh or external data, outputs that must have a guaranteed structure, and calls into existing systems. They do not belong when every call adds a round trip whose cost outweighs a trivial task. One sign is reliable: if you are parsing free-form output to recover a decision, that decision should have been a tool call.
Checkpoint 4 of 6· Check yourself
A pipeline asks Claude to approve or reject an expense claim in prose. A regex then pulls 'APPROVED' or 'REJECTED' out of the reply. What is the architectural fix?
Parsing free text to recover structured intent shows that the structure belongs in a tool schema, which guarantees the shape of the output.
“if you're writing a regex to extract a decision from model output, that decision should have been a tool call.”Source: platform.claude.com
Sources2
4.Closing the loop: feedback and iterative refinement
An end-to-end design does not stop at the first output. A feedback loop sends an assessment of that output back to the model so it can improve the work. The basic pattern is evaluator-optimizer: one LLM call generates a response, and another evaluates it and gives feedback, in a loop. It fits when two things are true. First, there are clear evaluation criteria. Second, iterative refinement adds measurable value. In practice, a response must improve when someone articulates feedback, and an LLM must be able to give that feedback itself.
Claude Managed Agents builds this loop in as outcomes. You describe what 'done' looks like and supply a rubric, which is required. The harness then sets up a grader that scores the artifact against the rubric and returns its explanation to the agent for the next iteration. The grader runs in a separate context window, so the main agent's implementation choices do not influence it. Write each rubric criterion so it can be graded on its own. For example, 'The CSV contains a price column with numeric values' works, but 'The data looks good' does not.
client.beta.sessions.events.send(
session_id=session.id,
events=[
{
"type": "user.define_outcome",
"description": "Build a DCF model for Costco in .xlsx",
"rubric": {"type": "text", "content": RUBRIC},
# or: "rubric": {"type": "file", "file_id": rubric.id},
"max_iterations": 5, # optional; default 3, max 20
}
],
)| result | What happens next |
|---|---|
| satisfied | Session transitions to idle |
| needs_revision | Agent starts a new iteration cycle |
| max_iterations_reached | One final acknowledgment turn, then idle; no further evaluation |
| failed | Session transitions to idle; the rubric does not apply to the deliverables |
Checkpoint 5 of 6· Check yourself
Why does the Managed Agents outcome grader evaluate the artifact in its own context window?
The documentation says the separate window exists to avoid influence from the main agent's implementation choices. That keeps the feedback in the loop independent.
“The grader uses a separate context window to avoid being influenced by the main agent's implementation choices.”Source: platform.claude.com
Checkpoint 6 of 6· Exam question
An architect is building an agent that must read internal wiki pages, query a ticketing database, and post replies to a chat tool. The team wants to avoid writing and maintaining custom tool-execution code for each integration and wants the agent to autonomously decide when to call each system. Which architecture choice best satisfies this?
Correct answer: A — Connect the agent to MCP servers for the wiki, database, and chat tool so each system is exposed through one standardized protocol
- A. Correct. MCP is the standardized protocol for connecting an AI application to external data sources and tools such as wikis, databases, and chat apps, letting the agent discover and call them without bespoke integration code for each system.
- B. Incorrect. A manual Client SDK tool loop requires the team to implement and maintain the tool-execution logic themselves, which is exactly the maintenance burden they want to avoid.
- C. Incorrect. Embedding all wiki, database, and chat content in every prompt does not scale, quickly exceeds practical context limits, and cannot perform live actions like posting a reply.
- D. Incorrect. A static decision tree removes the model's autonomous judgment about when to call each system, contradicting the requirement that the agent decide dynamically.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.With server tools such as web_search, your application still has to build and send a tool_result block after each call.Why is that wrong?
Anthropic runs server tools and loops over them itself. You enable the tool and read the results. The exceptions are a pause_turn response and a turn that also calls a client tool.
Covered in Tool execution: who runs the code, and when tools belong in the design
2.A short, holistic rubric such as 'output is high quality' is enough for a grader-driven feedback loop.Why is that wrong?
The grader scores each criterion separately, so vague criteria produce noisy feedback. Write criteria that are explicit and can each be graded.
Covered in Closing the loop: feedback and iterative refinement
Sources
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
“we recommend finding the simplest solution possible, and only increasing complexity when needed”
↩︎ From business requirement to the simplest design that works“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”
↩︎ From business requirement to the simplest design that works“This workflow is particularly effective when we have clear evaluation criteria, and when iterative refinement provides measurable value.”
↩︎ Closing the loop: feedback and iterative refinement“Workflows are systems where LLMs and tools are orchestrated through predefined code paths.”
↩︎ Key concept“For many applications, however, optimizing single LLM calls with retrieval and in-context examples is usually enough.”
↩︎ Checkpoint - 2.
“Summarization, translation, and general-knowledge questions don't need a tool round trip.”
↩︎ From business requirement to the simplest design that works“The model never executes anything on its own.”
↩︎ Tool execution: who runs the code, and when tools belong in the design“If the model is still iterating when it hits the cap, the response comes back with stop_reason: "pause_turn" instead of "end_turn".”
↩︎ Tool execution: who runs the code, and when tools belong in the design“Every tool call is at least one extra round trip; for lightweight tasks the overhead can exceed the work.”
↩︎ Tool execution: who runs the code, and when tools belong in the design“You never construct a tool_result block for these tools.”
↩︎ Exam trap 1“Repeat from step 2 while stop_reason is "tool_use".”
↩︎ Checkpoint“if you're writing a regex to extract a decision from model output, that decision should have been a tool call.”
↩︎ Checkpoint - 3.https://code.claude.com/docs/en/agent-sdk/agent-loopOfficial docs
“Claude receives your prompt, along with the system prompt, tool definitions, and conversation history.”
↩︎ Input → processing → output: the agent loop“Each set of tool results feeds back to Claude for the next decision.”
↩︎ Input → processing → output: the agent loop“Contains the final text result, token usage, cost, and session ID.”
↩︎ Input → processing → output: the agent loop“Claude continues calling tools and processing results until it produces a response with no tool calls.”
↩︎ Prediction - 4.
“That feedback is handed back to the agent for the next iteration.”
↩︎ Closing the loop: feedback and iterative refinement“The grader scores each criterion independently, so vague criteria produce noisy evaluations.”
↩︎ Exam trap 2“The grader uses a separate context window to avoid being influenced by the main agent's implementation choices.”
↩︎ Checkpoint