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
- EvoCode adds 227-turn agent evaluation for changing requirements — _philschmid · 2026-07-27
- Nick Cammarata says AI code can do 97% of the job but still needs human judgment — morqon · 2026-07-27
- No-code job applications with customized resumes using Claude Code — Huge_Tea3259 · 2026-07-27
- Ezyang argues AI code only matters when it validates the result — ezyang · 2026-07-27
- Open-source MCP Testbed compares agent behavior across tools and skills — butaloto · 2026-07-27
- Community Buzz fork adds native Hermes Agent ACP integration and BYOH support — Teknium · 2026-07-27