Deep Agents SDK implements three context compression techniques to manage LLM memory constraints during long-running tasks: offloading large tool results (>20k tokens) to filesystem with preview references, truncating old file write/edit operations when context reaches 85% capacity, and summarizing conversation history when offloading is insufficient. The summarization creates an in-context structured summary while preserving full messages on filesystem for retrieval. Evaluation strategies include stress-testing compression features at aggressive thresholds (10-20% vs 85%) to amplify signal, targeted integration tests for recoverability and goal preservation, and monitoring for goal drift after compression events.

6m read timeFrom blog.langchain.com
Post cover image
Table of contents
Offloading large tool resultsOffloading large tool inputsSummarizationWhat this looks like in practice
613 Impressions