Skills
LangChain Four-Bucket Context Engineering: Write/Select/Compress/Isolate for Long-Running Agents
LangChain's official context engineering framework partitions all context management decisions into four strategies: Write (persist agent scratchpads and notes outside the window), Select (retrieve only relevant context via RAG at each step), Compress (add summarization nodes to trim tool outputs before they accumulate), and Isolate (store heavy state in dedicated fields, injecting it only when the relevant tool is called). Applying all four to a production LangGraph agent eliminates the two most common failure modes—lost-in-the-middle degradation and runaway context accumulation—while keeping token costs proportional to task complexity rather than session length.
↳ Follow the thread