Context engineering: why AI agents get lost in long conversations, and how developers are fixing it
Developers building AI agents with RAG, tools and memory run into the same problem: after a few dozen iterations, the model starts mixing up tools and leaning on old mistakes in the conversation. A new prompt doesn't fix it. What matters is controlling what information reaches the model before each step. This approach is called context engineering.
AI-processed from Habr AI; edited by Hamidun News
Developers of conversational AI agents with RAG, tools and memory describe the same problem: the system works well in short conversations, but after a few dozen iterations the model starts confusing tools, pulling outdated calls into its answers and relying on an error that once made it into the context. A new discipline, context engineering, is emerging to address this.
How this differs from prompt engineering
The key point is that a new, better prompt does not always solve agent degradation. The issue isn't how the instruction is worded, but which information reaches the model before each next reasoning step. Prompt engineering works with the text of a single request, RAG with retrieving external data, and MCP with standardizing access to tools. Context engineering operates a level above: it manages the entire contents of the model's context window at every step of the conversation, including what goes in, what gets removed and in what order it is presented.
- The problem doesn't show up right away, but after a few dozen iterations of a conversation with the agent
- Symptoms: confusion when choosing tools, use of outdated calls, entrenchment of earlier errors
- Context engineering stands apart from prompt engineering, RAG and MCP as a separate discipline of context management
Why the agent starts making mistakes
As a conversation grows, old tool calls, intermediate results and facts that are no longer valid pile up in the model's context window. The model does not automatically distinguish fresh information from stale: it treats everything in the context as potentially relevant. If an error gets in once, the model may rely on it in later steps, widening the gap between its picture and the actual state of the task.
What this means
As AI agents move from demos to long production workflows with RAG, tools and memory, context management is becoming an engineering discipline of its own, on par with prompt design and model selection. Teams that build explicit rules for selecting and cleaning context before each step get more stable agents in long conversations.
- Nov 1, 2026Local models lose to Opus and Codex: 0.21 on a MacBook versus 1.00 for Codex
- Nov 1, 2026Adobe's EditAgent judge picks a usable edit 81.3% of the time, versus 74.8% for EditScore
- Nov 1, 202616 models tested on 7 search tools: Exa averaged 10.5 out of 14, SearXNG about 3
- Nov 1, 2026Google's StreamVibe video agent beats other models by 10.7% on response timing and quality
Key Questions Answered
How this differs from prompt engineering?
The key point is that a new, better prompt does not always solve agent degradation. The issue isn't how the instruction is worded, but which information reaches the model before each next reasoning step. Prompt engineering works with the text of a single request, RAG with retrieving external data, and MCP with standardizing access to tools. Context engineering operates a level above: it manages the entire contents of the model's context window at every step of the conversation, including what goes in, what gets removed and in what order it is presented. The problem doesn't
Why the agent starts making mistakes?
As a conversation grows, old tool calls, intermediate results and facts that are no longer valid pile up in the model's context window. The model does not automatically distinguish fresh information from stale: it treats everything in the context as potentially relevant. If an error gets in once, the model may rely on it in later steps, widening the gap between its picture and the actual state of the task.
What this means?
As AI agents move from demos to long production workflows with RAG, tools and memory, context management is becoming an engineering discipline of its own, on par with prompt design and model selection. Teams that build explicit rules for selecting and cleaning context before each step get more stable agents in long conversations.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.