By NHI Mgmt Group Editorial TeamDomain: AI SecuritySource: TruFoundryPublished June 30, 2026

TL;DR: Building a shopping assistant shows that forcing every interaction through agentic reasoning adds latency, cost, and control risk when clear intents can be handled deterministically, while open-ended, multi-step tasks still need a ReAct-style loop, TruFoundry’s analysis finds. TrueFoundry’s analysis also shows that state must be organised around workflows and explicit context, not just conversation history, to keep multi-product assistants reliable.


At a glance

What this is: This is an engineering analysis of when AI assistants should use deterministic execution versus agentic reasoning, and how state management must change as the assistant expands.

Why it matters: It matters because identity and access decisions increasingly sit inside AI workflows, where over-broad agent behaviour, weak state boundaries, and unclear tool selection can become governance failures.

By the numbers:

  • 80% of organisations report their AI agents have already performed actions beyond their intended scope, including accessing unauthorised systems (39%), inappropriately sharing sensitive data (31%), and revealing access credentials (23%).

👉 Read TruFoundry's analysis of deterministic workflows and agentic reasoning in shopping assistants


Context

AI assistants become harder to govern as soon as they move beyond single-step answers and begin chaining tools, context, and memory across tasks. In this case, the primary issue is not model quality alone, but the control boundary between deterministic execution and agentic reasoning, especially when the system can act on product data, inventory, and fulfilment flows inside a shared AI gateway.

That creates a genuine identity and access angle because the assistant’s tool use is effectively a delegated runtime privilege problem. The same governance logic that applies to NHI and agentic AI security also applies here: separate predictable actions from higher-risk workflows, make context explicit, and avoid treating every request as if it needs autonomous reasoning.


Key questions

Q: How should teams decide when an AI assistant needs agentic reasoning?

A: Use agentic reasoning only when the task requires tool choice, intermediate evaluation, or multi-step decision-making. If the intent is clear and the tool is known, deterministic execution is safer, faster, and easier to audit. The rule of thumb is simple: autonomy should solve ambiguity, not replace predictable workflows.

Q: Why do explicit state boundaries matter in multi-step AI workflows?

A: Explicit state boundaries prevent stale context from leaking across tasks, products, or users. When assistants carry implicit memory too far, they can call the wrong tool, answer from the wrong object, or confuse one workflow with another. Clear state scopes make behaviour predictable and support governance.

Q: What breaks when AI assistants rely on flat conversation history?

A: A flat history accumulates irrelevant context, increases token load, and makes it hard to know which object the user means. That leads to slower responses, poorer tool selection, and unreliable follow-up actions. In production, memory must be scoped to the workflow, not treated as one long thread.

Q: How should organisations govern external tools used by AI agents?

A: Organisations should review external tools as security inputs, not convenience features. Each tool needs ownership, approval, metadata inspection, and ongoing monitoring for hidden instructions or unexpected behaviour. If an AI agent can act on a tool, then the tool’s provenance and control status should be governed like any other sensitive integration.


Technical breakdown

Deterministic execution versus ReAct loops

Deterministic workflows are used when intent is clear, the tool is known, and the output can be assembled directly. A ReAct loop adds planning, tool selection, execution, and synthesis, which is useful when the path is unknown or depends on intermediate results. The architectural difference matters because each extra reasoning cycle increases latency, token load, and error surface. In production, the question is not whether an LLM can reason, but whether it needs to reason for that specific task. Where the answer is already predictable, the system should route directly to the tool and reserve agentic behaviour for ambiguity and multi-step dependency chains.

Practical implication: classify requests by intent before model invocation and bypass agentic loops for known, low-risk tool actions.

State management for multi-product assistants

State in a production assistant must track workflow context, not just conversation history. When users switch products, compare items, or revisit earlier requests, implicit memory becomes brittle because the system can no longer tell which object current prompts refer to. Explicit variables such as current_product_id, user-level preferences, and agent-scoped memory reduce token noise and prevent context bleed between search, inventory, purchase, and product threads. This is a control issue as much as a software design issue because the wrong state boundary causes incorrect tool calls, stale answers, and overconfident hallucinations. Scoping state by workflow makes the assistant auditable and easier to govern.

Practical implication: model state as bounded workflow context and reset product-scoped variables when the user changes intent or subject.

Tool approvals and bounded autonomy at the gateway

An AI gateway can centralise model access, rate limiting, observability, and policy enforcement, but the important design choice is where autonomy stops. When the gateway sits at the boundary for models, tools, and MCP servers, it becomes the place to require approvals, scope tool permissions, and preserve audit evidence. That is especially important when the assistant can move from retrieval into fulfilment or purchase actions. The technical pattern is not full autonomy, but constrained delegation: the model reasons, the workflow decides, and the gateway governs execution. That is the difference between useful agentic behaviour and uncontrolled tool use.

Practical implication: enforce tool approval and policy checks at the gateway boundary before any agent can reach sensitive actions.


NHI Mgmt Group analysis

Deterministic-first design is the right default for AI assistants. The article reinforces a principle NHIMG sees repeatedly in agentic systems: if a task is predictable, agentic reasoning only adds cost and risk. A deterministic path reduces the opportunity for tool confusion, unnecessary context growth, and accidental overreach. For identity programmes, that maps cleanly to least privilege at runtime. The practitioner conclusion is to reserve autonomy for ambiguous tasks and keep known requests on a narrow execution path.

