four harness mechanisms against context overflow on long tasks: LangChain's thresholds
A MarkTechPost roundup compares the compaction, memory, budgeting and todo-state mechanisms that agent harnesses use, with the thresholds vendors actually ship.
An agent, at its simplest, is a language model calling tools in a loop. According to a MarkTechPost roundup, that loop holds for short jobs but breaks in two ways on a task that runs for an hour and 200 tool calls: context overflow and goal loss. The AWS Samples design guide for autonomous cloud coding agents adds that shallow agents also fail to maintain state over long periods. The layer that fixes this is not the model but the harness, which AWS describes as managing everything except the model.
A bigger context window helps less than expected. Chroma's Context Rot report evaluated 18 models, including GPT-4.1, Claude 4, Gemini 2.5 and Qwen3, and found performance grows increasingly unreliable as input length grows, even on simple retrieval tasks. Anthropic's context engineering guide explains it through an attention budget: n tokens create n² pairwise relationships, so every added token draws from a finite pool. Manus reports that a typical task needs around 50 tool calls, with an input-to-output token ratio near 100:1.
Published thresholds
In LangChain Deep Agents, a tool response over 20,000 tokens is written to the filesystem and replaced by a file path plus a preview of the first 10 lines; once session context passes 85% of the window, older write and edit calls are truncated to a pointer. Claude Code caps auto memory at the first 200 lines or 25KB, defers MCP tool schemas by default, and returns any re-read file over 5,000 tokens as a path reference after compaction.
Compaction has also moved into the API layer. OpenAI's Responses API offers server-side compaction with a compact_threshold and a standalone /responses/compact endpoint, and OpenAI says Codex relies on this to sustain long-running coding tasks. Manus takes a simpler route: its agent writes a todo.md and rewrites it step by step, pushing the plan back to the end of the context.
Full details are in the MarkTechPost article.