By NHI Mgmt Group Editorial TeamBased on Apiiro: “The Cheapest Token Is the One You Never Spend” (July 23, 2026)

TL;DR: Using a Data Fabric through MCP cut token use by roughly two-thirds, reduced cost by about 10.6x, and made answers more consistent across repeated security and architecture questions, according to Apiiro. The finding matters because agentic programmes break when every invocation reconstructs context from scratch instead of reusing grounded system knowledge.


At a glance

What this is: Apiiro argues that grounded application context can make AI agents cheaper, faster, and more consistent than repeated codebase re-reading.

Why it matters: For IAM, NHI, and agentic AI teams, the key issue is governance of context and authority: agents that repeatedly reconstruct understanding create avoidable cost, inconsistent answers, and weaker auditability.

By the numbers:

  • The test found that total tokens fell from 197K to 64K when agents used the Data Fabric instead of reading code from scratch.
  • Apiiro reported that cost across 10 questions dropped from $30.69 to $2.89, about 10.6x cheaper.
  • Wall-clock time fell from 35.8 minutes to 16.1 minutes when the model queried grounded context.

Context

AI agents become expensive when they have to rebuild context from raw source every time they answer a question. In practice, that means repeated code reads, repeated reasoning, and repeated token spend for work the organisation has already done once.

This article is really about context governance for agentic systems: who controls the shared understanding the agent relies on, how current that understanding is, and whether the same question returns the same answer. That is an identity and access problem as much as a cost problem, because grounded context becomes the trust layer for AI agents and security workflows.


Key questions

Q: What breaks when AI systems reuse stale context after an error?

A: The main failure is loss of conversation isolation. Stale context can make unrelated replies look valid, which weakens user trust and can expose material from another session if the platform misbinds cache or parent-message references. The right response is to validate lineage, isolate session data, and test every error branch that can rebuild context.

Q: Why does continuous context matter for AI agent governance?

A: Continuous context matters because the security question is no longer whether an agent exists, but what it can do right now and how its behaviour is evolving. That includes runtime actions, permission drift, and sequence-based manipulation. Without live context, teams cannot reliably tell the difference between a theoretical weakness and an active compromise path.

Q: How can security teams tell whether agent answers are trustworthy?

A: Look for consistency, lineage, and stability under repeat questioning. If the answer changes with prompt wording or model path, the system is depending on opportunistic reconstruction rather than governed knowledge. A trustworthy setup returns equivalent answers, cites the same underlying systems, and keeps those systems current.

Q: Should organisations centralise context before scaling AI agents?

A: Yes, if the agents are being used repeatedly across the same repositories, policies, or risk data. Centralising context lowers duplicate compute, reduces variance, and makes the cost of the programme predictable. That is the difference between a few isolated pilots and an operating model that can scale.


Technical breakdown

Why repeated code reads inflate agent cost

A coding agent without a shared knowledge layer treats each question as a fresh investigation. It scans files, walks dependencies, and reconstructs architecture from scratch, which burns tokens on discovery before it has produced any useful answer. That is acceptable for one-off analysis, but it scales badly across many repositories and many queries. The cost curve is not linear because the same context gets rebuilt repeatedly for every prompt, model call, and agent instance. In a production environment, that makes cost and latency a property of the agent design, not just the model choice.

Practical implication: move repeated discovery work into a shared context layer before scaling agent usage.

How a graph-based context layer changes answer consistency

A pre-computed graph changes the agent from a source reader into a query engine over grounded system knowledge. Instead of reconstructing truth from a moving codebase, the model retrieves an answer from an always-current representation of software structure, dependencies, APIs, and risk findings. That reduces variance caused by prompt order, model pathing, and context-window size. The important point is not caching in the narrow sense. It is the separation of expensive understanding from cheap retrieval, which lets the system preserve lineage and answer repeatably across identical questions.

Practical implication: require grounded retrieval with traceable lineage for agent answers that inform security or compliance decisions.

Why MCP matters for agentic AI governance

MCP gives an AI agent a standard way to reach tools and data sources, but the real governance question is what it is allowed to consume through that channel. If the connected source of truth is stale, noisy, or poorly scoped, MCP simply makes weak context easier to reuse. When the connected context is curated and continuously updated, the same interface can support coding agents, CI agents, and security workflows without each rebuilding its own partial view. That turns context delivery into an operational control rather than an ad hoc integration choice.

Practical implication: govern MCP-connected context sources as security assets, not convenience integrations.


Threat narrative

Attacker objective: The operational objective in this pattern is not data theft but uncontrolled cost, inconsistent reasoning, and fragile trust in agent-generated outputs.

  1. Entry occurs when an agent is asked to answer a codebase or security question and begins reconstructing context from raw source instead of using a shared system model.
  2. Escalation happens as each new prompt repeats the same discovery work across files, repositories, and dependency paths, multiplying token spend and latency.
  3. Impact is economic and operational: the agentic programme becomes harder to budget, less deterministic, and less trustworthy for production use.

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

Grounded context is becoming the control plane for agentic AI. Once organisations move beyond demos, the main question is not whether an agent can answer a prompt, but whether it can answer from a shared and auditable understanding of the environment. That matters to security teams because every repeated reconstruction of truth increases cost, variance, and decision risk. Practitioner conclusion: treat context sources as governed assets, not helper features.

Deterministic retrieval is more important than model novelty for security workloads. Security and compliance use cases need repeatable answers, not merely plausible ones. A graph-backed knowledge layer gives the agent a stable reference point, which is closer to how IAM and PAM teams expect controls to behave. Practitioner conclusion: if the answer changes with prompt path, the system is not ready for trusted automation.

Agentic programmes will fail economically before they fail technically if context is not centralised. The article’s cost delta shows that per-query overhead, not model intelligence, becomes the limiting factor at scale. That is especially relevant where many agents need the same organisational knowledge. Practitioner conclusion: budget and design for shared context delivery before expanding agent count.

AI agent identity and authorisation depend on the quality of the data they are allowed to trust. In identity terms, an agent is only as governable as the context it can reach through tools like MCP. A poorly scoped or stale knowledge source can become a silent privilege amplifier, because the agent acts on it as if it were authoritative. Practitioner conclusion: align agent authorisation with governed context, not just tool access.

Grounded context creates an audit opportunity that raw prompting cannot provide. When answers come from a maintained Software Graph and Risk Graph, security teams can examine what the agent knew and how that knowledge was assembled. That is far better than inferring reasoning from a prompt log after the fact. Practitioner conclusion: prefer architectures that preserve lineage from source system to agent response.

From our research library:

  • Systems with least-privileged AI access had a 17% incident rate vs 76% for over-privileged systems. Organisations failing to scope AI access properly are 4.5x more likely to experience a security incident, according to the 2026 Infrastructure Identity Survey.
  • Gartner predicts that more than 40% of agentic AI projects will be cancelled by the end of 2027, citing rising costs, unclear value and insufficient risk controls.
  • Read next: Agentic AI Security Guide

What this signals

Grounded context will become a first-order design choice for agentic programmes. Teams that let every agent re-discover the same truth will see avoidable cost growth long before they hit technical limits. The practical shift is toward shared context services that are governed like security infrastructure, not treated like implementation detail.

Context lineage is now part of the trust model for AI agents. When the answer comes from a curated software graph, the real question is whether the graph is complete, current, and scoped to the decision being made. For IAM and NHI practitioners, this is the same governance instinct applied to a new runtime layer: who can rely on what, and under which conditions.

Contextual privilege is the new control point for agentic AI. Agents do not need broad access to raw systems if they can reach a maintained knowledge layer that answers their recurring questions safely. That is why governing MCP-connected sources matters as much as governing the agent itself.


For practitioners

  • Define a shared context layer for agents Map the code, API, dependency, and risk sources that every recurring agent question should use, then make that layer the default rather than letting each prompt rediscover truth.
  • Set determinism requirements for security answers Require repeated prompts to return the same materially equivalent result, and investigate any workflow where answer quality depends on prompt order or context-window luck.
  • Scope MCP connections to governed sources Allow agents to query only curated, current systems of record, with lineage attached to answers so teams can tell whether a result came from grounded context or ad hoc reasoning.
  • Budget agent programmes around reuse Measure token spend per recurring question, then compare the cost of repeated raw-source reads with the cost of maintaining a reusable knowledge graph.
  • Separate discovery from decisioning Let one controlled process build the environment model and let agents consume that model, rather than allowing every agent to perform its own independent reconnaissance.

Key takeaways

  • AI agents become expensive and inconsistent when every prompt forces them to rebuild understanding from raw source instead of reusing grounded context.
  • A shared software and risk graph can lower token spend, improve response consistency, and make agentic workflows more predictable at scale.
  • For security and compliance use cases, the governance problem is no longer only model quality. It is whether the system can supply audited, current context on demand.

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.

FrameworkControl / ReferenceRelevance
OWASP Agentic AI Top 10ASI03 — Identity & Privilege AbuseAgents querying governed context still rely on identity and privilege boundaries for safe tool use.
Recommendation — Limit agent tool and data access so retrieval through MCP cannot exceed approved identity scope.
NIST AI RMFGOVERN — AI Governance and AccountabilityThe article is about governing AI system behaviour through deterministic context and auditability.
Recommendation — Establish governance for context sources, answer lineage, and accountability before scaling agents.
CSA MAESTROAgentic AI threat modelingThe post concerns agentic workflows, shared context, and the control points around their operation.
Recommendation — Model agent interactions, context sources, and tool access as a system of trust boundaries.
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsAgent access to grounded context is an authorisation problem as much as an efficiency problem.
Recommendation — Constrain what context agents can query and align access permissions to the task being performed.

Key terms

  • Grounded Context: Grounded context is the trusted set of application, risk, or policy facts an AI system uses to answer questions. It is built from authoritative sources and kept current so outputs are repeatable, auditable, and less dependent on the model improvising from raw input.
  • Software Graph: A software graph is a structured model of code, APIs, packages, data flows, and related components. It gives agents and analysts a reusable view of the application landscape so they do not have to reconstruct architecture from scratch on each query.
  • Risk Graph: A risk graph overlays security findings, scanner output, and control data onto a software model. It helps teams connect vulnerabilities, sensitive data, and exposure patterns to the systems they affect, which makes retrieval and decision-making more consistent.
  • Deterministic Retrieval: A retrieval method that matches records by exact security observables rather than by approximate semantic similarity. In SOC workflows, it is used to bind a new alert to a verified prior case so the system can reuse evidence without guessing or inventing context.

Deepen your knowledge

NHI Foundation Level course covers NHI governance, agentic AI identity, and machine identity security, the industry's only accredited NHI security programme. It gives practitioners a practical way to connect identity controls to emerging AI and automation programmes.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 18, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org