Agent loops get pricey because every call repays the whole conversation history
Future_AGI · reddit · 2026-07-27
The post argues that agent costs are driven less by token price and more by repeated context reuse across loops.
Why agent runs get expensive
- Each call in a loop usually resends the original task, prior steps, and tool results.
- That means you keep paying for the same history again and again.
- In the example, a 20-step run averaging about 6,000 tokens per step would reach roughly 120,000 tokens for one task.
Practical takeaways
- Cost caps should be enforced before the next call, not after it.
- The limit should live in loop code or a gateway, not in the prompt, because the agent can reason around prompt instructions.
- The author recommends tracking cost per successful task, not just cost per token, since messy loops can destroy efficiency long before billing looks alarming.
The post ends by asking whether others cap agents per step, per run, or not at all.
Related event: Soaring Inference Costs Threaten AI Agent Adoption(2 posts)→
More from coding & agent
- Dev claims 20k more commits coming: Opus 5.5 and GPT-6 Sol supercharge his output — doodlestein · 2026-09-23
- A JEV-powered Wireshark classifier accidentally uncovered real backdoors on a home network — multiply_matrix · 2026-09-23
- 299 real intents tested: classifier routing trails GLM-4-Flash by 3 points but is 6.5x faster — Sufficient_Flower860 · 2026-09-23
- OpenExecutive: open-source virtual executive team of 8 specialist AI agents hits 5.1k GitHub stars — tom_doerr · 2026-09-23
- Framer launches Skills: teach your design agent reusable workflows, design systems and CMS rules — soleio · 2026-09-23
- Cursor, OpenAI and Anthropic shipped coordinator-agent fleets in one week, but the review bottleneck stays — omidfarhang · 2026-09-23