Long-running agents accumulate tool results, prior responses, and user follow-ups until the context window becomes crowded. Quality often degrades before the hard limit is reached, with more repetition, missed instructions, and malformed output. Governance becomes harder because the agent may still look successful while the underlying context has already drifted beyond a safe operating range.
Why This Matters for Security Teams
Long-running agents are not just “chat sessions that last longer.” They behave more like stateful systems with accumulating memory, tool output, and unresolved instructions. That creates governance risk because the same context that helps the agent stay useful can also carry stale assumptions, conflicting goals, or unsafe actions forward. The OWASP Agentic AI Top 10 and the NIST AI Risk Management Framework both point practitioners toward lifecycle controls, not just prompt-level checks.
The key failure mode is that drift is usually gradual. The agent may keep producing plausible output while losing track of earlier constraints, repeating tool calls, or overweighting the most recent user instruction. That makes manual review harder because the system appears responsive even as its internal decision quality degrades. Governance also becomes more difficult when the agent has access to secrets, privileges, or external tools, because context sprawl can blur what was authorised, what was inferred, and what was merely observed. In practice, many security teams encounter this only after a long-lived agent has already taken a series of small wrong turns that no single review point caught.
How It Works in Practice
As context grows, the agent must process more history, more tool outputs, and more exceptions in every turn. The practical problem is not only token limits. It is attention dilution, instruction conflict, and weaker prioritisation of policy-relevant content. That is why long-running agents often need governance patterns that look more like operational control than conversational QA.
Security teams usually need to separate three layers:
-
OWASP Top 10 for Agentic Applications 2026 threat classes such as prompt injection, excessive agency, and tool abuse.
-
Context management controls such as summarisation, retrieval filtering, and explicit state reset points.
-
Audit controls that preserve what the agent saw, what it decided, and which tool actions it executed.
In mature deployments, summarisation should not be treated as a compression trick alone. It is a governance step that decides what is retained as authoritative state and what is discarded as transient conversation. Best practice is evolving, but the current guidance suggests that high-risk actions should rely on bounded context, not an ever-growing transcript. Pairing this with the MITRE ATLAS adversarial AI threat matrix helps teams think about how an attacker might intentionally manipulate the agent’s memory, retrieval path, or tool chain.
Where the agent touches production systems, logging needs to capture more than prompts and outputs. It should show context version, policy version, retrieved documents, tool call sequence, and any human approvals. That level of traceability matters because a long-lived agent can look compliant at the interface layer while silently carrying policy debt inside the session. These controls tend to break down when agents run continuously across many tasks with no hard session boundaries because the organisation loses a reliable point at which to re-evaluate intent, scope, and privilege.
Common Variations and Edge Cases
Tighter context controls often increase friction, requiring organisations to balance agent usefulness against review burden and operational latency. That tradeoff is unavoidable in production systems that need both autonomy and accountability.
There is no universal standard for how much context is too much, because the right threshold depends on task criticality, tool access, and the stability of the underlying workflow. For low-risk support tasks, periodic summarisation may be enough. For high-impact actions, best practice is evolving toward explicit checkpoints, short-lived work units, and fresh policy evaluation before each privileged step.
Some environments need extra caution:
-
RAG-heavy agents can accumulate outdated retrieved content, which makes stale facts look authoritative.
-
Multi-agent workflows can amplify context drift when one agent passes compressed state to another without preserving provenance.
-
Long-running incident-response or SOC agents may inherit stress from noisy events and overfit to the latest alert.
-
Agents with secrets or delegated privilege need stricter session resets because context growth can obscure whether an action is still within scope.
The governance answer is not simply to cap tokens. It is to define when context should be rehydrated, when summaries should be discarded, and when the agent must restart from a clean state. The CSA MAESTRO agentic AI threat modeling framework is useful here because it encourages teams to model state, dependencies, and trust boundaries explicitly. As a result, long-running agents stay governable only when context is treated as a controlled asset rather than an unlimited memory stream.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10, MITRE ATLAS and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST AI RMF and NIST AI 600-1 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | Agent memory and context abuse | Long-lived context is central to agent memory and tool misuse risk. |
| NIST AI RMF | GOVERN | Governance is needed to manage lifecycle risk as agent context expands. |
| NIST AI 600-1 | Context management and output reliability | GenAI risk increases when long context weakens output quality and traceability. |
| MITRE ATLAS | Prompt injection / model manipulation | Attackers can exploit growing context to steer memory, retrieval, or tool behavior. |
| OWASP Non-Human Identity Top 10 | Privilege and credential lifecycle | Agents holding secrets or delegated access need tighter lifecycle governance. |
Minimise standing access, rotate secrets, and reauthorise privileged agent actions frequently.
Related resources from NHI Mgmt Group
- Why do AI agents become harder to govern when they need private data and outbound access?
- Why do AI agents become harder to govern as they scale across more repositories?
- Why do AI architectures become harder to govern as organisations add agents and MCP tools?
- How should organisations govern AI agents that rely on long-context retrieval?