Context pollution
Trajectory drift, hallucination spirals, overlong or off-task context.
Description
The agent's working context degrades over a session — relevant prior information is dropped, irrelevant material accumulates, or hallucinations from earlier turns are treated as ground truth in later turns. Failure of in-session state hygiene, not of a single generation.
Detection signals
- Later turns reference facts or code that never existed in user input or tool output.
- Token-budget pressure truncates prior turns containing still-relevant context.
- Agent repeats a failed tool call multiple times with identical arguments.
- Session duration exceeds a threshold at which attention-over-context is empirically unreliable for the model.
Prior work
- Melis Cemri (2025) — Why Do Multi-Agent LLM Systems Fail? MAST: A Multi-Agent System Failure Taxonomy
- Zhu (2025) — Where LLM Agents Fail: A Taxonomy of Errors and the AgentErrorBench Dataset
Crosswalks
Attacker manipulation of agent memory or long-context state.
OWASP "Memory & Context Poisoning" covers adversarial manipulation; context_pollution covers accidental drift as well.
Relevant prior context is dropped or truncated.
MAST Context Loss is the direct counterpart.
Important context is truncated; agent drifts.
DAPLab Context Window Overflow is the direct counterpart.
Mitigating tools
- activepieces — AI agents, MCPs, and AI workflow automation — open-source Zapier alternative.
- agno — Build multi-agent systems in pure Python.
- Arize Phoenix — Open-source LLM tracing and evaluation platform built on OpenTelemetry.
- AutoGen — Multi-agent conversation framework with programmable group chats.
- AutoRAG — Open-source framework for retrieval-augmented generation (RAG) evaluation and optimization.
- Braintrust — Commercial eval-first platform for LLM applications with prompt playground and online scoring.
- CopilotKit — The frontend stack for agents and generative UI — React and Angular.
- coze-loop — Full-lifecycle AI agent management platform with debugging, evaluation, and monitoring.
- CrewAI — Role-based multi-agent framework with task contracts and process flows.
- Flowise — Build AI agents, visually.
- Helicone — Open-source LLM observability proxy with one-line integration and caching.
- Langfuse — Open-source LLM engineering platform for tracing, evals, and prompt management.
- LangGraph — Graph-structured state machines for stateful multi-agent orchestration.
- LangSmith — Hosted LLM observability, tracing, and evaluation platform.
- letta — Stateful agents framework with memory, reasoning, and context management (formerly MemGPT).
- llm-guard — The Security Toolkit for LLM Interactions.
- logfire — Pydantic Logfire — observability for AI agents, LLMs, and Python apps built on OpenTelemetry.
- manifest — Smart model routing for personal AI agents.
- mastra — The TypeScript AI agent framework — assistants, RAG, observability; supports any LLM.
- NeMo Guardrails — Colang-based programmable guardrails for LLM applications.
- openlit — Open-source AI engineering platform: OpenTelemetry-native LLM observability, guardrails, evaluations, prompt management.
- llm-app — Ready-to-run cloud templates for RAG, AI pipelines, and enterprise search with live data.
- pezzo — The cloud-native open-source LLMOps platform.
- ragas — Supercharge your LLM application evaluations — RAG- and agent-centric metrics.
- ragflow — Open-source RAG engine based on deep document understanding.
- safe-rlhf — Safe RLHF: constrained value alignment via safe reinforcement learning from human feedback.
- TruLens — Evaluation and Tracking for LLM Experiments and AI Agents
- voltagent — TypeScript-native AI agent engineering platform with built-in observability.