Three weeks after we put a text-to-SQL agent in entrance of our inside analytics workforce, somebody requested it to “clear up the check rows within the promotions desk.” The agent understood “clear up” as “delete,” understood “check rows” as something with a is_test flag or a reputation containing the phrase “check,” and generated a DELETE assertion that will have eliminated 40% of a desk that a number of dashboards trusted.
The DELETE assertion did not run as a result of we already had execution gated behind a human approval step for something that wasn’t a SELECT, largely as a result of somebody on the workforce had insisted on it in a design evaluation months earlier. That reviewer caught the question, requested one clarifying query, and the entire thing died within the queue. It was giving us good outcomes besides six weeks later the identical approval queue was the highest grievance in each retro. Analysts had been ready twenty, typically forty minutes for a human to look at a question and click on approve. Most of these queries had been nice and most of them had been the type of factor no one was ever going to reject.
A security mechanism that is too broad does not fail secure, it fails sluggish, and sluggish failure modes have a approach of getting quietly disabled by whoever’s beneath essentially the most stress to ship.
What’s on this article
-
The intuition that made everybody snug
-
The place the queue really broke
-
Routing by threat not by operation sort
-
What the router must see
-
The queue decoupled from the person
-
The place people added actual worth
-
Conclusion
···
The intuition that made everybody snug
The primary model of human oversight in nearly each agent system that I’ve seen seems the identical: any motion past read-only will get routed to an individual earlier than it executes. It is a straightforward rule to jot down and it is also simple to clarify to a safety evaluation, and for the primary few weeks it seems like precisely the suitable stage of warning.
It is also the model that scales the worst and the explanation is not actually concerning the people being sluggish. It is that the rule does not distinguish between a DELETE that touches forty % of a desk utilized by three dashboards and a DELETE of a single row a person requested for by main key thirty seconds in the past in the identical dialog. Each go into the identical queue and each wait behind no matter else is sitting there. The reviewer has no sign telling them which one deserves 5 seconds and which one deserves 5 minutes, so in follow they both deal with all the pieces with the identical shallow consideration or all the pieces with the identical extreme warning, and neither is what you really need.
···
The place the queue really broke
After some days the median approval wait had crept previous fifteen minutes, and the reviewers began approving the requests in batches, skimming 5 or 6 queries directly, dropping the evaluation high quality.
Individuals had been clicking approve on issues they hadn’t absolutely learn, as a result of the choice was falling additional behind and the queries largely had been nice, so the shortcut largely labored till it began failing. That is the failure mode that by no means exhibits up within the design evaluation and the oversight that is too broad does not get extra cautious beneath load, it will get sooner and shallower in precisely the way in which that erodes the factor it was constructed to catch.
I’ve heard this sample described as “rubber-stamp fatigue.” The mechanism is simple, vigilance is a restricted useful resource, and when you spend it on issues that did not want vigilance, you do not have it left for the one factor that did.
···
Routing by threat, not by operation sort
The repair we landed on wasn’t “make the queue sooner.” It was accepting that almost all agent actions do not want a human reviewer in any respect, and constructing one thing that might inform the distinction earlier than the motion reached anybody’s display.
Threat-based routing – It scores each agent motion towards a handful of indicators and solely escalates those that clear a threat threshold. Every part beneath that threshold executes instantly and no one has to the touch it.
That is the half folks discover uncomfortable after I describe this technique however the trustworthy query is not “ought to some actions execute with out a human,” it is “which actions had been you ever really reviewing fastidiously within the first place.” If the reply is “none of them, we had been rubber-stamping,” you have already acquired auto-approval, you are simply paying a fifteen-minute latency tax to faux in any other case.
A blanket human-approval gate on each write motion can turn out to be extra of a legal responsibility protect than an efficient security management. It seems like oversight in a design evaluation and the amount ensures no one’s really studying carefully by week three.
···
What the router must see
Getting the router proper took longer than constructing the queue, and it ought to as a result of the queue is plumbing, the router is the precise judgment name, simply automated and made express as a substitute of left to whoever occurs to be reviewing.
So we went again by the approval logs from these first six weeks and requested a easy query: on the queries that acquired flagged, what really separated those a reviewer caught one thing on from those that had been simply noise within the queue? 4 indicators saved exhibiting up:
Blast radius – Not “is that this a write” however “what number of rows does this contact, and the way reversible is it.” A DELETE scoped to a main secret’s a distinct threat class from a DELETE with a WHERE clause that resolves to 1000’s of rows, despite the fact that each are syntactically the identical assertion sort.
Early on we tried getting this quantity from EXPLAIN, and it burned us, planner row estimates get unreliable quick on skewed columns or correlated predicates, which is precisely the type of question an agent is more likely to generate with out realizing the info distribution. What we do now’s less complicated and extra trustworthy: run the question’s WHERE clause as an actual depend capped at a hard and fast ceiling, say, depend(*) as much as 50,000 rows, then cease counting. That provides us an precise quantity inside a bounded, predictable value, as a substitute of a guess dressed up as one.
Desk sensitivity – A static allowlist, maintained by whoever owns the schema. Tables touching billing, auth, or something with regulatory retention necessities get a flooring threat rating no matter what the question seems like. That is the one a part of the router I would by no means make purely discovered as a result of some tables ought to by no means be low-risk by default, and encoding that as a hard and fast rule is extra trustworthy than hoping a mannequin persistently picks it up.
Semantic distance from prior permitted queries – We maintain an embedding index of beforehand permitted question intents and verify how shut a brand new request sits to that set. A request that carefully resembles fifty prior permitted queries is a distinct threat than one which’s semantically novel not as a result of novelty is inherently harmful, however as a result of it is precisely the place an agent is almost certainly to have misinterpret intent.
Settlement throughout resamples – We tried utilizing the mannequin’s personal token-level confidence right here first, after which dropped this concept. LLMs are poorly calibrated about their very own uncertainty, and a mannequin can sound utterly assured whereas having misinterpret the request. What really labored, and it is cheaper than it sounds: regenerate the identical question two or 3 times at a barely larger temperature and verify whether or not the outputs agree. If they do not, that disagreement is a a lot stronger sign of actual ambiguity than something the mannequin stories about itself, and it catches the precise failure mode we cared about: requests the place the agent’s learn on intent might plausibly have gone two alternative ways.
The weights aren’t the purpose, yours will differ, and actually ours have moved twice since we first tuned them. The construction is the purpose: blast radius and desk sensitivity dominate as a result of these are the 2 indicators that really correlate with “one thing unhealthy occurs if that is fallacious,” and all the pieces else is there to catch what these two miss.
···
The queue decoupled from the person
The second half of the repair had nothing to do with the router and all the pieces to do with what occurs to the person whereas an escalated motion sits ready for an individual.
Within the naive model, the person’s request simply hangs, the agent goes quiet, the UI spins, and from the person’s facet there isn’t any distinction between “a human is reviewing this” and “the system is caught.” We moved to one thing nearer to a ticket mannequin: an escalated motion will get acknowledged instantly, the person will get informed explicitly that this one wants a glance and roughly how lengthy that often takes, they usually can maintain engaged on something that does not rely upon the result. The approval, when it comes, arrives as a notification relatively than one thing the person is sitting there watching.
None of this reduces precise evaluation time. What it does is cease evaluation time from studying as system failure. A forty-minute wait that is communicated up entrance and does not block anything feels utterly completely different from a forty-minute wait that appears like a grasp.
···
The place people added actual worth
As soon as the router had been dwell for just a few weeks, we might lastly have a look at the approval logs and ask the query that really issues: “on the queries that did get escalated, had been the reviewers catching something, or had been they nonetheless simply clicking approve?”
The sample that emerged was cleaner than I anticipated. Reviewers had been genuinely helpful on requests the place the agent’s interpretation of intent was believable however fallacious, a request phrased in a approach a human colleague would learn a technique and the agent learn one other. An individual catches this quick as a result of they are not evaluating SQL syntax, they’re evaluating whether or not “clear up the check rows” plausibly means “take away 40% of this desk,” and that is a judgment name fashions are nonetheless unhealthy at when the paradox lives in intent relatively than within the question itself.
They weren’t very helpful on requests the place the question was mechanically right and the paradox, if any, had already been resolved earlier within the dialog. A well-scoped UPDATE towards a single row, generated in response to an unambiguous instruction, sitting in a queue for a human to look at and approve, no one was including something there. We had been paying latency for a rubber stamp, precisely the failure mode that began this entire factor, simply now utilized to a smaller and better-chosen set of queries as a substitute of all the pieces.
Human evaluation delivers way more worth on ambiguous, high-blast-radius actions than on routine, low-blast-radius ones. Everybody already agrees with that sentence within the summary, nearly no one’s approval gate is definitely constructed round it.
···
Conclusion
None of this makes the evaluation downside go away, it strikes it. As an alternative of asking an individual to guage each write, we’re now asking a scoring operate to guage which writes deserve an individual, and that is a narrower, extra trustworthy query, nevertheless it’s not a solved one. The router weights want periodic retuning, and I do not but have a very good reply for the way usually. Question patterns drift because the product adjustments, the embedding index of “prior permitted intents” wants pruning or it begins treating previous, no-longer-relevant patterns as acquainted, and a router that was well-calibrated in month one can quietly drift into being too permissive or too conservative by month 4 with no one noticing till an incident forces a glance.
The plain subsequent step is to shut the loop, feed rejected and permitted outcomes again into the weighting routinely, so the router tunes itself. An automatic suggestions loop on a safety-relevant threshold is itself a factor that wants oversight, and there is one thing I do not belief a few system that will get much less cautious by itself, primarily based on nothing greater than a current run of uneventful approvals. That is often the precise situation beneath which the subsequent incident occurs. For now we retune by hand on a schedule with somebody what modified and why earlier than it ships. It is slower however I feel it is nonetheless the extra trustworthy trade-off.















