Designing Agent Tool Loops Around Per-Call Cost, Not Frontier Assumptions

Most agent bills come from the loop, not the model. This short runs the arithmetic from the post: a ten iteration loop sends 69,100 input tokens against 1,800 output tokens, because every iteration re-sends the system prompt, the tool schemas and every tool result so far. Full write-up: https://hackyjs.com/posts/designing-agent-tool-loops-around-per-call-cost-instead-of-frontier-model-assumptions What's covered: - the four input token buckets, and why tool schemas are a fixed per-call tax - a per-call meter that logs input, cached and output tokens plus wall time - splitting the planner from the executor, with loop caps and escalation criteria - why per-call timeouts don't compose: 9.6 percent at ten calls, 55 percent at eighty Note: the post treats Muse Ember's parameter count, context window, pricing and benchmarks as unknown. The numbers here are loop arithmetic you can rerun against any candidate model, not model benchmarks.

aiagentsllmcost-optimizationtool-calling

Read the post →