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 2, 2026Karpathy builds a YouTube clone with 6454 videos from Hacker News recommendations in two hours
- Nov 2, 2026Karpathy used Claude to build HackerTube from 6,454 videos recommended on Hacker News
- Nov 2, 2026Arca gives AI agents finance tasks lasting up to 10 days, but leaves the trades to humans
- Nov 2, 2026DeepSeek open-sources Super-agent prototype: p95 task completion time of 15.7 minutes vs. 29.5
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.