Explicit state is a governance control, not just an engineering convenience. The shift from implicit page context to explicit identifiers such as current_product_id is a model for how AI systems should carry context safely. Without explicit scope, memory starts to behave like ungoverned delegation, where the system carries stale assumptions into the next action. That creates the same kind of boundary failure NHIMG tracks in NHI and agentic AI programmes. Practitioners should treat state boundaries as policy boundaries.

Tool access in AI gateways now looks like delegated identity. Once a gateway brokers model calls, tools, and MCP servers, it becomes part of the identity plane even when the article does not frame it that way. The governance question is no longer only what the model can say, but what it can reach, with what context, and under what approval. That makes policy enforcement, auditability, and task scoping central controls. The practitioner conclusion is to govern agent tool use as runtime privilege.

State sprawl is the new governance debt in agentic applications. As assistants expand across search, inventory, fulfilment, and purchase workflows, the real risk is not one large model but many small uncontrolled assumptions accumulating across sessions. That is why workflow-based memory and explicit object references matter. The named concept here is state sprawl: context that expands faster than governance can bound it. Practitioners should design for bounded context from the start.

AI gateways are becoming the policy choke point for enterprise agents. The article shows why gateways are moving from plumbing to control plane. If the gateway cannot distinguish a safe deterministic lookup from a high-risk transactional action, the organisation loses the ability to scale agentic systems safely. This aligns with NIST AI RMF GOVERN and MANAGE concerns, especially around oversight and operational controls. Practitioners should place approval, logging, and scope enforcement at the gateway layer.

What this signals

State sprawl: as assistants expand from single-purpose flows into multi-product systems, context management becomes a governance problem. The practical signal for teams is to review where state is implicit today and decide which variables need explicit lifecycle control before the next capability lands.

The control question is no longer whether an AI system can call a tool, but whether the organisation can bound what that tool call means in context. That aligns closely with the NIST AI Risk Management Framework, particularly governance and management functions that demand traceability, oversight, and operational discipline.

Teams building agentic workflows should expect approval boundaries to move closer to the gateway and away from the model prompt. That reduces the chance that reasoning, retrieval, and execution collapse into one uncontrolled step.


For practitioners

  • Define deterministic paths for routine tasks Map clear-intent actions such as specifications, reviews, and coupons to direct tool execution so the assistant skips unnecessary reasoning cycles and reduces latency.
  • Reserve agentic reasoning for ambiguous workflows Use ReAct-style loops only when the task depends on intermediate findings, such as inventory resolution, store discovery, or fulfilment selection.
  • Scope state by workflow and product identity Separate user-level preferences from product-level context, and refresh downstream variables when current_product_id changes to prevent stale references.
  • Enforce tool approvals at the gateway boundary Require policy checks before agents can reach purchase, fulfilment, or other sensitive tool actions, and keep an auditable record of every delegated step.

Key takeaways

  • Deterministic execution is the safer default for known intents, while agentic reasoning belongs only where the path is genuinely uncertain.
  • AI assistants become harder to govern as state expands, which is why explicit context and workflow-scoped memory are now control requirements.
  • Gateway-level approval, audit, and policy enforcement turn delegated tool use into a governable runtime privilege model.

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 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 concerns agentic workflows, tool use, and bounded autonomy in AI assistants.
NIST AI RMFGOVERNThe article is about governance, accountability, and oversight of AI workflows.
NIST CSF 2.0PR.AC-4The assistant’s tool access and state boundaries are access-control concerns.
NIST SP 800-53 Rev 5AC-6Least privilege is directly relevant to agent tool access and gateway enforcement.

Assign clear ownership for agent behaviour, tool access, and escalation paths under GOVERN.


Key terms

  • Deterministic Workflow: A deterministic workflow is a fixed sequence of investigation steps that produces the same output when given the same inputs. In SOC automation, it reduces variability, improves auditability, and creates a stable evidence trail before any AI reasoning is applied.
  • ReAct agent: An AI agent that combines reasoning and action in a loop. The system plans, calls tools, observes results, and then revises its next step. In agentic environments, this pattern can expand access risk because decisions and execution happen together.
  • State Sprawl: State sprawl is the uncontrolled growth of context across users, products, tasks, and agent threads. It makes AI systems harder to govern because stale or unrelated context can influence tool selection, response quality, and follow-up actions, especially in assistants that handle multiple workflows.
  • Gateway Boundary: The gateway boundary is the control point where model calls, tool access, and policy enforcement intersect. When used well, it becomes the place to apply approvals, logging, and scope limits so the agent can act only within its intended runtime privileges.

What's in the full article

TruFoundry's full blog post covers the implementation detail this analysis intentionally leaves at the architecture level:

  • The exact ReAct step sequence used for inventory and purchase workflows, including planning, execution, and synthesis
  • The workflow map showing how product, search, inventory, and purchase states are separated in practice
  • The product reference resolution logic used when users say "this" or switch between multiple items
  • The performance trade-offs between deterministic routing and agentic loops under different latency and token-load conditions

👉 TruFoundry's full post details the workflow stages, memory model, and routing logic behind the assistant design.

Deepen your knowledge

The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, agentic AI identity, and secrets management in practical terms. It helps security and identity practitioners apply lifecycle and privilege controls to systems that now behave like delegated actors.
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