Domain 1 · Agentic Architecture & Orchestration
This is the biggest block of marks. It covers how an agent loop runs, how a coordinator manages subagents, which rules belong in code instead of prompts, and how sessions are resumed or forked.
Key terms: Agent: Claude working in a loop with tools. Tool: an action Claude can ask your code to run. Coordinator and subagent: a manager agent and the specialists it delegates to. Hook: your code that runs before or after a tool call. Session: one saved conversation.
1.1 Design and implement agentic loops
What it is: An agent is Claude working in a loop. You send a request plus a list of tools, and Claude replies either with an answer (end_turn) or with a request to use a tool (tool_use). Claude only asks: when you build an agent, the program you write (or the SDK, or Claude Code for you) runs the tool, adds the result to the conversation and calls Claude again, until Claude says end_turn.
The exam tests: how stop_reason controls the loop, how tool results flow back to Claude, and which wrong ways of ending a loop to avoid. Video: Ep 01.
The basics behind every agent
| Role | Who it is |
|---|---|
| System role | System-level settings |
| User role | The end user. Tool results also go back to Claude in a user message |
| Assistant role | Claude |
| How it works | |
|---|---|
| Chat | You send a message, Claude responds, done |
| Agent | You send a message, Claude reasons and acts with tools, reads the results, and reasons again until it is finished |
| Tool definition field | What it holds |
|---|---|
name | What Claude calls the tool by |
description | When to use the tool |
input_schema | A JSON schema describing the tool's parameters |
| Step | What the messages array holds |
|---|---|
| 1 | The user message |
| 2 | Adds the assistant message with tool_use |
| 3 | Adds the user message with the tool_result |
| 4 | Adds the assistant message with end_turn |
Every call re-sends the whole array, because the API is stateless.
The loop repeats until stop_reason is end_turn
Full notes
Rule: Continue the loop while stop_reason is tool_use. Terminate it when it is end_turn.
Rule: The Claude API is stateless. Every call must carry the complete conversation history, including earlier tool results.
Rule: A tool_use reply is never the final answer and never goes to the user. Run the tool, add the result to the conversation, and call Claude again.
Rule: Claude decides which tool to call next from context. Hardcoded decision trees or fixed tool sequences push the intelligence into your code instead.
Deep dive
- Ep 01 at 26:44: why the messages array matters.
- Ep 01 at 36:52: the loop code: on
tool_use, append the assistant message, run the tools, and send the results back. - Ep 01 at 38:02: the tool result goes back with the user role.
- Ep 01 at 45:04: the three anti-patterns: parsing the model's wording, using an iteration cap as the main stop, and checking content type.
- Ep 01 at 48:20: the lesson's cheat sheet.
1.2 Orchestrate multi-agent systems with coordinator-subagent patterns
What it is: Instead of one agent doing everything, a coordinator agent splits a big job into pieces and hands each piece to a specialist subagent. The subagents report back to the coordinator, never to each other, and the coordinator combines their results into one answer.
The exam tests: hub-and-spoke design, isolated subagent context, the coordinator's duties, and the risk of splitting a topic too narrowly. Video: Ep 02.
All traffic flows through the coordinator
Subagents never talk to each other directly: there is no subagent-to-subagent link.
Full notes
Rule: Hub-and-spoke: all communication runs through the coordinator, so you get observability, consistent error handling and controlled information flow. Subagents never talk to each other directly.
Rule: Subagents work with isolated context. They do not inherit the coordinator's conversation history.
Rule: The coordinator has four jobs: error handling, task decomposition, delegation and result aggregation. It picks which subagents to call based on query complexity instead of always running the full pipeline.
Rule: Split the research scope so subagents do not duplicate work, for example by subtopic or by source type. After synthesis, the coordinator checks for gaps, sends targeted follow-up queries, and re-runs synthesis until coverage is enough.
Deep dive
- Ep 02 at 03:55: the hub-and-spoke topology.
- Ep 02 at 22:31: context isolation: subagents always start with a blank context.
- Ep 02 at 30:33: observability and error handling, framed as an exam diagnostic.
- Ep 02 at 31:21: overly narrow decomposition.
1.3 Configure subagent invocation, context passing and spawning
What it is: A coordinator starts a subagent by calling a special tool, the Task tool, and describing the subagent in an AgentDefinition (its role, prompt and allowed tools). A new subagent knows nothing: it cannot see the coordinator's conversation, so everything it needs must be written into its prompt. Independent subagents can run at the same time.
The exam tests: how the Task tool spawns subagents, what must go into a subagent's prompt, and how to run subagents in parallel. Videos: Ep 03 and Ep 04.
Full notes
Rule: The coordinator spawns subagents through the Task tool, so its allowedTools must include "Task".
Rule: Subagents start with a blank slate and share no memory between calls. Put the complete findings from earlier agents directly in the subagent's prompt.
Rule: An AgentDefinition describes each subagent type: its description, system prompt and tool restrictions. In the course's payload view the fields are description, prompt, allowed tools and model.
Rule: Pass structured data that keeps content apart from metadata (source URLs, document names, page numbers), so attribution survives the hand-off.
Rule: For parallel subagents, emit several Task calls in one coordinator response. Total time is then the slowest subagent, not the sum of all of them.
Rule: Give subagents goals and quality criteria instead of step-by-step procedures, so they can adapt.
Deep dive
- Ep 03 at 03:54: the Task tool.
- Ep 03 at 09:58: what to pass to the subagent.
- Ep 03 at 10:33: preserving attribution between agents.
- Ep 04: a 12-minute hands-on build in Python with the SDK.
1.4 Implement multi-step workflows with enforcement and handoff patterns
What it is: Some steps must happen in a fixed order, such as verifying a customer before issuing a refund. A prompt asking for that order works most of the time, but code that blocks the next step until the earlier one has succeeded works every time. When a case must go to a person, the agent also hands over a clear summary, because the human cannot see the conversation.
The exam tests: when code must enforce the order of steps instead of a prompt, and how to hand a case to a human. Video: Ep 05.
Full notes
Rule: If a rule must always hold, enforce it in code with hooks or prerequisite gates. Prompt instructions alone have a non-zero failure rate.
Rule: A prerequisite gate blocks a downstream tool until the upstream tool has finished and set a verified flag. For example, process_refund cannot run until get_customer has returned a verified customer ID.
Rule: Split a multi-concern request into distinct items, investigate each one (in parallel, with shared context), then combine the results into one resolution.
Rule: When escalating, compile a structured handoff summary (customer ID, root cause, refund amount, recommended action). The human agent cannot see the transcript.
Deep dive
- Ep 05 at 04:36: why some rules need a 100% guarantee.
- Ep 05 at 22:59: the verified flag that opens the gate.
- Ep 05 at 32:09: structured handoff summaries.
1.5 Apply Agent SDK hooks for tool call interception and data normalization
What it is: A hook is a small piece of your code that Claude cannot skip or override. It runs just before a tool is called, to check or block the call, or just after, to clean up the result before Claude reads it. Hooks are how you guarantee a rule instead of hoping the prompt is followed.
The exam tests: what hooks do before and after a tool call, and why they beat prompts for guaranteed compliance. Video: Ep 05.
Hooks sit on both sides of every tool call
Hooks are code interceptors: the model cannot override them.
Full notes
Rule: A PostToolUse hook runs after the tool and before the model sees the result. Use it to normalize formats such as Unix timestamps, ISO 8601 dates and numeric status codes.
Rule: A hook on outgoing tool calls (the PreToolUse side) can block a policy-breaking action, such as a refund above $500, and redirect it to a human escalation workflow.
Rule: Hooks give deterministic guarantees. Prompts give probabilistic compliance. When a business rule must always hold, pick the hook.
Deep dive
- Ep 05 at 08:23: the two hook points, PreToolUse and PostToolUse.
- Ep 05 at 10:11: the PostToolUse hook and data normalization.
- Ep 05 at 17:10: a PreToolUse hook that blocks a policy-breaking call.
- Ep 05 at 43:52: the episode's summary, including why prompts keep a non-zero failure rate.
1.6 Design task decomposition strategies for complex workflows
What it is: Decomposition means breaking a big task into smaller steps. If you already know the steps (review every file, then check how the files fit together), you fix them in advance as a chain of prompts. If you do not (finding the cause of a bug), Claude plans as it goes and adds steps based on what it discovers.
The exam tests: choosing between a fixed pipeline and an adaptive plan. Video: Ep 05.
| Prompt chaining | Dynamic decomposition | |
|---|---|---|
| Steps | Defined up front | Emerge from findings |
| Control | High, deterministic | Lower, the model navigates |
| Best for | Code reviews, audits, batch reports | Bug investigation, codebase exploration |
| Example | CI/CD review pipeline | Monolith to microservices migration |
Full notes
Rule: Use prompt chaining for predictable, multi-aspect work. Use dynamic decomposition for open-ended investigation: map the structure, find the high-impact areas, then build a prioritized plan that adapts as dependencies appear.
Rule: Split large reviews into per-file passes for local issues, plus a separate cross-file pass for integration issues. This avoids attention dilution.
Deep dive
- Ep 05 at 37:03: task decomposition.
- Ep 05 at 37:31: prompt chaining.
- Ep 05 at 39:07: per-file and cross-file review.
- Ep 05 at 39:52: dynamic decomposition.
1.7 Manage session state, resumption and forking
What it is: A session is one running conversation with Claude. You can return to a saved session by name (resume), copy it into a separate branch to try a different idea (fork), or start a new one with a short summary when the old one has gone out of date.
The exam tests: when to resume, fork or start fresh. Video: Ep 03.
Resume, fork or start fresh
Full notes
Rule: --resume <session-name> continues a named session, and plain --resume continues the last one.
Rule: fork_session makes an independent branch from a shared baseline, so you can compare two approaches without exploring twice.
Rule: When you resume after code changes, tell the agent which files changed so it re-analyzes only those.
Rule: If earlier tool results are stale, start a new session with an injected structured summary. Frame it as hypotheses to check, not as established facts.
Deep dive
- Ep 03 at 19:30: named session resumption.
- Ep 03 at 23:07: fork session.
- Ep 03 at 26:20: when to start fresh.