Study Handbook
Domain-by-domain study guide — key concepts explained simply, anti-patterns to avoid, and exam tips.
Agentic Architecture & Orchestration
📘Key Concepts
1Agentic Loop
The core pattern behind every AI agent. The agent receives a task, thinks about it, decides if it needs a tool, calls the tool, gets the result, thinks again, and repeats. This loop continues until the agent has enough information to give a final answer.
Claude returns a stop_reason with every response. When it's "tool_use," your code executes the requested tool and sends the result back. When it's "end_turn," the task is complete. When it's "max_tokens," the response was cut off and you might need to continue. Your agentic loop code checks this stop_reason to decide what to do next.
Customer says "I want a refund for order #123." The agent: (1) calls get_order(#123) → gets order details, (2) calls check_refund_policy(order) → eligible, (3) calls process_refund(order) → done, (4) tells the customer "Your refund has been processed." Each step is one iteration of the agentic loop.
2Tool Use & stop_reason
Tools are functions that Claude can call to interact with the outside world — databases, APIs, file systems. When Claude needs a tool, it returns a structured JSON request describing which tool to call and with what parameters. Your code executes it and sends the result back.
Define tools with a name, description, and JSON schema for parameters. Claude reads the descriptions to decide WHEN to use each tool. The response includes stop_reason: "tool_use" with the tool name and parameters. After execution, send the result as a "tool_result" message. Claude then continues reasoning.
Like a chef asking a sous-chef: "Hand me the salt" (tool_use). The sous-chef hands the salt (tool_result). The chef continues cooking. When the dish is done, the chef says "Done" (end_turn). The chef never directly accesses the pantry — they always go through the sous-chef.
3Guardrails: Pre & Post Execution
Safety checks that run before or after a tool executes. Pre-execution guardrails validate if an action is allowed BEFORE it happens. Post-execution guardrails check the output AFTER the tool runs but before returning it to the user.
Pre-guardrail example: Before process_refund() runs, check if amount < $100 (auto-approve) or amount >= $100 (require manager approval). Post-guardrail example: After generate_response() runs, check the output for PII (personal data) and redact it before sending to the user. These are code-level checks, not prompt instructions.
A bank ATM: pre-check validates your PIN and checks if withdrawal amount is within your daily limit. Post-check verifies the balance didn't go negative after dispensing. Both happen automatically without the user being involved.
4Escalation vs. Autonomy
Agents must know their limits. Some tasks should be handled autonomously (routine, low-risk). Others must be escalated to a human (complex, high-risk, ambiguous). The critical principle: escalation decisions should be based on programmatic rules, not the model's judgment.
Define clear, coded rules: if intent === "cancel_account" → escalate. If refund_amount > 500 → escalate. If customer_sentiment === "angry" AND issue_type === "legal" → escalate. Don't prompt the model with "escalate if you think it's appropriate" — this gives inconsistent results.
An AI phone agent handles "change my address" autonomously but escalates "I want to cancel and sue you" to a human. The escalation isn't the AI's judgment call — it's a coded rule based on intent classification and keywords.
5Multi-Agent Orchestration
For complex tasks, split the work across multiple specialized agents. A coordinator agent manages the overall task and delegates to subagents, each with narrow tools and focused expertise. This beats one giant agent because: failures are isolated, context stays clean, and each agent does one thing well.
The coordinator receives the user's request, breaks it into subtasks, and sends each subtask to the right subagent. Each subagent has its own system prompt, tools, and context — it doesn't see the full conversation. The coordinator collects results and synthesizes the final response.
Research system: Coordinator gets "Research AI in healthcare." It delegates to a Search Agent (web tools), an Analysis Agent (document tools), and a Writing Agent (formatting tools). Each works independently with isolated context. The coordinator merges their outputs into a final report.
6Subagent Context Isolation
Each subagent should only see what it needs for its specific task. Don't pass the entire conversation history — pass a focused task prompt with just the relevant information. This prevents context pollution, reduces errors, and keeps each agent focused.
Instead of forwarding all messages to a subagent, create a new, clean prompt: "Search for recent papers about AI in healthcare published after 2023. Return titles, authors, and abstracts." The subagent never sees the user's full conversation or other subagents' results.
When your boss asks the legal team to review a contract, they send just the contract and specific questions — not the entire company's email history. Sending everything would be confusing and lead to worse results.
🚫Anti-Patterns to Avoid
❌ Monolithic Agent (Mega-Agent)
Why it's bad: One agent with 50+ tools gets confused. The model wastes tokens evaluating irrelevant tools, makes more selection errors, and context gets diluted across too many responsibilities.
❌ Uncontrolled Autonomy
Why it's bad: Letting the model decide when to escalate based on its own judgment ("escalate if you think it's needed") leads to inconsistent behavior — sometimes escalating trivial issues, sometimes handling dangerous ones alone.
❌ Ignoring stop_reason
Why it's bad: If you don't check whether Claude returned "tool_use" vs "end_turn," your agent either misses tool calls (breaking the workflow) or keeps looping forever (wasting tokens and time).
💡Exam Tips
- 127% of the exam — expect the most questions here. Study this domain deeply.
- 2Know the difference between pre-execution and post-execution guardrails — this is tested frequently.
- 3The exam tests whether you'd choose programmatic rules vs. model judgment for safety-critical decisions. Always choose programmatic.
- 4Multi-agent questions focus on WHY to split (isolation, scoping, failure containment) not just HOW to split.
- 5Always prefer narrow, well-scoped tools (5-10 per agent) over broad, flexible tools (50+ in one agent).
- 6stop_reason handling is fundamental. If you see a question about "agent keeps looping" or "tool calls not executing," think stop_reason.