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

> 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. 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.

**Domain:** CCDVF-D1 · Agents & Workflows (14.7% of the exam)
**Canonical:** https://claudearchitectcertification.com/concepts/agent-frameworks-and-design-patterns
**Last reviewed:** 2026-05-04

## Quick stats

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

## 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.

## 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.

## Where you'll see it in production

### 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.

## Comparison

| Framework | Published by | Core model | Multi-vendor? | Reach for it when |
| --- | --- | --- | --- | --- |
| Strands Agents | AWS (open-source) | Model-driven agent SDK | Yes - Bedrock, Anthropic, OpenAI | The deployment must support several model providers behind one interface |
| LangGraph | LangChain | Graph-based orchestration runtime | Model-agnostic by design | The workflow needs durable execution, streaming, and human-in-the-loop as graph structure, not just a loop |
| PydanticAI | Pydantic team | Python-first, type-safe agent framework | Model-agnostic by design | Tool input/output correctness-by-construction matters more than orchestration features |

## Decision tree

1. **Is the session long and continuous, with no clean stopping point, approaching its context limit?**
   - **Yes:** Compaction - summarize and reinitiate from the summary, preserving architectural decisions and unresolved threads while discarding redundant tool output.
   - **No:** Check the other techniques below; they are not mutually exclusive.

2. **Is the work milestone-driven and iterative across many sessions (state needs to outlive any single context window)?**
   - **Yes:** Structured note-taking / agentic memory - write to external storage (e.g. the file-based memory tool) and re-read as needed.
   - **No:** Memory persistence may not be the bottleneck here.

3. **Does the task need several independent angles explored in depth, without polluting the coordinator's window with raw traces?**
   - **Yes:** Sub-agent architecture - each sub-agent explores extensively but returns only a condensed ~1,000-2,000 token summary.
   - **No:** A single agent thread may be sufficient without sub-agent isolation.

4. **Does the deployment need multi-model-provider support behind one interface?**
   - **Yes:** Consider Strands Agents (AWS, multi-vendor: Bedrock/Anthropic/OpenAI).
   - **No:** A Claude-only deployment doesn't need Strands' multi-vendor abstraction specifically.

5. **Does the orchestration genuinely need graph-structured control flow with durable execution and human-in-the-loop checkpoints?**
   - **Yes:** Consider LangGraph (LangChain) - but confirm the raw Agent SDK loop can't satisfy this more simply first.
   - **No:** A hand-rolled Agent SDK loop, or PydanticAI for type-safety alone, likely covers it without graph-orchestration overhead.

## Exam-pattern questions

### Q1. 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.

### Q2. 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.

### Q3. 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.

### Q4. 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.

### Q5. 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.

## FAQ

### Q1. 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.

### Q2. 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.

---

**Source:** https://claudearchitectcertification.com/concepts/agent-frameworks-and-design-patterns
**Last reviewed:** 2026-05-04

**Evidence tiers**, 🟢 official Anthropic doc / API contract · 🟡 partial doc / inferred · 🟠 community-derived · 🔴 disputed.
