| Percentile | Steps | Cost / run | Daily fleet cost | Recommended max_steps |
|---|
Why average cost is the wrong budget
Agent loops don't run a fixed number of steps — they run until the task is done or a cap is hit. A coding agent that averages 8 tool calls can spike to 25 on a tricky refactor. If you only budget for the average, those long-tail runs either fail mid-task or blow your monthly bill.
P95 budget: covers 95 of every 100 runs. Good for non-critical tasks where occasional restarts are acceptable.
P99 budget: covers 99 of 100 runs. Right for production agents where incomplete tasks are costly.
Max_steps cap = P99: If an agent is still running at its P99 step count, it is almost certainly stuck in a loop. A hard cap here stops runaway costs without interrupting normal completions.
Compare with AI agent cost calculator, cost per resolved ticket, and API budget planner.