PrepGenAICerts

Recurring Agent Patterns and Abstraction Frameworks

Core

Recognize agent patterns and abstraction frameworks · Difficulty 2/5

0%
tool-use-loopmemorycontext-managementabstraction-frameworkslanggraph

Explanation

Recurring Patterns

  • Tool-use loop -- the core agent cycle: model emits tool_use, the harness executes it, returns `tool_result`, and the model continues. Every step is grounded in real environment feedback, not just the model's own prior output.
  • Subagents -- delegate isolated subtasks to agents running in their own context window (see manager/Subagent hierarchies).
  • Memory -- persist state across turns or sessions (e.g., a scratchpad file, or an external store the agent reads/writes) so the agent isn't limited to what fits in one context window. Memory is distinct from in-session context management: it survives across sessions, not just across turns within one.
  • Context-window management -- prune stale tool output, compact history, isolate heavy subtasks via subagents. This is a recurring pattern applied continuously, not a single fix applied once.

Abstraction Frameworks

FrameworkFlavor
Claude Agent SDKAnthropic's own loop, tools, hooks, subagents
LangGraphGraph/state-machine orchestration of nodes and edges
PydanticAIType-safe agents with Pydantic-validated structured I/O
StrandsModel-driven agent framework

Frameworks package these recurring patterns so developers don't hand-roll them. They speed up development but add a layer of abstraction: Anthropic advises understanding the underlying API calls first, because hidden layers make debugging harder. Choose a framework for the leverage it provides, not as a substitute for understanding the loop it wraps.

Common exam traps

  • Assuming a framework removes the need to understand the tool-use loop and context management -- it only implements them under the hood. Items may reward the answer that keeps the design transparent and debuggable over the one that hides the most complexity.
  • Confusing memory (state persisted across turns/sessions, outside any single context window) with in-session context-window management (pruning/compacting/isolating within one window). They solve related but distinct problems.
  • Picking a framework by name recognition rather than by matching its actual flavor (graph orchestration, type-safe I/O, model-driven design) to the stated requirement.

Key Takeaways

  • The tool-use loop -- emit tool_use, execute, return tool_result, continue -- is the core agent cycle, grounded in real environment feedback
  • Memory persists state across turns or sessions, distinct from in-session context-window management
  • Context-window management (pruning, compacting, isolating) is a continuously applied pattern, not a one-time fix
  • Claude Agent SDK, LangGraph, PydanticAI, and Strands each package these patterns with a different flavor -- own loop/hooks, graph orchestration, type-safe I/O, and model-driven design respectively
  • Understand the underlying API calls before adopting a framework; hidden abstraction layers make debugging harder

Glossary Terms

Context Compression

The practice of actively reducing a conversation's token footprint so it fits within the model's context window without silent truncation. Encompasses multiple strategies — rolling window eviction, progressive summarization, external storage with retrieval, and prompt caching — each with different loss profiles and complexity trade-offs. Understanding this menu of options, and knowing what must never be compressed, is a core Domain 5 skill.

Context Rot

Attention degradation caused by a context window filling with irrelevant, stale, or low-signal content, even when technically there is still room left in the window. Distinct from running out of space (a hard context-window limit) and from position effects (attention bias by location within the window) -- context rot is specifically about signal-to-noise degrading as low-value tokens accumulate.

Subagent

A Claude instance spawned by an orchestrator to handle one bounded subtask in complete context isolation. Each subagent starts with a fresh context window — the orchestrator's history is never inherited — and is invoked via the [Task tool](/glossary/task-tool). The subagent runs its own full [Agentic Loop](/glossary/agentic-loop), then returns a single structured result to the orchestrator.

tool_result

A content block type in the user message that returns the output of a tool execution back to Claude. Must include the 'tool_use_id' matching the original tool_use block. Can be text, images, or error messages. Claude processes the result and continues reasoning.

tool_use

A content block type in Claude's response indicating the model wants to call a specific tool. Contains 'id', 'name', and 'input' fields. The agent must execute the tool and return results in a tool_result content block for the conversation to continue.

Related Concepts

PrepGenAICerts.com is an independent third-party exam-prep platform for the Claude Certified Architect (CCA-F) certification. We are not affiliated with, endorsed by, or acting on behalf of Anthropic PBC.

Note: New premium upgrades are temporarily paused while we resolve an issue with our payment provider. Existing premium members retain full access.