By NHI Mgmt Group Editorial TeamDomain: AI SecuritySource: ArizePublished February 25, 2026

TL;DR: Production AI agents fail less from raw model quality than from missing execution controls, exploding context, and weak evaluation discipline, according to Arize. The deeper lesson is that agent governance now depends on code-enforced constraints, out-of-band state, and testable behaviour, not prompt instructions alone.


At a glance

What this is: This is a production debugging analysis of an AI agent that broke under real usage, showing that durable agent behaviour depends on code-enforced constraints, not prompt-only guidance.

Why it matters: It matters to IAM and AI governance teams because AI agents increasingly behave like software identities with tool access, state, and execution authority that need explicit control boundaries.

👉 Read Arize's account of shipping Alyx to production and the debugging lessons it exposed


Context

AI agent debugging is becoming a governance problem, not just an engineering problem, because production agents can call tools, retain state, and make sequenced decisions that affect real systems. When those decisions drift, the issue is often not model intelligence but missing control points around planning, context, and finish conditions, which is exactly where identity and access teams should pay attention.

In practice, this kind of agent behaves like a non-human identity with operational reach. That means the relevant questions are about tool authorization, task scope, state persistence, and whether the system can prove it stayed inside its intended boundary. For readers tracking agentic AI security, the useful parallel is not a chatbot workflow but a governed runtime identity with enforced privileges.


Key questions

Q: What breaks when AI agent access decisions are handled in prompts?

A: Prompt-based access control is fragile because it places security logic inside the same system attackers are trying to influence. That makes policy easier to manipulate than an external authorization layer. When the model owns the decision path, organisations lose a clear boundary for audit, enforcement, and separation of duties.

Q: Why do AI agents need out-of-band state management?

A: Agents need out-of-band state because conversational history is fragile under long tool sequences and large outputs. If the current plan lives only in chat history, it can be buried, truncated, or reinterpreted. Server-side state gives the system a stable record of task progress, blocked steps, and required next actions that can be re-injected on every call.

Q: How do you know if an AI agent is still following the right task?

A: You measure task fidelity, not just answer quality. The best signals are whether the agent can show a current plan, preserve task order, and complete or block work without losing scope after several tool calls. If the agent repeatedly revises its own to-do list or ignores prior steps, the control layer is too weak.

Q: What should organisations do before giving agents broader tool access?

A: They should validate the control logic with evals that test unsupported claims, unsafe actions, and failed tool calls. If a policy cannot maintain output quality under failure conditions, broader tool access only increases blast radius. Scope should expand only after the escalation path is proven and observable.


Technical breakdown

Why prompt instructions fail once an agent starts using tools

An agent loop changes the security problem because every tool call adds new context, and that context can bury the original task. When the model is asked to manage multiple steps, it may keep revising its own plan, call completion too early, or lose track of task order. This is not simple hallucination. It is an execution-control problem created by long, noisy conversational state. The reliable fix is to move rules out of natural language and into tool validation, state machines, and recoverable errors that the system can enforce consistently.

Practical implication: put task boundaries, completion rules, and state transitions in code, not in the prompt.

Why out-of-band plan state is safer than conversational memory

Production agents need a durable working state that survives tool churn and context truncation. Storing the plan outside conversation history and regenerating it on every call gives the agent a stable reference for what it is doing, what is blocked, and what should happen next. The article’s todo structure is effectively a lightweight control plane for the agent. It separates execution state from noisy dialogue, which reduces drift and prevents the model from re-deriving its own instructions from scratch each turn.

Practical implication: maintain agent state server-side and inject only the current plan into each turn.

How context engineering shapes agent reliability at scale

Context engineering is the discipline of deciding what the agent sees, in what form, and at what size. For large structured data, full dumps overwhelm the window, so the better pattern is a handle plus a structure-preserving preview. That lets the agent inspect the shape of the data, query specific slices, and avoid losing signal in token overload. This is especially relevant for AI systems that behave like non-human identities, because their tool access can outpace the human ability to review every intermediate output.

Practical implication: use truncated previews, stable data handles, and small query tools instead of dumping full datasets into context.


NHI Mgmt Group analysis

Code-enforced control, not prompt persuasion, is the real reliability boundary for agents. The article shows that once an AI agent can chain tool calls, prompt text alone cannot reliably govern behaviour. In identity terms, the agent is operating like a non-human identity with execution authority, so the control plane has to enforce scope, not just describe it. The practitioner conclusion is clear: treat agent instructions as advisory and tool policy as authoritative.

Context engineering is becoming a core governance discipline for agentic AI. The problem is not only what the model knows, but what it can still remember after several tool calls and large data returns. When state is buried in conversation history, the agent can drift into self-generated loops and lose the original task boundary. The practitioner conclusion is that context design now belongs alongside access design in the control stack.

Out-of-band state creates a more governable agent than chat history alone. A durable plan object, refreshed on each turn, gives the system a single source of truth for task progress and blocked states. That pattern resembles access state management in IAM: keep the authoritative record outside the ephemeral interaction layer. The practitioner conclusion is to build agent memory like a governed control record, not a conversational transcript.

