Context Snowball: Re-processing Prior Information
AI agents, being stateless, repeatedly re-process entire conversation histories, tool results, and system prompts in multi-turn interactions, causing context to accumulate and making each step a recurring, token-intensive cost.
The top 3
- Agent Loop Costs: 10x More Than Simple Estimates: Naive AI agent loops re-bill previous context on every call, causing a 20-step run with 1,000 tokens per step to consume 210,000 input tokens instead of an estimated 20,000, underscoring a quadratic cost increase.
- Top 3 Hidden Token-Guzzlers in Agent Context: Key drivers of excessive context re-processing include system prompt duplication (e.g., 80,000 tokens for a 4K prompt over 20 turns), accumulating raw tool output payloads, and redundant re-retrieval of already-seen information.
- RAG vs. Long Context: Cost Break-Even at 10 Turns: While long context windows have growing per-turn costs, Retrieval-Augmented Generation (RAG) systems with external memory become cheaper after approximately ten interaction turns at 100k token context lengths, cutting input costs by 50-200x compared to pure long context.
Sources
Open the full topic