TL;DR: Long-running agents analyzing 20+ AWS accounts can lose early findings when the context window fills, according to Tetrate, because tool results accumulate faster than the run can finish. The practical fix is durable persistence, stable IDs, and preserved human decisions before a run truncates.
At a glance
What this is: This is an analysis of how production AI agents fail when long tool chains outgrow the context window, and why auto-save, stable IDs, and status preservation make output reliable.
Why it matters: It matters because IAM, NHI, and agentic AI programmes cannot treat agent runs as disposable sessions when findings, access decisions, and workflow state need to survive crashes and reruns.
Context
Production AI agents that run across many tools and accounts face a state-management problem, not just a model-quality problem. When outputs stay only in the conversation history, the system can lose earlier work as the context window fills and the run becomes incomplete.
The article centers on reliability controls for long-running analysis agents: persist findings as they are created, give recurring resources stable IDs, and respect prior human decisions instead of overwriting them on the next run. That same governance logic applies whenever agentic systems hold delegated access or produce operational decisions over time.
Key questions
Q: What breaks when long-running agents depend on the context window for state?
A: They lose durable continuity when the conversation grows too large, which can truncate earlier findings, hide partial work, and make a crash indistinguishable from a successful run. The practical failure is not just lost tokens. It is lost evidence, lost workflow state, and a broken chain of accountability across repeated executions.
Q: Why should security teams persist agent findings before a run completes?
A: Because completion is not guaranteed. If the agent crashes, times out, or exceeds the context limit, anything stored only in session memory disappears with it. Early persistence turns each discovered result into durable evidence, which is essential when the agent is doing recurring operational work or supporting human review.
Q: How do recurring agents avoid duplicate findings across weekly runs?
A: Use stable identifiers derived from the underlying resource identity, not from the time of discovery. That makes each rerun update the same record instead of creating a new one, so review history, remediation progress, and lifecycle status stay intact across repeated analyses.
Q: What should teams do when an agent rediscovers something a human already dismissed?
A: Respect the prior decision and preserve the existing status unless the underlying condition has genuinely changed. If the system overwrites dismissed or resolved items every week, trust in the workflow collapses and reviewers stop treating the agent as a reliable part of operations.
Technical breakdown
Why the context window becomes a reliability bottleneck
In long-running agent workflows, each tool call adds tokens to the conversation state. When the agent must reason across many accounts or systems, the prompt grows until the model spends more effort carrying prior results than making current decisions. The failure mode is not model intelligence but state overload: the agent can still be technically active while the usable working memory becomes too expensive or too large to continue safely. In production, that means partial runs, truncated summaries, and lost intermediate findings. For governance, the lesson is that the runtime state of the agent must be externalized before the model’s context becomes the system of record. See the AI Agent Memory Security Guide.
Practical implication: Separate durable workflow state from model context so a long run can fail without losing prior results.
How auto-save changes agent architecture
Auto-save moves persistence into the tool layer, so every discovered finding is written to storage before the model receives the response. That is a different architecture from batch persistence at the end of a run. It turns each tool invocation into a stateful action that both informs the model and commits durable evidence. This matters because the LLM should not be the only place where work exists. In agentic systems, the execution layer, data layer, and decision layer need independent continuity. Otherwise a crash, timeout, or context overflow turns a useful partial run into a discarded attempt instead of an auditable record. See the AI Agent Observability, Audit and Incident Response Guide.
Practical implication: Persist operational outputs at the point of discovery, not only at session completion.
Why stable IDs and status preservation matter for recurring agents
Recurring agents need deterministic identifiers so the same real-world object maps to the same record on every run. Without that, repeated analysis creates duplicate findings and destroys lifecycle history such as acknowledged, dismissed, in progress, or resolved. Status preservation is the second half of the control: when a human has already decided how to treat a finding, the agent must not reset that decision just because it sees the same condition again. This is the governance bridge between machine output and human accountability. The system becomes trustworthy when identity, state, and review outcome all persist across runs. See the AI Agent Authorisation Guide.
Practical implication: Use deterministic identifiers and lifecycle-aware writes so repeated discovery does not erase human judgement.
Threat narrative
Attacker objective: The objective is not external compromise but trustworthy production behaviour, which the design prevents by preserving state, review history, and findings across runs.
- Entry occurs through a long-running multi-tool agent session that keeps appending results until the context window becomes overloaded.
- Escalation happens when the agent loses earlier state, retries unnecessary work, or overwrites prior human decisions with a fresh run.
- Impact is the loss of durable workflow continuity, duplicate records, and unreliable operational output across repeated analyses.
Breaches seen in the wild
- 230M AWS environment compromise: 230M AWS environments compromised via exposed .env files with cloud credentials.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Context-window reliability is now an identity governance issue, not just an engineering inconvenience. When an agent uses delegated access across many systems, the question is not only whether it can complete the task, but whether the task survives interruption and review. That makes persistent findings, not transient prompts, the real governance object. The same logic applies to any agent that acts on behalf of a programme owner: if the run state disappears, accountability disappears with it. Practitioners should design for durable evidence, not just model output.
Stable identity for findings is the missing control in recurring agent workflows. The article’s hash-based IDs are a useful pattern because they bind repeated discovery to the same record instead of generating endless duplicates. That is an identity problem in the broad sense: the system needs a stable way to recognise the same resource over time. Without that, review history, remediation progress, and dismissal decisions fragment into snapshots. Practitioners should treat deterministic object identity as a governance requirement, not a developer convenience.
Human decisions must outlast the agent run that discovered the issue. A dismissed or acknowledged finding is a governance decision, and the agent should honour that decision on later runs unless the underlying condition changes materially. That principle matters across IAM, NHI, and agentic AI programmes because review workflows only work when the system preserves intent across sessions. If the machine keeps resetting the human’s judgement, review becomes theatre. Practitioners should enforce status-aware persistence as part of the control plane.
Access errors are not noise when agentic systems depend on cross-account trust. A failed role assumption, missing trust policy, or insufficient permission is a signal about governance drift, not merely an execution error. In this pattern, observability has to cover failure conditions as first-class records, because silent skips create blind spots in the control environment. This is especially relevant wherever agent identity issues intersect with operational access to cloud accounts. Practitioners should surface failed access as evidence of control drift, not hide it in logs.
Agent reliability is converging on a control-plane model for state, privilege, and audit. The article shows that production-grade agents need durable storage, stable identity, preserved status, and failure accounting before they can be trusted at scale. That is exactly the direction the market is moving: governance is shifting from prompt quality to runtime control. Practitioners should expect agent platforms to be judged on how well they preserve state and accountability across runs, not on how fluent the model sounds.
What this signals
Context durability is becoming a control surface for agentic systems. As agents take on longer workflows, the programme risk shifts from model quality to whether state, review history, and partial work survive failure. The operational boundary is no longer the prompt. It is the persistence layer that holds outcomes after the run ends.
Agent identity has to be stable enough for governance to recognise the same object twice. Deterministic IDs, preserved statuses, and failure records are what let teams distinguish a repeat finding from a new one. Where that continuity is missing, the programme cannot measure drift, closure, or reviewer intent reliably.
For practitioners
- Implement auto-save for every discovered finding Write each result to durable storage before returning it to the model so a crash cannot erase completed work.
- Assign deterministic IDs to recurring resources Hash stable identity fields such as provider, account, and resource ID so the same object updates one record instead of creating duplicates.
- Preserve human review status across reruns Block automated overwrites when a finding is already dismissed, resolved, or acknowledged, and keep the prior status unless the condition materially changes.
- Treat access failures as first-class workflow objects Record failed role assumptions, permission errors, and trust-policy problems alongside findings so skipped accounts are visible in dashboards and summaries.
Key takeaways
- Long-running agents fail in practice when their working memory doubles as their only system of record, because crashes and truncation erase prior results.
- The article shows that durable persistence, stable IDs, and status-aware writes are the controls that turn partial runs into usable operational output.
- For practitioners, the main lesson is that agent governance begins at runtime state management, not at prompt design.
Related NHI Mgmt Group resources: AI Agent Observability, Audit and Incident Response Guide · AI Agent Authorisation Guide · Top 10 Agentic AI Identity Issues · AI Agent Memory Security Guide
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 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | The article centers on delegated agent behaviour, persistent state, and controlled access across runs. |
| ASI08 — Cascading Failures | Context overflow and lost state create chained failures across long-running tool workflows. | |
| Recommendation — Apply ASI03 to bind agent actions to stable identities and preserve decision state across sessions. Use ASI08 controls to contain run-time failure propagation and keep partial execution auditable. | ||
| NIST AI RMF | GOVERN — AI Governance and Accountability | The piece is fundamentally about governance of persistent agent behaviour and human review history. |
| Recommendation — Use GOVERN to define ownership for agent persistence, review status, and failure handling. | ||
| NIST CSF 2.0 | GV.OV-01 — Oversight of Risk Management Strategy | The article describes operational oversight for an AI workflow that must remain reliable over time. |
| Recommendation — Tie agent reliability controls to governance oversight so state loss is treated as a managed risk. | ||
| CSA MAESTRO | Agentic AI governance | MAESTRO is directly relevant to runtime supervision and control of agentic workflows. |
| Recommendation — Map agent state persistence and supervisory controls to MAESTRO before production rollout. | ||
Key terms
- Context Window: The context window is the text a model receives at one time, including prompts, retrieved documents, and conversation history. Security teams care about it because it becomes the practical boundary between trusted instructions and untrusted content, especially when the application assembles that text automatically.
- Stable Identifier: A stable identifier is a deterministic ID derived from the identity of the underlying object rather than from time of creation. In agentic workflows, it lets repeated discovery map to the same record, preserving lifecycle history, preventing duplicates, and supporting reliable updates across reruns.
- Status-Aware Persistence: Status-aware persistence is a storage pattern that preserves an existing review state when new data arrives. It prevents automation from overwriting human decisions such as dismissed, acknowledged, or resolved, which is essential when machine output must coexist with human governance over time.
- First-Class Error Record: A first-class error record is a failure event stored and surfaced as operational data rather than logged and ignored. In agent systems, this makes access failures, permission drift, and trust-policy problems visible to reviewers instead of disappearing inside routine execution noise.
Deepen your knowledge
NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, and secrets management. It helps practitioners connect identity controls to the operating model behind production agents and other delegated systems.
Published by the NHIMG editorial team on October 22, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org