Named concept: execution drift debt. The article surfaces a familiar failure mode where an agent keeps working but stops working on the right thing, because its own intermediate outputs crowd out the user’s intent. That debt accumulates as the agent scales from single-step answers to multi-tool workflows, and it is exactly where autonomous behaviour becomes hard to audit. The practitioner conclusion is to measure whether the agent can still prove task fidelity after multiple tool hops.

Debugging agents requires the same disciplined observability that identity programmes need for privileged workflows. The article’s trace capture, plan enforcement, and structured recovery patterns are a reminder that governance is easiest when every meaningful action is observable and replayable. For AI systems with tool access, that means building auditability into the runtime from day one. The practitioner conclusion is to require traceable decision paths before expanding agent privileges.

What this signals

Agentic AI programmes will increasingly be judged on runtime governance, not model cleverness. The practical shift is toward traceable execution, bounded tool use, and state that can survive multiple tool hops without losing the original task boundary.

Execution drift debt: when an agent continues to act but no longer serves the user’s intent, the organisation accrues hidden risk. That debt is visible only when teams instrument the agent like a governed identity, with replayable actions and explicit state transitions.

For identity and AI security teams, the next control question is whether agent privileges can be reviewed, constrained, and revoked with the same discipline applied to privileged human access. If not, the agent is effectively operating outside the governance model.


For practitioners

  • Enforce agent task completion in code Require agents to pass through a validation gate before they can finish a workflow, and reject completion when required tasks remain incomplete. Use structured exceptions that list the unfinished items so the agent can recover cleanly instead of guessing its way out. This is a direct control over execution scope, not a prompt refinement.
  • Store agent plans outside conversation history Keep the authoritative plan on the server side and regenerate a compact current-state message on every turn. That prevents task instructions from disappearing into long tool traces or truncated context, and it gives the agent a consistent record of current focus, blocked items, and required next actions.
  • Use stable handles for large structured outputs Return a preview plus a stable object handle when tool output is too large for context, then provide query tools that let the agent pull only the slices it needs. Preserve the full structure, not just the first rows, so the model can reason about shape as well as content.
  • Cap every tool response with hard limits Set maximum output sizes in code for every tool and every query path. Hard limits prevent context explosion, reduce truncation risk, and force the system to expose only the data needed for the current step, which is safer than relying on informal instructions.
  • Capture successful agent sessions as tests Turn production wins into golden traces and decision-point assertions so the agent is tested against real behaviour instead of handcrafted expectations. That approach helps teams spot prompt-tool drift, tool-order regressions, and context handling failures before they reach users.

Key takeaways

  • AI agent failures in production often come from weak execution controls, not weak model capability.
  • Durable agent governance depends on persistent state, bounded context, and auditable tool use.
  • Teams should treat agentic systems like governed non-human identities before expanding their privileges.

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 MITRE ATT&CK address the attack and risk surface, while NIST AI RMF, NIST CSF 2.0 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Agentic AI Top 10The article centers on agent planning, tool misuse, and context-driven execution drift.
NIST AI RMFMANAGEThe post is about operational controls for AI systems in production.
NIST CSF 2.0PR.AC-4Agent tool access and task scope map to least-privilege access control.
MITRE ATT&CKTA0002 , Execution; TA0007 , DiscoveryThe article discusses chained tool execution and data discovery inside structured traces.
NIST SP 800-53 Rev 5AC-6Least privilege is central when agents can call tools and access structured data.

Use MANAGE to implement runtime controls, monitoring, and bounded escalation for agent workflows.


Key terms

  • Agentic AI: Autonomous AI systems capable of planning, deciding, and taking actions — including calling APIs, writing code, and orchestrating other agents — with minimal human oversight. Agentic AI introduces new NHI risks as agents must authenticate to external services.
  • Context Engineering: The practice of selecting, curating, and delivering the information an AI system uses at runtime. In agentic environments, context engineering is a security function because the quality, provenance, and trust level of the inputs directly shape the system’s actions and outputs.
  • Deployment Drift: Deployment drift is the gap between how a system is documented or intended to operate and how it actually runs in production. In identity and access management, drift can weaken trust boundaries, hide dependencies, and create failures that appear only when support or response is urgently needed.
  • Out-of-Band State: State stored outside the conversation transcript so it remains stable across tool calls, retries, and context truncation. In agent systems, out-of-band state becomes the authoritative record for plans, progress, and blocked steps, which makes behaviour easier to enforce and audit.

What's in the full article

Arize's full post covers the implementation detail this analysis intentionally leaves at a higher level:

  • The exact todo planning pattern, including task statuses, finish gating, and how the agent is forced back into the work loop
  • The LargeJson preview and query pattern for keeping structured experiment data out of the active context window
  • The testing approach for golden traces, decision-point assertions, and end-to-end trajectory evaluation
  • The debugging workflow that combines traces, backend spans, and logs to isolate root cause across agent and infrastructure layers

👉 The full Arize post shows the plan state, context handling, and test patterns in implementation detail

Deepen your knowledge

NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, workload identity, secrets management, and agentic AI identity. It helps security practitioners build the control discipline needed for machine-scale access and runtime oversight.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 20, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org