Agentic AI
Taming token costs: architecting efficient multi-agent AI systems
Production AI deployments reveal the real expense isn't the model—it's the repeated retrievals, oversized contexts, and unnecessary tool calls that accumulate across agent workflows.
The New Stack
Most teams operating AI agents at scale encounter the same realization: model licensing fees pale beside the actual operational cost. The true drain emerges from redundant document retrieval, duplicate system prompts, bloated context windows, and multiple agents reprocessing identical information. Each inefficiency seems minor in isolation, but they compound into substantial latency, infrastructure overhead, and cloud expenses once deployed across enterprise workflows.
While a prototype handling 50 daily queries can absorb these inefficiencies, systems managing thousands of concurrent requests cannot. Effective token optimization requires treating it not as a prompt-writing exercise but as an architectural challenge spanning the entire pipeline.
The architecture-first approach#
Token consumption is fundamentally a systems problem, not a language-model problem. A typical multi-agent workflow funnels user requests through an intent detector, retriever, multiple reasoning agents, and a final reviewer—with each stage potentially fetching the same documents and regenerating identical instructions. By delivery, the system has consumed tens of thousands of surplus tokens.
The solution reshapes the flow entirely. Rather than sending requests directly to an LLM, a production system first routes simple queries away via deterministic logic, then checks a cache layer, applies a context budget before retrieval, and only then invokes the model as a final, expensive step. "The large language model is no longer the first component. It is the final, most expensive operation."
Key optimization techniques#
Single-pass retrieval: Most multi-agent workflows redundantly search for the same documents across stages. Retrieving once and sharing that context downstream eliminates duplicate API calls and token usage.
Semantic caching with exact-match: Rather than complex similarity-based caching, an exact-match approach on question-plus-sources pairs returns cached responses for identical queries, bypassing the model entirely on repeated questions.
Context budgeting: Establish a strict token ceiling per retrieval (e.g., 2,500 tokens). Rank documents by relevance and truncate the set when the budget fills, preventing over-stuffed context windows.
Intelligent model routing: Reserve large, expensive models for genuinely complex reasoning. Route shorter, simpler questions to smaller, faster alternatives. This shift can dramatically reduce costs without quality degradation.
Deterministic logic answers some queries without model involvement—checking a metrics dashboard for status updates or returning a runbook excerpt. Routing these requests away from the LLM yields the largest single savings in production systems.

