Choose the right control
Use budget hard stops to cap customer usage.
Rollout path
- Confirm telemetry is trusted: customer, step, pricing, and dashboard events are visible.
- Start with alert-only rules or warn mode before hard stops.
- Use drafts for review before production activation.
- Activate narrow scopes first: one customer, one step, or one model path.
- Catch
PylvaBudgetExceededand return a product-specific fallback. - Monitor rule events, warnings, alerts, and budget behavior after activation.
- Expand scope only after the narrow rollout behaves as expected.
- Roll back by disabling the rule or moving it back to draft.
Pre-call and post-call
Pre-call controls can block or steer a call before provider spend happens. Budget hard stops, model routing, and reliability failover are pre-call controls. Post-call controls alert after usage is recorded. Cost thresholds and margin protection do not stop the provider call that already happened.Hard stops
Hard stops only block when the SDK has an active cached rule it can enforce safely. When a hard stop fires, the SDK raisesPylvaBudgetExceeded. Catch it and return a fallback such as a cached answer, smaller model path, queued job, “try again later” response, or human handoff.
Avoid retry loops that immediately reissue the same expensive call.