DeepHorus is an innovative tech media and intelligence platform focused on AI, blockchain, startups, and emerging technologies.
Published on

Context Engineering Inside the Harness: 4 Mechanisms That Beat Context Overflow and Goal Loss on Long-Horizon Tasks

Authors
  • avatar
    Name
    DeepHorus
    Twitter

AI agents fail on long-horizon tasks in two predictable ways: context overflow and goal loss. The AWS Samples design guide for autonomous cloud coding agents identifies these failure modes and points to the harness—the layer managing everything but the model—as the fix. An analysis of LangChain Deep Agents, Claude Code, Manus, OpenAI Codex, and Amazon Bedrock AgentCore reveals four mechanisms that turn a shallow loop into a deep agent.

The problem is well documented. Chroma's Context Rot report evaluated 18 LLMs, including GPT-4.1, Claude 4, Gemini 2.5, and Qwen3, and found performance grows increasingly unreliable as input length grows. Anthropic's guide says attention creates n² pairwise relationships for n tokens, depleting a finite attention budget. Manus reports typical tasks need about 50 tool calls, with a 100:1 input-to-output token ratio.

Context budgeting and offloading keep useless data out. Deep Agents writes tool responses over 20,000 tokens to the filesystem and replaces them with a file path plus a 10-line preview. When context crosses 85% of the window, older write and edit calls become pointers. Claude Code caps auto memory at 200 lines or 25KB and defers MCP schemas.

Compaction, memory strategy, and todo-state handle the rest. Summarization is a last resort after offloading. Claude Code's subagent pattern shows the payoff: a research subagent reads 6,100 tokens of files and returns a 420-token result to the parent.

Goal loss is not only a model bug. It is the expected result of unmanaged context on long tasks. Harness-level engineering can improve reliability without larger models.

AWS calls the harness the layer managing everything but the model, and the industry now treats context as a resource with diminishing returns. This challenges the idea that bigger windows fix agent loops. As agents run for hours with 200 tool calls, context engineering becomes core.

Shipping mechanisms offer a blueprint for future harnesses. Refining offloading, memory, and todo-state will define the next generation of agents. That work is already underway.

Read original article →Source: marktechpost