1:1 mentoring with Big Tech AI engineers
Q25Premium

The agent's context window is full after 10 tool calls. What do you do?

Memory & State

Context WindowMemoryOptimizationArchitecture

Asked at Anthropic · Cursor · OpenAI

How to Answer

"Context management strategies:

  • (1)Observation summarization — after each tool call, summarize the result to 2-3 sentences instead of keeping the full response.
  • (2)Sliding window — keep the system prompt + first user message + last N messages. Drop middle turns.
  • (3)Context compaction — Claude's Agent SDK does this automatically: when approaching the limit, it summarizes older turns while preserving key facts.
  • (4)Hierarchical delegation — offload sub-tasks to sub-agents with their own context windows. The orchestrator only sees summaries.
  • (5)External scratchpad — write intermediate results to a file/DB, reference by ID instead of keeping in context."

The deep dive — diagrams, tradeoff tables, and the follow-up trap

Loading…