Teams watch their model spend and forget the other meter running: every document chunked, embedded, re-embedded and retrieved costs money, and retrieval-heavy agents can quietly spend more on plumbing than on thinking.
The short answer
Put retrieval under the same authorisation discipline as model calls: count embedding and vector-store operations as actions with estimated costs, cap re-indexing jobs like any other spend, and make re-embedding a deliberate, budgeted event rather than a side effect of a config change. Watch the ratios — retrieval calls per answered task, chunks embedded per document version — because RAG cost failures announce themselves as ratio changes long before they announce themselves as invoices.
Check your own setup as you read: run the free Spend Guard self-check or test a policy in the playground — five minutes, no signup, and the gaps it names map to the controls below.
Worked example: the chunking change that cost $870 overnight
Aldergrove Health, a fictional occupational-health provider, ran a policy-answering agent over 9,000 internal documents. A well-meant improvement reduced chunk size from 1,000 tokens to 250 to improve answer quality, which quadrupled the chunk count — and the indexing pipeline, set to rebuild on any config change, re-embedded the entire corpus overnight: 1.9 million chunks, $870 in embedding calls, plus a day of degraded answers while the new index settled. Nobody had priced the change, because embedding spend lived on a different dashboard from model spend.
Aldergrove unified the meters. Embedding and retrieval calls now pass through the gateway with estimated costs under the agent's identity; full-corpus re-indexing is a named action class with its own budget ($150) and an approval step that shows the estimated price before it runs; and chunking changes require a canary — 100 documents first, ratios reviewed — before any full rebuild. A later embedding-model migration was priced at $640 in advance, approved deliberately, and run over a planned weekend at $618 actual.
Retrieval is spend, so authorise it like spend
Anything metered by a provider is spend, whether or not it appears in the chart you watch. Embedding calls, reranking, vector-store operations and external search tools each carry per-call prices that multiply with corpus size and query volume. Bringing them under the agent's identity and caps does two things: the total cost of the agent becomes honest, and the runaway shapes specific to retrieval — full re-indexes, retrying embedders, retrievers that fan out to fifty searches per question — hit the same walls as a model loop.
Re-indexing is a batch job; budget it like one
A full re-embed is not maintenance, it is a purchase: corpus size times chunk count times unit price. It should be estimated before it runs, approved above a threshold, and scheduled rather than triggered as a side effect. The trigger discipline matters most: config changes, embedding-model updates and pipeline deploys should propose a re-index, show its price, and wait — never silently commence one at 2 a.m. because a default said rebuild-on-change.
Chunking and retrieval settings are pricing decisions
Chunk size, overlap, top-k and reranking depth all trade answer quality against cost per query and per index, multiplicatively. Treat changes to them as pricing changes: canary them on a slice of the corpus, measure cost per answered task and answer quality together, and record the decision. Aldergrove's quality improvement was real — and would have been adopted anyway at a planned $870 with a weekend to settle, instead of as a surprise with a day of degraded service.
Watch ratios, not just totals
Retrieval failures are ratio-shaped: retrieval calls per task doubling means the retriever is thrashing; chunks per document jumping means a config changed; cost per answered question creeping up 5 percent a week means the corpus or the query mix is drifting. Put the three ratios on the same review as spend per successful task. Totals tell you the quarter hurt; ratios tell you which knob turned, while turning it back is still cheap.
A pre-flight price check for corpus changes
Adopt one habit: no corpus-wide operation ships without a written estimate attached to the change. The estimate is three numbers — documents affected, chunks per document under the proposed settings, unit price — multiplied out and compared with the action's budget. It takes ten minutes and converts the most common RAG incident into a routine approval. Keep the estimates and the actuals together; estimation accuracy improves quickly once someone is scored on it, and within a quarter your team will price a re-index the way a builder prices a job — from the last three similar jobs, not from optimism.
Five actions to control retrieval and embedding costs
- Bring embedding, reranking and search calls under the agent's identity with estimated costs in the gateway.
- Make full re-indexing a named, budgeted action class that shows its estimated price and needs approval above a threshold.
- Remove rebuild-on-change triggers; let config changes propose a re-index, never commence one silently.
- Canary chunking and retrieval changes on a small corpus slice, measuring cost per answered task alongside quality.
- Review retrieval ratios weekly: calls per task, chunks per document, cost per answered question.
Source note and related guides
Figures in the worked example are illustrative, drawn from a fictional company created for this guide; the controls, failure patterns and procedures described are the gateway's documented behaviour — see the Agent Auth Gateway documentation and the policy patterns in allowlists vs denylists, spend caps and the agent kill switch. Reviewed by the Ingenious AI team, 2026-11-14.
Sources
- NIST AI Risk Management Framework (AI RMF 1.0), the voluntary framework for managing AI risk across design, development and use: nist.gov, 2023
- OWASP Top 10 for Large Language Model Applications, the OWASP GenAI Security Project's risk list for LLM and agent systems: owasp.org, 2025
- RFC 6749, The OAuth 2.0 Authorization Framework, the IETF standard behind scoped, expiring access tokens: rfc-editor.org, 2012