CCDVF-D1.2 · Domain 1 · Agents & Workflows · 14.7% of CCD-F

Agent Design Patterns: Memory, Context Management & Third-Party Frameworks.

8 min read·8 sections·Tier A

An agent's execution mechanism is the tool-use loop: call a tool, read real environmental feedback ("ground truth"), repeat until the task converges - that loop, not any framework, is what makes a system an agent. Anthropic: building-effective-agents Production agents add three more layers on top: sub-agents for isolated exploration, and three named context-management techniques (compaction, structured note-taking, sub-agent condensation). Third-party frameworks like Strands, LangGraph, and PydanticAI abstract the plumbing around this loop - they are not Anthropic products and do not change the underlying mechanics.

Official Anthropic engineering postsCCD-F Domain 1 · Agents & WorkflowsCCD-F only
Agent Design Patterns: Memory, Context Management & Third-Party Frameworks, hero illustration featuring Loop mascot in a warm gallery scene.
Domain CCDVF-D1Agents & Workflows · 14.7%
On this page
01 · Summary

TLDR

An agent's execution mechanism is the tool-use loop: call a tool, read real environmental feedback ("ground truth"), repeat until the task converges - that loop, not any framework, is what makes a system an agent. Anthropic: building-effective-agents Production agents add three more layers on top: sub-agents for isolated exploration, and three named context-management techniques (compaction, structured note-taking, sub-agent condensation). Third-party frameworks like Strands, LangGraph, and PydanticAI abstract the plumbing around this loop - they are not Anthropic products and do not change the underlying mechanics.

3 (compaction / note-taking / sub-agent)
Context-management techniques
CCDVF-D1
Exam domain
3 (Strands / LangGraph / PydanticAI)
Named third-party frameworks
~1,000-2,000 tokens
Sub-agent summary size
0
Frameworks published by Anthropic
02 · Definition

What it is

Anthropic draws a hard structural line: a workflow orchestrates LLMs and tools through predefined code paths, while an agent is a system where the model dynamically directs its own process and tool usage. The mechanism that makes an agent an agent is the tool-use loop - the model calls a tool, receives environmental feedback ("ground truth" it did not generate itself), and repeats until the task converges. That loop is costlier and harder to bound than a fixed pipeline precisely because the number of iterations is not known in advance - see the workflow-vs-agent page for the full tier decision (augmented LLM vs. workflow vs. agent) and the five named workflow patterns; this page assumes that decision is already made and focuses on what production agent systems need on top of the raw loop.

