How to calibrate a budget¶
The budget needs numbers that fit your agent. The defaults (slack 1.0, alert_at 5, limit_at 10, block_at 20, baseline_n 50) are not a recommendation: on the simulated agent they produced high false-positive rates. Calibrate against your own clean traffic.
Procedure¶
- Collect a clean baseline period in shadow. The budget needs
baseline_nresults per agent before it scores anything. Calibrate during normal operation. A baseline taken during an incident makes the incident look normal. - Watch the score on clean traffic.
GET /v1/status(oraeon_status, orGate.status()) reports per agentcalibrated,deviation,accumulated,max_accumulatedandlevel. On clean traffic,max_accumulatedis how high the CUSUM wandered with nothing wrong. - Set thresholds above that, with margin.
alert_atshould sit above the largestmax_accumulatedyou saw on clean traffic. Then spreadlimit_atandblock_atfurther up. - Raise
slackif the score drifts upward on clean traffic.Sgainsd_t - slackeach step. If the average cleand_tis close toslack,Swanders. Raisingslackmakes it drain. - Use the envelope for hard limits.
p99_ms,error_rate,max_cost,max_tokensneed no calibration. Setp99_msfrom the p99 you observed with margin, and remember the window (default 50) is small, so a p99 over 50 samples is close to the maximum. - Validate with controls. Write a campaign with control runs and a
max_false_positive_rateyou accept, and run it with--runs 30 --controls 30or more. - Re-register after tuning. If you change the budget because a campaign failed, the old result no longer counts. Write the new thresholds into the campaign file before you run it again.
What I saw on the simulated agent¶
An exploratory run on the broken-schema campaign, 30 controls each time, same seeds. It is not a result: I tuned on the same scenario I measured on, and the scenario is not an LLM. It only shows which knobs matter.
| Budget | Detection | False positives on controls |
|---|---|---|
baseline_n = 30 (the campaign's setting) |
100% | 67% (20 of 30) |
baseline_n = 50 |
100% | 27% (8 of 30) |
baseline_n = 30, slack = 2.0 |
100% | 3% (1 of 30) |
baseline_n = 30, slack = 2.0, thresholds doubled |
90% | 0% (0 of 30) |
Two things to notice. A longer baseline helped a lot, because 30 samples of a very steady agent give a poor estimate of its spread. And the first row, 20 of 30, differs slightly from the committed result for the same campaign, 21 of 30 (an earlier run gave 22): the simulated agent sleeps for a few milliseconds per call, so latency-based outcomes move between runs even with fixed seeds.
Pitfalls¶
- A baseline of exactly zero errors makes one error a z of 10. That is correct for an agent that never fails and noisy for one that sometimes does.
- Very fast agents (sub-millisecond latency) hit the 1 ms floor on the latency spread, so most of the latency term comes from the floor, not from your data.
resetafter Safe State clears the window and totals, so p99 and error-rate checks go quiet untilmin_samplesresults arrive again.