Why cap each agent run with a cost-per-task budget?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
A hard runtime cap on tokens, tool calls, or dollars per task. Without one, runaway loops turn $0.10 tasks into $100 bills because token cost grows quadratically with step count.
Imagine giving an assistant a credit card to buy office supplies. Most days they spend twenty dollars. One day they get stuck in a loop trying to find the perfect stapler, comparing models, ordering and returning, ordering and returning, and rack up a thousand-dollar bill before lunch. Setting a daily card limit of fifty dollars stops the disaster before it happens. A cost per task budget is that limit for an agent. Each task gets a hard ceiling on how many tokens, tool calls, or dollars it can use. The moment the agent hits the ceiling, the task stops, even if the answer is not finished, because the alternative is a five hundred dollar bill on what should have been a ten cent task.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define a cost per task budget as a hard cap enforced by the runtime. Explain quadratic cost growth from prompt accumulation. Name the four cap dimensions and what each guards. Stress runtime enforcement, not prompt-level instructions. Close on tuning caps from empirical task-cost distributions and the role of observability.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Believing token cost per step is the right unit to budget. Cost grows non-linearly because each step's prompt includes every prior step's history, so the right unit is total tokens or dollars per task, not per step.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.