Agent Patterns and Frameworks: CCDV-F study guide
CCDV-F · Agents and Workflows, topic weight 4.9% of the exam
Agent Patterns and Frameworks sits in Domain 1, Agents and Workflows (14.7% of the CCDV-F exam), with a topic weight of 4.9%. It tests whether you know the four building blocks every Claude agent is made of (the tool-use loop, subagents, memory and context-window management) and whether a third-party agent framework helps or gets in the way.
What the official guide covers
The Claude Certified Developer Foundations exam guide (version 1.0, effective July 2026) describes this topic as common agent design patterns and agentic abstraction frameworks for multi-step tasks:
| What the guide lists | What it means in practice |
|---|---|
| Tool-use loops | Claude calls tools, your code or the SDK runs them, results go back, and the loop repeats until Claude finishes |
| Sub-agents | Separate agent instances with their own context, used to isolate, parallelise or specialise work |
| Memory | Information kept outside the context window so it survives across sessions or across compaction |
| Context-window management | Keeping the window useful as it fills: clearing old tool results, compacting history, counting tokens |
| Agentic abstraction frameworks (for example Strands, LangGraph, PydanticAI) | Libraries that wrap model calls, tools and control flow; know what they add and what they hide |
Pattern 1: the tool-use loop
Every agent is a loop: Claude returns tool_use blocks, the tools run, tool_result blocks go back, and the loop continues until stop_reason is end_turn. With the Messages API you write the loop, or the client SDK's beta tool runner drives it. The Claude Agent SDK has it built in, running read-only tools in parallel and state-changing tools (Edit, Write, Bash) one at a time. Mechanics are in CCAR-F 1.1.
Two habits make the loop work. It ends on a success check, a step limit or an error, not only when Claude decides it is done. And the agent builds its picture of the world through tools rather than a long prompt: it reads before it writes and checks the result after it acts, so every agent needs a tool that shows what its last action changed.
Pattern 2: subagents
A subagent is a separate agent instance with a fresh context window. In the Agent SDK it receives its own system prompt, project CLAUDE.md, its tools and the prompt the parent writes, never the parent's conversation, and only its final message returns. The SDK docs list four benefits: context isolation, parallel work, specialised instructions and tool restrictions. The cost: each hand-off loses whatever the parent forgot to write down. See CCAR-F 1.3 for how context is passed.
Pattern 3: memory
Memory is anything the agent can read back later that is not in the current context window. Three forms matter:
| Memory form | Where it lives | Who writes it |
|---|---|---|
| Memory tool (Messages API) | A /memories directory that your handler maps to real storage | Claude, through view, create, str_replace, insert, delete and rename commands |
| CLAUDE.md files | Project and user files loaded at session start | You |
| Auto memory (Claude Code and the Agent SDK) | ~/.claude/projects/<project>/memory/, with a MEMORY.md index | Claude |
The memory tool is client-side: Claude asks for file operations and your application performs them, so you choose the storage and must validate paths to block directory traversal. The Python SDK includes a ready-made local filesystem handler:
import os
import anthropic
from anthropic.tools import BetaLocalFilesystemMemoryTool
client = anthropic.Anthropic()
memory = BetaLocalFilesystemMemoryTool(base_path="./memory") # /memories maps to this folder
runner = client.beta.messages.tool_runner(
model=os.environ["CLAUDE_MODEL"], # a pinned model ID from your config
max_tokens=1024,
messages=[{"role": "user", "content": "Remember that the customer Acme prefers email follow-ups."}],
tools=[memory],
)
final_message = runner.until_done() # the runner executes memory commands until Claude finishes
print(final_message.content)
Choose the memory scope at design time
Before picking a mechanism, decide what the agent must know when the next session starts. The shape of the sessions decides it, not what is quickest to write:
| Scope | What survives | Fits | What you give up |
|---|---|---|---|
| In-context only | The current conversation, until it ends | One short session that fits the window and is never resumed | Everything at session end; cost grows with every turn |
| External store | Records your code writes and reads back at session start or on demand | A thread that continues over days, or state shared between users or agent instances | A read on each session and the code to manage it |
| Summarised | A condensed digest injected into the next session | Long conversations that would outgrow the window | Any detail the summary leaves out, so avoid it while a session still needs exact code or values |
| Stateless | Nothing | Jobs that take an input, finish and close | Any follow-up that needs earlier work |
The common trap is in-context memory chosen because a prototype ran as one long session. Production often runs many shorter sessions with replayed history, and the injected history alone can fill much of the window before the first tool call. Moving to an external store then happens under deadline pressure instead of at design time.
Pattern 4: context-window management
The context window holds the system prompt, tools, history and every tool input and output, and it does not reset between turns. The Claude API gives you several controls:
- Context editing, tool result clearing. Clears older tool results once the context passes a trigger, keeping the most recent ones. It is a beta feature set in the
context_managementparameter. - Server-side compaction (beta). Summarises earlier parts of the conversation on the server so it can continue past the window limit.
- Token counting. Estimate a request's size before you send it.
response = client.beta.messages.create(
model=os.environ["CLAUDE_MODEL"],
max_tokens=4096,
messages=messages,
tools=tools,
betas=["context-management-2025-06-27"],
context_management={"edits": [{
"type": "clear_tool_uses_20250919",
"keep": {"type": "tool_uses", "value": 3}, # keep the three most recent tool results
"exclude_tools": ["memory"], # never clear memory reads
}]},
)
If you compact by hand instead, your summariser prompt decides what the agent knows afterwards. "Summarise the conversation" tends to drop the state that matters; name it: files changed, decisions taken at each branch point, errors hit and how each was resolved, and open tasks.
A filling window rarely announces itself. The usual symptom is an agent that chooses tools well for several turns and then starts picking the wrong one or returning partial work, because old tool results have pushed the instructions out of focus. Before rewriting tool descriptions, check token use per turn. Development fixtures are usually much shorter than production tool outputs, so measure with the largest real inputs you can find, using token counting, before you ship.
Clearing and compaction remove detail, so pair them with memory for what must survive. The Agent SDK compacts automatically and emits a compact_boundary message; rules that must persist belong in CLAUDE.md, which is re-injected on every request. More on the Context Engineering page.
Frameworks: Strands, LangGraph and PydanticAI
The exam guide names three third-party frameworks as examples. Each one wraps model calls, tool definitions and control flow in its own abstractions:
| Framework | What its own documentation says it is |
|---|---|
| Strands Agents | An open-source SDK published by AWS, for Python and TypeScript, built around a model-driven approach; Claude is one of its supported model providers |
| LangGraph | A low-level orchestration framework and runtime for long-running, stateful agents, modelling a workflow as a graph of nodes and edges with shared state; it uses Claude through LangChain's Anthropic integration |
| Pydantic AI | A Python agent framework from the Pydantic team with typed tools and validated structured output; Anthropic is one of its supported providers |
Anthropic's guidance is the part most likely to be tested. Building effective agents names the Claude Agent SDK and the Strands Agents SDK among frameworks that simplify routine work such as calling the model, parsing tools and chaining calls. It recommends starting with the API directly, since many patterns take a few lines, and warns that extra abstraction can hide the real prompts and responses and make debugging harder. If you use a framework, understand the code underneath.
| Situation | Choose | Why |
|---|---|---|
| Two or three tools, a simple loop | Messages API directly | A few lines of code; nothing hidden |
| Agent needs files, shell, subagents and compaction | Claude Agent SDK | Those patterns come built in |
| Team already standardised on a framework and its tooling | That framework, with request logging turned on | Reuse what the team knows, but keep the real prompts visible |
| Long session filling with old tool results | Context editing plus the memory tool | Clear stale detail, keep durable facts |
| Facts must carry over to tomorrow's session | Memory tool or CLAUDE.md | The context window does not persist between sessions |
| Verbose sub-task pollutes the main context | Subagent | Only its summary returns to the parent |
Rules that decide exam answers
- Memory is not context, and the memory tool runs on your side. The window ends with the session; memory is what you store outside it. Claude asks for file operations, and your code executes them and checks paths.
- Clearing and compaction lose detail. Pair them with memory for anything that must survive, and name that state in any summariser prompt you write.
- Degrading tool choice after a fixed number of turns points at the window first. Check token use before you touch the schema.
- Subagents isolate context by design. If a subagent needs something, it must be in the prompt the parent writes.
- Start simple, then add a framework. Anthropic recommends direct API calls first; a framework is justified by what it saves, not by default.
- Debug through the abstraction. When a framework-built agent misbehaves, inspect the actual requests and tool results it sends.
Where it appears in the exam
Agent Patterns and Frameworks is part of Domain 1, Agents and Workflows (14.7% of the exam), with a 4.9% topic weight, roughly two or three items on a 53-item exam. Expect scenarios about agents that degrade as sessions grow, forget facts between sessions, or get poor work from subagents, and teams choosing between direct SDK code and a framework.
Two sample questions
These are original Timo practice questions. They are not official exam questions.
Build exercise
- Run the memory tool example above twice in separate processes and confirm the second run reads the stored fact.
- Build a loop that calls a search tool 30 times. Add the
context_managementedit and log input tokens per request before and after. - Move one verbose step (summarising ten files) into an Agent SDK subagent and compare the parent's context use with and without it.
- Rebuild the same two-tool agent in one framework from the guide's list. Turn on its request logging and find the exact tool definitions it sends to Claude.
Practise this topic
- Claude Certified Developer practice exam: free, 20 questions, no sign-up
- CCDV-F study guide: all topics
- Same topic in another exam: 1.6 Task decomposition
- Previous topic: Agent Construction with Claude
- Next topic: Understanding Requirements
Sources
- Claude Certified Developer Foundations Exam Guide, version 1.0, effective July 2026 (Anthropic), Domain 1 topic: Agent Patterns and Frameworks
- Anthropic: Building effective agents
- Claude Platform documentation: Memory tool
- Claude Platform documentation: Context editing
- Claude Agent SDK documentation: How the agent loop works
By Amotion AI