Define a budget the runtime can enforce
A token budget is only useful when it has a clear scope and a reliable signal. Decide whether the limit applies per agent, task, tenant, or time window, and identify how your deployment obtains usage and cost data. Provider pricing, retries, tools, and concurrent workers can all affect the final bill.
A budget policy should specify both the accounting source and the action taken at the threshold. Provider usage records may arrive after generation, while local estimates can be incomplete or use a price table that has changed. State whether the limit is a hard stop, a warning, or an estimate, and make that distinction visible to operators.
- Set a hard limit and a lower warning threshold.
- Aggregate concurrent work under the same task or tenant identity.
- Account for retries and in-flight work before deciding what to stop.
- Version pricing inputs and retain the usage events behind each decision.
Enforce policy close to the workload
A control plane can distribute policy, while a local runtime can apply the decision near the workload. FaultPlane Shield™ is described as a Rust and Linux eBPF/XDP protection layer for supported deployments, including traffic controls and configured spend limits. Confirm the exact policy inputs and enforcement behavior for your plan before relying on a limit as a billing guarantee.
Kernel packet filters are suited to network-level signals such as source, destination, protocol, and rate. They do not inherently know the semantic token count or provider price inside an encrypted model request. A spend limit therefore needs a trusted usage signal from the application, provider, or control plane; network filtering can complement that accounting, not substitute for it.
Choose an explicit response
When a budget is reached, decide whether to pause the task, reject new work, shed load, or require operator approval. Preserve enough task and audit context to explain the action. Abruptly cutting a stream may protect spend but can leave application work incomplete.
Make the response idempotent and observable. If several workers cross a threshold at once, they should not each launch a separate shutdown or retry loop. Emit the policy version, scope, observed usage, decision, and affected task identifier so teams can distinguish an enforcement event from an unrelated network failure.
Test thresholds and failure cases
Simulate a loop, burst traffic, and a delayed usage signal in a non-production environment. Check that the selected limit triggers at the right scope, that the event is visible in telemetry, and that a legitimate long-running run is not stopped by an overly broad threshold. Reconcile estimates against provider billing data before calling a budget exact.
Test boundaries around the limit, including concurrent requests, delayed usage updates, retries, and a tenant with more than one active agent. Verify the operator override and recovery procedure as well as the rejection path. Keep policy examples separate from deployable configuration until the runtime's accepted schema and enforcement guarantees are documented for the release you run.
Policy planning sketch
# Planning example only; the current daemon does not load this YAML file.
policy:
token_spend_limit_usd_per_hour: 50
standby_failover_mode: warm
ebpf_xdp_flood_guard: trueConfirm the supported policy schema and enforcement behavior for your runtime release before applying a production limit.