Agent/MCP Audit Sprint

LiteLLM spend control

LiteLLM Budget Guardrail

A focused checklist for teams using LiteLLM keys, per-user quotas, per-agent budgets, and per-team allocation. The risky part is not showing a chart. It is deciding whether the next agent call is allowed before money is spent, then reconciling the reservation against actual usage.

Budget enforcement is an admission-control problem

A LiteLLM dashboard can report spend after the fact. A production guardrail also needs a deterministic gate before dispatch: resolve the effective policy, reserve worst-case cost for the next call, and then refund or adjust when actual usage lands.

Audit dashboard visual showing review rows and status bands
PolicyUser, agent, team, model route, environment, and job scope resolve before dispatch
ReserveWorst-case next-call cost is reserved before the model request leaves the app
UsageActual token and cost usage reconciles against the reservation after completion
StateMissing price, missing usage, stale telemetry, revoked key, and admin override are explicit states
FailureParallel agents all pass the last-budget check and overspend
FailureTeam membership changes rewrite historical spend attribution
FailureStreaming or retried calls never emit final usage
FailureRevoked dynamic keys keep running in old agent jobs

What the review checks

The useful scope is one live or planned LiteLLM-backed workflow: key creation, quota resolution, pre-dispatch reservations, policy snapshots, budget blocking, dashboard stale states, and the tests that prove a billing edge does not become a launch incident.

Policy snapshot: each usage row keeps the resolved user, agent, team, model/provider route, environment, source job, and policy version.
Hard quota semantics: hard blocks happen before dispatch and return a structured reason, remaining budget, reset time, and escalation path.
Soft warning semantics: 50%, 80%, and 100% warnings do not silently turn into hard blocks or disappear during telemetry delays.
Unknown-cost behavior: new model alias, missing price, partial stream usage, 429 retry, timeout, and provider error choose fail-open or fail-closed deliberately.
Reconciliation: internal ledger totals reconcile daily against LiteLLM spend by key, model, team, and window, with stale or unreconciled UI states.

Acceptance test matrix

These tests make the budget feature harder to pass accidentally in a single-user demo while failing under real agent parallelism.

Two concurrent calls race at the final budget unit; only one dispatches or both reserve correctly.
A streaming call has partial output and no final usage event; the reservation remains visible and safe.
A retry storm after 429 or 5xx cannot multiply spend without fresh admission checks.
A user moves teams mid-window; old rows keep historical attribution while new calls use the new policy.
An admin override, revoked key, reset boundary, and price change all produce stable dashboard and API responses.

Package routing

Use the free calculator for rough monthly exposure. Use the paid review when quota behavior will ship to users, agents can run in parallel, or a cost incident is already visible.

USD $99: quick review for one LiteLLM quota design, key policy, or launch-pricing sanity check.
USD $299: focused review for one LiteLLM-backed agent or SaaS workflow with recurring cost risk.
USD $1,000: emergency sprint when current usage, retry loops, or routing drift already need containment.
Start rule: Payment only after written scope acceptance. No private prompts, API keys, customer data, or raw production traces in public issues.

Copy a safe intake packet

This packet is intentionally sanitized. It gives enough context to scope a review without putting prompts, secrets, customer data, or raw traces into a public issue.

Open intake
LiteLLM Budget Guardrail review request

Project or product URL:
Budget boundary: per-user / per-agent / per-team / shared-key / BYOK
Provider or model routes:
Current monthly request estimate:
Average input and output tokens:
Retry or streaming behavior:
Soft warning thresholds:
Hard quota behavior:
Known stale or missing usage states:
Key lifecycle concern:
Reconciliation source:
Requested package: USD $99 quick audit / USD $299 focused review / USD $1,000 emergency sprint
I will not include private prompts, API keys, customer data, or raw production traces in a public issue.
Payment timing: after written scope acceptance only.