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.
- Dec 2, 2026Ai2 Releases MolmoWeb2 Web Agents: 27B Model Solves 75.3% of Tasks
- Dec 2, 2026Amazon Releases Ergo Open Weights for Coding: 1.1 Trillion Parameters and 2,200 Tokens per Second
- Dec 2, 2026OpenAI Opens Dots Agent to ChatGPT Plus Subscribers With 10,000+ Plugins
- Dec 2, 2026FSK Group Has Launched 395 AI Agents in Six Months, with a 97.7% Success Rate
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.
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.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
