How do you manage context in a long-horizon agent that runs for many steps?
Quick-fire answer from the Awesome Generative AI Guide (MIT)
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Long-horizon agents accumulate messages and verbose tool outputs that cause context rot and cost blowup, so you actively curate the working context rather than letting it grow. Techniques include compacting old turns into summaries, evicting or truncating stale tool results, writing durable facts to external memory and retrieving only what a step needs, and isolating subtasks into sub-agents with their own fresh context that return a short result. Anthropic's multi-agent research system, for instance, gives subagents isolated windows that return condensed summaries. The throughline is that the context is a managed budget across the whole run, not a transcript you append to forever.
Full worked answer
Long-horizon agents accumulate messages and verbose tool outputs that cause context rot and cost blowup, so you actively curate the working context rather than letting it grow. Techniques include compacting old turns into summaries, evicting or truncating stale tool results, writing durable facts to external memory and retrieving only what a step needs, and isolating subtasks into sub-agents with their own fresh context that return a short result. Anthropic's multi-agent research system, for instance, gives subagents isolated windows that return condensed summaries. The throughline is that the context is a managed budget across the whole run, not a transcript you append to forever.
Learn more: Anthropic: Effective context engineering for AI agents
What a good answer covers
- Long-horizon agents accumulate messages and verbose tool outputs that cause context rot and cost blowup,…
- Techniques include compacting old turns into summaries, evicting or truncating stale tool results,…
- Anthropic's multi-agent research system, for instance, gives subagents isolated windows that return…
- The throughline is that the context is a managed budget across the whole run, not a transcript you…
Key terms: Learn more
In the glossary: Context rot · Multi-agent · Subagent · Context engineering
Quick-fire answer from the Awesome Generative AI Guide (MIT) · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep