Retrieval and agent workflows expand the input side of the request by adding system prompts, retrieved context, tool results, and chat history. That matters because output is already more expensive per token, while input volume also grows fast. As prompts get longer and tool calls add more context, the bill rises even when the model price page stays unchanged.
Why This Matters for Security Teams
LLM spend is not just a finance issue. Once retrieval and agents are added, the application starts sending more context, more often, and sometimes to more than one model in a single workflow. That changes cost, but it also changes security posture because the same expanded context can include sensitive prompts, internal documents, tool outputs, and identity-linked session data. For teams using retrieval-augmented generation or autonomous tool use, cost growth often mirrors a broader governance gap around data minimisation, approval boundaries, and traceability.
That is why frameworks such as the NIST AI Risk Management Framework matter here: cost control, model risk, and operational control are linked. If retrieval is loose, the system may pull more text than the task requires. If agents are over-permissioned, they may trigger repeated tool calls that expand both token usage and exposure. In practice, many security teams encounter runaway LLM spend only after agent workflows have already become the default path for high-value tasks, rather than through intentional design.
How It Works in Practice
Retrieval increases spend because the model must process the user request plus whatever context is fetched from a vector store, search index, knowledge base, or document repository. Even when each retrieved chunk is small, the aggregate grows quickly as prompts are enriched with instructions, policies, chat history, and citations. Agents make this worse because they usually run in loops: plan, call tool, inspect result, retry, summarise, then act again. Each step can add another round of input tokens before a final answer is produced.
There is also an architectural effect. A single user interaction may now trigger multiple model calls across different tasks, such as classification, retrieval ranking, answer generation, validation, and re-ranking. That means the bill rises even if the visible answer looks short. Cost often becomes a proxy for control quality: excessive context may signal weak retrieval filtering, poor prompt design, or tool chains that are not bounded by policy.
- Shorten prompts by removing duplicated instructions and stale conversation history.
- Retrieve fewer, higher-value chunks instead of broad document dumps.
- Set limits on tool retries, agent steps, and maximum context length.
- Cache stable outputs where the workflow repeats the same subtask.
- Log prompt size, tool calls, and retrieval volume so cost spikes are explainable.
For threat modelling, the OWASP Top 10 for Agentic Applications 2026 and the CSA MAESTRO agentic AI threat modeling framework are useful because they frame the same workflow sprawl as both an operational and security problem. These controls tend to break down when agents are allowed to recurse across large knowledge bases and external tools because each iteration multiplies both token volume and uncertainty.
Common Variations and Edge Cases
Tighter retrieval and agent controls often increase engineering overhead, requiring organisations to balance user experience and automation depth against predictable spend and tighter governance. There is no universal standard for how much context is “enough,” so best practice is evolving rather than settled. For some workflows, a larger prompt is justified if it materially improves answer quality or reduces unsafe hallucination. For others, the same growth simply reflects poor prompt hygiene.
Edge cases matter. Long chat histories can dominate costs even when retrieval is modest. Some agents are cheap on the first call but expensive on the second because they re-read the same context after an uncertain tool result. Multi-model systems can also disguise spend: one model retrieves, another reasons, and a third validates, making the true cost harder to attribute. When retrieval includes confidential documents, the security question is not only what it costs, but whether the added context is necessary and properly access-controlled.
That is where identity and agent governance intersect. If an agent acts on behalf of a user or service account, the permissions attached to that identity should constrain which tools it can call and which data it can retrieve. The same design discipline is reflected in the OWASP Agentic AI Top 10 and the NIST AI 600-1 Generative AI Profile. Where teams see sudden cost jumps, the root cause is often a workflow that was built for convenience, then quietly allowed to scale without limits on context, tools, or trust.
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 CSA MAESTRO 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 |
|---|---|---|
| NIST AI RMF | GOVERN | Cost spikes reflect weak AI governance, unclear ownership, and unbounded workflow expansion. |
| NIST AI 600-1 | GenAI profiles cover prompt handling, evaluation, and operational controls that affect token spend. | |
| OWASP Agentic AI Top 10 | Agent Tool Misuse | Agent tool misuse can drive repeated calls, larger prompts, and uncontrolled spend. |
| MITRE ATLAS | AML.T0043 | Retrieval and agent pipelines can be abused through prompt injection and workflow manipulation. |
| CSA MAESTRO | MAESTRO helps model agent workflow risk, including multi-step tool chains and context expansion. |
Assign control ownership for retrieval and agent workflows, then set policy limits on context, tools, and logging.