LangChain reposted this
Day 3 of my harness engineering series: context management with middleware For long-running agents, you need periodic conversation history compaction so you don't overflow the context window. Summarization needs to retain the most important information though, so your agent stays on track after each compression. LangChain's built-in SummarizationMiddleware handles this automatically when your set threshold is reached, so the model never suffers from context overflow. Context engineering is a runtime problem, and middleware makes it easy to manage your context at every point in the agent loop.