Three things typically sit on top of a bare tool-use loop in a production system: sub-agents (isolated-context delegates that keep detailed exploration out of the coordinator's window), memory (persistence that survives outside the context window, since context is finite scratch space, not infinite storage), and explicit context-window management (because signal quality decays as a window fills, not just capacity). Third-party agentic abstraction frameworks - Strands, LangGraph, PydanticAI - wrap this same loop with state management, tool-schema typing, and control-flow helpers, without changing what the loop fundamentally does.

03 · Mechanics

How it works

Memory and context-window management break into three named techniques, per Anthropic's effective-context-engineering guidance. Compaction: summarize a conversation approaching its context limit and reinitiate a fresh window from that summary. "The art of compaction lies in the selection of what to keep versus what to discard, as overly aggressive compaction can result in the loss of subtle but critical context" - Claude Code's own implementation "preserves architectural decisions, unresolved bugs, and implementation details while discarding redundant tool outputs or messages," and the recommended iteration order is maximize recall first, then tighten precision. Best fit: long, continuous back-and-forth sessions. Structured note-taking / agentic memory: the agent regularly writes notes to storage outside the active context window and re-reads them as needed - Anthropic ships a public-beta memory tool on the Claude Developer Platform that does this via a file-based system, with no explicit memory-structure prompting required (Anthropic's Pokémon-playing agent maintains maps of explored regions, tracked achievements, and strategic notes entirely through this pattern). This enables "long-horizon strategies that would be impossible when keeping all the information in the LLM's context window alone." Best fit: milestone-driven, iterative work spanning many sessions. Sub-agent architectures: a coordinator delegates focused exploration to sub-agents with clean context windows; each sub-agent "might explore extensively, using tens of thousands of tokens or more, but returns only a condensed, distilled summary of its work (often 1,000-2,000 tokens)" - achieving "clear separation of concerns" since the detailed search context stays isolated inside the sub-agent and never pollutes the coordinator's window. Best fit: parallel research or investigation where multiple independent angles need deep exploration.

These three techniques are not mutually exclusive tiers - they compose. A long-running coding-assistant session routinely combines all three: sub-agents for isolated deep code search (each returning a condensed summary), structured note-taking to track a multi-step migration's progress across sessions, and compaction only as a fallback when the primary thread nears its window limit. Picking one is a per-workload decision, not a single architectural label for the whole system - the same discipline that governs picking a workflow pattern (start simple, escalate only when the simpler technique demonstrably fails).

Multi-agent orchestration is a platform primitive, not purely a DIY pattern. Claude's Managed Agents platform documents multi-agent sessions where one agent coordinates others acting in parallel with isolated context - the same coordinator/isolated-delegate shape as a hand-rolled sub-agent architecture, but running on Anthropic's hosted infrastructure rather than your own process. Which runtime hosts the coordination changes the mechanics of state and governance (see the Agent SDK vs. Managed Agents page) but not the underlying design pattern.

Third-party frameworks abstract the tool-use-loop plumbing; none of them are Anthropic products, and their attributions matter for the exam. Strands Agents is an open-source SDK originally released by AWS - model-driven and multi-vendor, supporting Bedrock, Anthropic, and OpenAI models. LangGraph is published by LangChain - a low-level orchestration framework/runtime that models agent workflows as graphs, adding durable execution, streaming, and human-in-the-loop control on top of that graph structure. PydanticAI is published by the Pydantic team - a Python-first, type-safe agent framework built directly on Pydantic's schema/validation model, aimed at teams who want strong, structured RUNTIME validation of tool inputs/outputs (Python's dynamic typing means Pydantic checks and coerces data as the program executes, not at a compile step - the type hints give you editor/IDE-level static-analysis benefit, but the actual guarantee on a live tool call is enforced at runtime). All three sit *on top of* model APIs including Claude's; "agentic abstraction framework" means they abstract the loop's plumbing (state, tool schemas, control flow, typing), not that they redefine or replace the loop itself - swapping frameworks does not change whether a system is a workflow or an agent underneath.

Framework selection is a fit-for-purpose question, the same instinct as tool-surface selection. Reach for a graph-structured orchestration layer with built-in durable execution and human-in-the-loop checkpoints when the workflow genuinely needs that structure (LangGraph). Reach for a multi-vendor, model-driven SDK when the deployment must support several model providers behind one interface (Strands). Reach for strict Python typing and validation on tool schemas when correctness-by-construction matters more than orchestration features (PydanticAI). None of these choices is required to build an agent at all - the raw Agent SDK or Client SDK plus a hand-rolled loop remains a fully valid, framework-free path, and is often the simpler one for a single-vendor, Claude-only deployment.

Agent Design Patterns: Memory, Context Management & Third-Party Frameworks mechanics, painterly diagram featuring Loop mascot.
04 · In production

Where you'll see it

Long-running coding-assistant session

Combines sub-agents for isolated deep code search (each returning a condensed summary), structured note-taking to track a multi-step migration's progress, and compaction only as a fallback when the primary thread nears its window limit.

Multi-vendor enterprise agent platform

A team standardizes on Strands Agents specifically because their deployment must run the same agent logic against Bedrock, Anthropic, and OpenAI models behind one interface, rather than hand-rolling per-vendor adapters.

05 · Compare

Side-by-side

FrameworkPublished byCore modelMulti-vendor?Reach for it when
Strands AgentsAWS (open-source)Model-driven agent SDKYes - Bedrock, Anthropic, OpenAIThe deployment must support several model providers behind one interface
LangGraphLangChainGraph-based orchestration runtimeModel-agnostic by designThe workflow needs durable execution, streaming, and human-in-the-loop as graph structure, not just a loop
PydanticAIPydantic teamPython-first, type-safe agent frameworkModel-agnostic by designTool input/output correctness-by-construction matters more than orchestration features
06 · When to use

Decision tree

01

Is the session long and continuous, with no clean stopping point, approaching its context limit?

YesCompaction - summarize and reinitiate from the summary, preserving architectural decisions and unresolved threads while discarding redundant tool output.
NoCheck the other techniques below; they are not mutually exclusive.
02

Is the work milestone-driven and iterative across many sessions (state needs to outlive any single context window)?

YesStructured note-taking / agentic memory - write to external storage (e.g. the file-based memory tool) and re-read as needed.
NoMemory persistence may not be the bottleneck here.
03

Does the task need several independent angles explored in depth, without polluting the coordinator's window with raw traces?

YesSub-agent architecture - each sub-agent explores extensively but returns only a condensed ~1,000-2,000 token summary.
NoA single agent thread may be sufficient without sub-agent isolation.
04

Does the deployment need multi-model-provider support behind one interface?

YesConsider Strands Agents (AWS, multi-vendor: Bedrock/Anthropic/OpenAI).
NoA Claude-only deployment doesn't need Strands' multi-vendor abstraction specifically.
05

Does the orchestration genuinely need graph-structured control flow with durable execution and human-in-the-loop checkpoints?

YesConsider LangGraph (LangChain) - but confirm the raw Agent SDK loop can't satisfy this more simply first.
NoA hand-rolled Agent SDK loop, or PydanticAI for type-safety alone, likely covers it without graph-orchestration overhead.
07 · On the exam

Question patterns

Agent Design Patterns: Memory, Context Management & Third-Party Frameworks exam trap, painterly cautionary scene featuring Loop mascot.
A research agent's coordinator delegates three independent investigation angles to sub-agents, each of which explores tens of thousands of tokens of source material before responding. The coordinator's context window stays lean throughout. What made this possible?
Sub-agent architecture: each sub-agent explores extensively in its own isolated context but returns only a condensed, distilled summary (often 1,000-2,000 tokens) to the coordinator, so the detailed search context never enters the coordinator's window. The named distractor "the coordinator uses compaction after each sub-agent returns" is wrong - compaction summarizes an existing conversation nearing its limit; it doesn't explain why the coordinator's window stayed lean from the start, isolation does.
A coding-assistant agent runs for days across many sessions, tracking a multi-step migration's progress (files changed, remaining steps, known blockers) that must survive well past any single context window's lifetime. Which technique fits best?
Structured note-taking / agentic memory - writing durable notes (e.g. via the file-based memory tool) outside the active context window and re-reading them as needed enables exactly this long-horizon, milestone-driven persistence. The named distractor "compaction at the start of every new session" is wrong - compaction summarizes a conversation nearing its limit within roughly one continuous thread; it isn't designed to persist state across many separate sessions the way external notes are.
An engineer summarizes a long, continuous back-and-forth conversation nearing its token limit and restarts from that summary, deliberately keeping architectural decisions and unresolved bugs while dropping redundant tool output. What technique is this, and what's the stated risk if done carelessly?
Compaction. The stated risk is that overly aggressive compaction can discard subtle but critical context - the guidance is to start by maximizing recall (keep more than you think you need), then iterate toward precision. The named distractor "structured note-taking, since the summary is written down" misidentifies the technique - structured note-taking writes standing notes outside the window proactively during the session, it doesn't restart the window from a compressed summary of it.
A team needs one agent architecture that can run against Bedrock, Anthropic, and OpenAI models interchangeably behind a single interface, without hand-writing per-vendor adapters. Which named framework fits, and who publishes it?
Strands Agents, an open-source SDK originally released by AWS, explicitly designed as model-driven and multi-vendor. The named distractor "LangGraph, since it is the most popular agent orchestration framework" is wrong on the specific requirement - LangGraph (published by LangChain) is model-agnostic by design but its differentiator is graph-structured durable execution and human-in-the-loop, not multi-vendor model routing as its named selling point.
A developer assumes that adopting LangGraph fundamentally changes what counts as an "agent" versus a "workflow" in their system, since the framework itself is agent-branded. Is this correct?
No. LangGraph, like Strands and PydanticAI, is an agentic abstraction framework - it wraps the tool-use-loop plumbing (state, tool schemas, control flow, typing) without redefining the loop itself. Whether a given component is a workflow (predefined code path) or an agent (the model dynamically directs its own process) is a property of who controls the decomposition at run time, not of which third-party framework implements it. The named distractor "using an agent framework automatically makes the system agentic" is exactly the trap - framework adoption and architectural tier are independent decisions.
08 · FAQ

Frequently asked

Are compaction, structured note-taking, and sub-agent architectures alternatives to choose one from?
No. They are composable techniques suited to different needs (long continuous threads, milestone-driven cross-session work, and parallel deep exploration respectively) and a single production agent often uses more than one at once.
Are Strands, LangGraph, and PydanticAI Anthropic products?
No. Strands is AWS's open-source SDK, LangGraph is published by LangChain, and PydanticAI is published by the Pydantic team. All three are third-party abstraction layers sitting on top of model APIs including Claude's, not Claude-native constructs.
09 · Practice with AI

Work this with your AI

Work this concept hands-on with Claude Code, Codex, or claude.ai. Copy a prompt, paste it into your assistant, and practise in tandem. Each one keeps you active (explain it back, get drilled, or build) rather than just reading.

  • Drill it like the exam (scenario MCQs)
    Practice in the exam's scenario-MCQ format with trap awareness.
  • Explain it back (Feynman)
    Build durable, transferable understanding of a concept you can half-state.
  • Test me, adapting the difficulty
    Active recall practice on a concept you think you know.
  • Check my prerequisites first
    Before studying a concept that keeps not sticking.
  • Find the high-leverage 20%
    When a domain feels too big and you are short on time.
Self-check

Test yourself

Three diagnostic questions on this primitive. Reveal each answer when you have a guess. Want a full 60-question mock? Open the mock hub →

Q1A research agent's coordinator delegates three independent investigation angles to sub-agents, each of which explores tens of thousands of tokens of source material before responding. The coordinator's context window stays lean throughout. What made this possible?
Sub-agent architecture: each sub-agent explores extensively in its own isolated context but returns only a condensed, distilled summary (often 1,000-2,000 tokens) to the coordinator, so the detailed search context never enters the coordinator's window. The named distractor "the coordinator uses compaction after each sub-agent returns" is wrong - compaction summarizes an existing conversation nearing its limit; it doesn't explain why the coordinator's window stayed lean from the start, isolation does.
Q2A coding-assistant agent runs for days across many sessions, tracking a multi-step migration's progress (files changed, remaining steps, known blockers) that must survive well past any single context window's lifetime. Which technique fits best?
Structured note-taking / agentic memory - writing durable notes (e.g. via the file-based memory tool) outside the active context window and re-reading them as needed enables exactly this long-horizon, milestone-driven persistence. The named distractor "compaction at the start of every new session" is wrong - compaction summarizes a conversation nearing its limit within roughly one continuous thread; it isn't designed to persist state across many separate sessions the way external notes are.
Q3An engineer summarizes a long, continuous back-and-forth conversation nearing its token limit and restarts from that summary, deliberately keeping architectural decisions and unresolved bugs while dropping redundant tool output. What technique is this, and what's the stated risk if done carelessly?
Compaction. The stated risk is that overly aggressive compaction can discard subtle but critical context - the guidance is to start by maximizing recall (keep more than you think you need), then iterate toward precision. The named distractor "structured note-taking, since the summary is written down" misidentifies the technique - structured note-taking writes standing notes outside the window proactively during the session, it doesn't restart the window from a compressed summary of it.
Last reviewed: 2026-05-04·Refresh cadence: monthly
CCDVF-D1.2 · CCDVF-D1 · Agents & Workflows

Agent Design Patterns: Memory, Context Management & Third-Party Frameworks, complete.

You've covered the full ten-section breakdown for this primitive, definition, mechanics, code, false positives, comparison, decision tree, exam patterns, and FAQ. One technical primitive down on the path to CCA-F.

More platforms →