The retrieval angle is the one most teams miss. Agents amplify whatever’s in the retrieved context, including the noise. If your vector store has stale chunks, fragments, duplicates, or low-quality content, the agent will retrieve them, reason over them, and either generate a bad answer or loop trying to compensate. Either way you pay token costs on bad inputs.
Some specific patterns that have helped me cut agent token costs without losing capability:
Tighten what gets retrieved before the agent sees it. If your default k is 10, ask whether you actually need 10 chunks per agent step. In my experience, well-curated corpora can drop to k=3-5 with minimal accuracy loss because the chunks that remain are the ones that actually contain the answer. Reducing retrieved context is the single largest cost lever in most agent pipelines.
Audit chunk quality, not just retrieval metrics. Pull a sample of chunks the agent has been retrieving over the last week. Read them. If a meaningful portion are fragments, boilerplate, or near-duplicates, your agent is paying input token costs on noise. Cleaning the corpus at ingestion typically saves more than tuning the retriever after the fact.
Check for stale documents that pull the agent into unnecessary loops. This is the failure mode the parent post is pointing at. If your agent retrieves a chunk that’s relevant-looking but contains outdated information, it may generate a partial answer, recognise the gap, retrieve again, and loop. Each loop costs tokens. Freshness signals on chunks (source last-modified, version metadata) let you filter or demote stale content before it reaches the agent.
Cap context length per agent step. Not just total cost — per-step. Long context windows are expensive per token and accuracy on retrieved content actually degrades as context grows. Aggressive context budgeting forces the retrieval layer to surface the highest-signal chunks, which is a healthy constraint.
Cache aggressively at the retrieval layer, not just the model layer. If two agent steps retrieve the same chunks, you should serve from cache rather than re-running the embedding similarity search. This is cheap to implement and rarely done.
The structural point: agents are expensive partly because they multiply the cost of every retrieval mistake. A bad chunk in a single-shot RAG query costs one wrong answer. A bad chunk in an agent loop can cost dozens of token-burning steps as the agent tries to reason around incomplete or misleading information. Fixing the upstream data is almost always cheaper than optimising the agent’s reasoning.