Set budget ceilings and choose what happens at the ceiling¶
Draft outline: not validated
Drafted with AI from official sources on 16 Oct 2026. Do not use on a live system until it is written, dry-run by someone other than the author and signed off (planned 2026-12-21). Author: Sandeep Velu · dry-run: Yasar · sign-off: Sivaraj. Work items: AGT-11-T13, AGT-11-T14, AGT-11-T15, AGT-11-T16.
1. Summary¶
At design time for every agent, when pricing a client engagement, and when a tenant asks for a higher tier.
Risk: Medium (ceilings set without data either block users or allow overspend). Typical duration: Half a day.
2. When to use and when not to¶
Use it when: At design time for every agent, when pricing a client engagement, and when a tenant asks for a higher tier.
Do not use it when: to be written by the author.
3. What you must know first¶
- OWASP LLM10 Unbounded Consumption covers runaway cost and denial of wallet
- Ceilings exist at three levels: code (steps and tokens per run), gateway (per tenant) and cloud budget (alerts only)
- At the ceiling, the options are stop, degrade to a cheaper model, or ask for approval
- Base per-run limits on p95 usage from evaluation, plus headroom
4. Options¶
Outline of the decision process; the author describes each option.
- Take p50 and p95 steps and tokens per task from evaluation runs.
- Set the per-run step and token ceiling at p95 plus agreed headroom.
- Set per-user and per-tenant daily or monthly ceilings from expected volume and contract value.
- Choose the action at each ceiling: stop, degrade or approval.
- Set gateway limits slightly above the code limits as a backstop.
- Set Azure budget alerts on the resource group as a last line.
- Record the policy and review it after the first month of production data.
Draft snippet: Budget policy with actions at each ceiling
{
"agent": "invoice-triage-agent",
"basis": {"evalRun": "eval/baseline_metrics.json", "p95StepsPerTask": 14, "p95TokensPerTask": 16000},
"perRun": {"maxSteps": 25, "maxTokens": 20000, "onLimit": "stop_and_park"},
"perUser": {"window": "daily", "maxTokens": 200000, "onLimit": "stop_with_message"},
"perTenant": {"window": "monthly", "maxTokens": 5000000, "onLimit": "require_approval", "warnAt": 0.8},
"gateway": {"tokensPerMinute": "{{tenant-tpm}}", "monthlyQuota": "{{tenant-monthly-tokens}}"},
"cloudBudget": {"scope": "resource-group", "alertsAt": [0.5, 0.8, 1.0], "type": "forecasted"},
"failMode": "closed",
"reviewAfter": "first 30 days of production"
}
Snippets to add:
snippets/governance/budget-policy.json: Budget policy for one agent (json)snippets/docs/budget-decision-table.md: Ceiling decision table (markdown)
5. Decision table¶
| Situation | Choose | Why |
|---|---|---|
| to be written |
6. Recommended default and when to deviate¶
To be written by the author from the outline above.
7. Known issues and fixes¶
| Symptom | Likely cause | Fix |
|---|---|---|
| Legitimate long tasks hit the run ceiling | Ceiling set from averages | Use p95 from evaluation and add a task-type override |
| Degraded model gives wrong tool calls | Cheaper model never evaluated | Run the regression gate on the fallback model first |
| Gateway blocks before code ceilings | Gateway limits lower than code limits | Keep gateway limits above code limits |
8. Monitoring and alerts¶
| Signal | Alert when | Action |
|---|---|---|
| Share of runs hitting the run ceiling | Above 2% in a day | Review the ceiling against current p95 data |
9. AWS and open-source equivalents¶
On AWS, combine code ceilings with API Gateway usage plans and AWS Budgets actions. Open-source gateways such as LiteLLM support per-key and per-team budgets.
10. Validation record¶
Pending. Planned dry-run scenario: A second engineer applies the guide to the sandbox agent's evaluation data and writes a budget policy. Pass: every ceiling traces back to p95 data or contract volume, gateway limits sit above code limits and the policy names an action per ceiling.
11. Sources¶
- OWASP Top 10 for LLM Applications 2025
- Tutorial: Create and manage budgets (Cost Management)
- Azure API Management policy reference: llm-token-limit