Guards already log every rejected agent proposal. Per-rule p-charts caught a model change on its first day while the overall rejection rate never left its limits.
A signal you are already logging
When an agent proposes an action at Belgavi's Book Store (issue a refund, open a return, reship an order) the proposal passes through deterministic guards before anything happens. One rule rejects refunds above the per-order limit. Another rejects proposals without a valid order number. A third rejects returns outside the return window, and a fourth rejects ISBNs that are not in the catalogue. Each rule writes a log line: proposal id, rule, accepted or rejected.
Those lines are usually read only when something goes wrong with a single case. In aggregate they are one of the cheapest behavioural monitors an agent system has. The guards do not change when the model or the prompt changes, so a shift in how often a rule fires is a shift in what the agent is proposing. Picture the scenario Dinky's team at the store wants to catch: a model upgrade doubles the number of over-limit refund proposals, and nobody notices for two weeks because the overall rejection rate barely moves.
This article turns the guard log into per-rule control charts, shows why the overall rate can hide exactly the change you care about, and sets out what a signal does and does not tell you.
Why per rule, not overall
Consider four rules with baseline rejection rates of 2, 6, 3 and 1 percent of the proposals each rule checks. Suppose a new model version makes the agent propose over-limit refunds twice as often (2 to 4 percent) while it gets better at including order numbers (6 to 4 percent). The total number of rejections stays almost the same. A dashboard that shows "guard rejections per day" shows a flat line.
The companion example simulates 28 days of 400 proposals a day, with the model change on day 15, and computes control limits from days 1 to 14.
| Rule | Baseline rate | After the change | Days outside limits (days 15 to 28) | Pooled z, new versus old |
|---|---|---|---|---|
| refund_over_limit | 0.0213 | 0.0416 | 4 of 14, starting day 15 | +6.17 |
| missing_order_id | 0.0584 | 0.0405 | 0 of 14 | -4.36 |
| return_window_closed | 0.0336 | 0.0293 | 0 of 14 | -1.30 |
| unknown_isbn | 0.0104 | 0.0086 | 0 of 14 | -0.98 |
| All rules together | 0.0309 | about the same | 0 of 14 | not applicable |
Two lessons sit in that table. The overall rate never leaves its limits, because the two real changes cancel. And even per rule, a daily chart catches the doubling of refund_over_limit on the first day after the change but not the drop in missing_order_id: a fall from 6 to 4 percent on 400 proposals a day is inside the daily noise. Pooling all decisions by model version finds both changes clearly.
The p-chart in a few lines
A p-chart is the standard control chart for a proportion with varying sample size. For each rule, the baseline period gives a centre line p-bar, the total rejections divided by the total proposals checked. Each later day with n proposals gets limits of p-bar plus or minus three standard errors.
def p_chart(decisions, baseline_days, z=3.0):
c = daily_counts(decisions) # (rule, day) -> [checked, rejected]
days = sorted({d for _, d in c})
out = {}
for rule in RULES + ('ALL',):
n0 = sum(c[(rule, d)][0] for d in baseline_days)
x0 = sum(c[(rule, d)][1] for d in baseline_days)
pbar = x0 / n0
points = []
for d in days:
n, x = c[(rule, d)]
s = math.sqrt(pbar * (1 - pbar) / n)
lo, hi = max(0.0, pbar - z * s), pbar + z * s
points.append({'day': d, 'n': n, 'p': x / n, 'lcl': lo, 'ucl': hi,
'signal': 'high' if x / n > hi else ('low' if x / n < lo else '')})
out[rule] = {'pbar': pbar, 'points': points}
return outThe limits widen automatically on quiet days. In the example, a day with only 40 proposals has limits from 0 to about 9 percent for refund_over_limit, so even a doubled rate of 5 percent that day cannot produce a signal; a day with 400 proposals has an upper limit near 4.3 percent. That is the correct behaviour, and it is also the reason to look at weekly or per-version pools when volumes are small.
Segment by what changed
A control chart tells you that something changed and when. The question that follows is always "what changed?", so every guard decision should carry the identifiers of whatever might have caused it: model id as returned by the provider, prompt or instruction version, tool schema version and the deployment that served it. With those fields, the comparison after a signal is a grouped count, not an investigation.
def compare_versions(decisions, a, b):
...
p = (x1 + x2) / (n1 + n2)
se = math.sqrt(p * (1 - p) * (1 / n1 + 1 / n2))
z = (x2 / n2 - x1 / n1) / seThe two-proportion z statistic is crude but adequate for a first look. With roughly 5,600 proposals per version per rule, the example's version comparison gives z of +6.17 and -4.36 for the two rules that changed and values between -1.3 and -1 for the two that did not.
What a signal means and what it does not
A rule firing more often is evidence that the agent's proposals changed. It does not say whether the change is bad. More over-limit refund proposals mean more customers asking for refunds the agent cannot issue alone, which might be a model that now misreads amounts, a prompt change that encourages generosity, or a real rise in damaged shipments from one warehouse. A rule firing less often can be good news (the agent learned to include order numbers) or bad news (the agent stopped proposing an action at all because a tool description changed).
So the response to a signal is a short, fixed procedure:
- Check volume and mix. Did the number of proposals or the share of a request type change? A sale week changes everything.
- Group the rule's rejections by model, prompt and tool version. If one version owns the change, you have your suspect.
- Read a sample of rejected proposals from before and after. Ten of each is often enough to see the pattern.
- Decide: roll back, fix the prompt or tool, or accept the new rate and re-baseline the chart.
Re-baselining is part of the method, not a failure of it. After an accepted change, recompute p-bar from a fresh period so the chart stops flagging the new normal.
False alarms and how many to expect
With three-sigma limits and a stable process, signals are rare but not absent. The example runs the same simulation 100 times without any change and counts 37 signals in 5,600 rule-days, a rate of 0.66 percent. With four rules checked daily, that is roughly one false alarm a month. That rate is higher than the textbook 0.27 percent for a normal distribution because rejection counts are binomial and skewed at low rates. If one false alarm a month is too many, require two consecutive days outside the limits, or chart weekly pools; both trade detection speed for quiet.
Where this fits in the architecture
This is observability built from the deterministic shell, not from the model. It needs no evaluator model, no labelled data and no sampling of conversations, and it keeps working when the model is a black box from a provider. It complements, rather than replaces, offline evaluation before a release and human review of samples after it.
| Signal source | Catches | Misses |
|---|---|---|
| Guard rejection charts | Changes in what the agent proposes that touch a rule | Bad proposals no rule checks |
| Offline evaluation | Regressions on known cases before release | Shifts in live traffic |
| Sampled human review | Quality problems with no rule | Rare events, slowly |
What does not change: the guards themselves stay deterministic and versioned. If a guard's threshold changes, its chart must be re-baselined at the same time, or the chart will report the guard change as agent drift.
When this is unnecessary
If the agent's proposals are reviewed by a person one by one, the reviewers already see the change. If the system handles a few dozen proposals a day, a daily chart has limits too wide to be useful; a weekly table of counts per rule and per version is enough. Control charts earn their place when volume is high enough that nobody reads every rejection.
Failure modes
- Logging only rejections. Without the count of proposals each rule checked, you have numerators and no denominators.
- Rules that short-circuit. If rule B only runs when rule A passes, a change in A changes B's denominator. Record which rules ran, not just which fired.
- One chart for all tenants. A single large customer can move the overall line. Segment by tenant or request type when the mix is uneven.
- Silent guard changes. Version the guard configuration and annotate the chart when it changes.