How Deep Agents Manages Context: Offloading and Summarization
The longer an agent runs, the more instructions and tool results pile into its context window, and the worse its reasoning tends to get. That's context rot. This video walks through two context engineering techniques the Deep Agents harness ships out of the box: offloading, which keeps large tool results and long messages out of context while saving them to a virtual file system, and summarization, which compacts the conversation once token usage crosses a threshold (85% by default). You'll see where the 20,000 token offloading threshold kicks in, why token usage can overshoot 85% before summarization runs, how the keep cutoff decides what stays verbatim, and how the two techniques work together over a long run. Deep Agents is LangChain's open source agent harness for long-running tasks, with offloading, summarization, skills, subagents, and long-term memory built in. Chapters: 0:00 What is context rot 0:29 An agent is a model plus a harness 1:14 Two ways to manage context 1:33 How offloading works for tool results 2:12 Offloading long human messages 2:37 How summarization works 3:10 Why token usage overshoots the threshold 3:45 The summarization loop 4:13 Offloading vs summarization 4:34 Skills, subagents, and long-term memory Resources: → Introduction to Deep Agents (free LangChain Academy course): https://academy.langchain.com/courses/foundation-introduction-to-deepagents → Context engineering in Deep Agents (docs): https://docs.langchain.com/oss/python/deepagents/context-engineering → Context Management for Deep Agents (blog): https://www.langchain.com/blog/context-management-for-deepagents → Agent Memory 101: Context Engineering (live workshop): https://events.langchain.com/register/agent-memory-101-context-engineering/