WorksEngineering
Controller-Agnostic Runtime Safety Certificates for Tool-Using AI Agents via Data-Driven Robust Reachability
Abstract
Software agents built on large language models act by issuing tool calls, some of which cannot be undone. To control theory the model is an opaque feedback controller, replaced every few months, whose closed loop cannot be analyzed directly. We propose a runtime filter, or shield, between any such controller and its environment that certifies a bound on the probability of reaching an unsafe condition during a bounded task. Given a predicate abstraction and candidate successor sets, everything else comes from logs: the loop becomes a finite controlled Markov chain, the estimated kernel is surrounded by a distribution-free confidence region, and robust reach-avoid value iteration runs over it. The certificate is probably approximately correct and uniform over controllers respecting the filter, so one model may replace another without recomputation. In all tested datasets the true risk stayed within certificate and budget; in a file-system sandbox the filter stays sound against a hazard the logs barely covered, where a plug-in baseline certifies safety and fails; and it holds seven controllers, three of them open-weights models, to zero unsafe outcomes in 1050 episodes.
Introduction
A new kind of autonomous system is asking for the control community’s attention. Agents built on large language models [1], [2] take a goal in plain language and pursue it by picking a tool call, seeing what comes back and picking again until done. To a control engineer, the model is a feedback controller and the surrounding software the plant.
Two things make the loop awkward for the classical toolbox. First, some actions are irreversible. A deleted database or a wired payment cannot be taken back, so what must be bounded is the probability one is ever triggered before the task ends, a finite-horizon reach–avoid requirement. Second, the controller is opaque and replaced within months, so any argument tied to its identity is obsolete almost as soon as written.
Together they rule out most existing machinery. Barrier-function and predictive safety filters [3, 4, 5] and Hamilton–Jacobi reachability [6] start from a dynamical model, supervisory control [7] gives only logical guarantees, and policy-specific verification must be redone when the controller changes [8]. What agents do offer is data. They all log state, action and outcome, inviting a data-driven treatment as in [9].
So we ask whether any LLM agent can be wrapped in a thin filter, built from logs with no known transition probabilities or training, guaranteeing a chosen ceiling on the probability of an unsafe outcome within a bounded task, certified once for every controller respecting it. Given predicates making the loop Markov and each call’s possible outcomes, it can.
Contributions. This letter makes the following contributions.
A plant model for an agent. A few engineer-chosen Boolean facts turn the agent loop into a finite controlled Markov chain with a reach–avoid specification (Sec. II).
A certificate from ordinary logs. A robust reach–avoid bound on the risk of irreversible harm, computed over a distribution-free confidence set, is valid with chosen confidence for every controller the filter admits (Sec. III).
A synthesis procedure. It seeks the least restrictive filter meeting the risk budget (Sec. IV).
Validation. We check the certificate against ground truth, compare our filter with four alternatives, and test one filter, built from a scripted agent’s logs, with that agent and three open-weights language models [10] (§ 5).
Proofs of all results are given in the Appendix.
Relation to data-driven robust MDPs and shielding. Suilen et al. [11] maintain Bayesian intervals on an uncertain MDP; Badings et al. [12] lift PAC intervals to an interval MDP; Reed and Lahijanian [13] build one deep-kernel regression, computing a maximally permissive safe-policy set. Closest, Hamel-De le Court et al. [14] shield robust MDPs against a safety-LTL threshold; on the RMDP their shield is sound and optimal, admitting exactly the safe policies. We claim no novelty in uniformity over controllers, which shielding supplies by construction. What differs is the data, as most acquire samples through a scheme they control, and where a passive stream is admitted [11] the uncertainty is Bayesian, not distribution-free. Ours is a narrower, distribution-free construction for ordered, passively collected traces with adaptive, uncontrolled visitation and explicit vacuous treatment of under-covered rows, feeding a robust finite-horizon shield. Ray [15] concurrently asks what a gate can enforce at all, a question of enforcement rather than certification. Table I sets these beside this letter.
The Agent–Environment Loop as a Controlled Markov Chain
This section models the agent loop as a finite controlled Markov chain with a reach–avoid specification.
| Work | Data | Uncertainty set | Guarantee ranges over | Spec. | Guarantee |
| Suilen et al. [11] | interactive or streamed | Bayesian intervals | the synthesized policy | temporal logic | credible |
| Badings et al. [12] | prescribed samples | PAC intervals (iMDP) | the synthesized policy | reach–avoid | PAC |
| Reed and Lahijanian [13] | queried samples | kernel intervals (iMDP) | a maximal safe-policy set | safety | probabilistic |
| Hamel-De le Court et al. [14] | simulator, per-pair budget | Clopper–Pearson | every compliant policy; all safe admitted | safety LTL | PAC, sound + optimal |
| This letter | passive, adaptively visited logs | distribution-free balls | every admissible controller | reach–avoid, HALT | PAC, distribution-free |
Table 1. This letter and the closest prior work. Ours differs mainly in its passive, adaptively visited logs and distribution-free uncertainty set.
From transcripts to a finite state machine
The controller is a language model whose natural state is the whole transcript , every prompt, call and reply so far, an unbounded object. We replace it with a short list of Boolean predicates chosen for the application, such as “holds write capability,” “inside a protected directory,” “an irreversible call has executed.” The map sends a transcript to the truth values of these predicates, so the abstract state lives in a finite set with . Actions are a finite catalog of tool-call types, , one of which, HALT, hands control to a human and ends the episode safely. An action may refine a tool name by safety-relevant argument classes; any dependence left out of must appear in the abstract state instead.
Assumption 1 (Abstract Markovness). There is a kernel with , , at every and for any history-dependent . Hence, given the current abstract state and action, the next is independent of the rest of , with a kernel independent of .
That is, once the predicates and the action are known, the rest of the transcript says nothing more about where the system goes next, even though the controller may have used it to choose the action. The analysis rests on this assumption, so the predicates must be rich enough to make it hold; Experiment 4 tests it on logs, and Prop. 2 bounds the cost of a violation.
Assumption 2 (Irreversibility). There is an unsafe set (a harmful/irreversible call has occurred); each is absorbing, for all .
Assumption 3 (Safe stop). A distinguished sink is absorbing and safe. From every non-unsafe, non-sink state, HALT leads to it,
(Unsafe states remain absorbing under every action, including HALT, by A2.)
Assumption 4 (Controller-independence). depends only on , not on which controller selected .
A2 and A3 say only that harm cannot be undone and stopping is always possible. A4 lets one certificate serve every controller, since a file system answers “delete” the same way whoever issued it, provided the action or the predicates record every argument that matters, such as the path. Environments that adapt to the agent’s identity are excluded.
Controller, shield, admissibility. A controller is any nonanticipative rule for the next action, a family of kernels that may depend on the entire transcript, vary with time and randomize. A language model is one. A shield is a map listing the actions permitted in each abstract state, always including HALT. A controller is admissible, written , if for all , that is, if every action it executes is permitted. The shield constrains only what is executed; how a forbidden proposal is handled is a separate choice, and Sec. V uses three, namely restricting the agent to permitted actions (the random and adversarial controllers of Experiment 1), replacing the proposal by HALT, which ends the episode (its competent controller), and blocking it and asking again, with HALT on the fourth consecutive refusal (the language models of Experiment 3). Each makes the agent plus its rule a nonanticipative controller whose executed action lies in . A blocked proposal causes no transition, does not advance the step count, which counts executed calls, and leaves unchanged, as the predicates record facts about the environment. That composite is admissible and is the every result below concerns, immediate HALT substitution being the case of no second attempt. The shield is thus a supervisory controller [7, 8] between a stochastic plant and a black-box decision maker.
The finite-horizon reach–avoid specification
The quantity we certify is the probability that the loop ever reaches an unsafe state within the task horizon. Fix a horizon and a start , . For admissible and kernel the unsafe-reach probability is
Since unsafe states are absorbing this is the probability of ever entering within steps. Not knowing which controller will run, we control the worst case over all of them,
a supremum over every nonanticipative admissible controller, which collapses to a state-feedback recursion.
Lemma 1 (Worst-case reach–avoid value). Under A1–A3, for every and the worst-case value is produced by and, for ,
with on , . The supremum in (2) is attained by a deterministic Markov policy .
Equation (3) is ordinary reach–avoid value iteration [16]. At each state the worst controller picks the permitted action with the highest chance of eventual harm, and no history-dependent or randomized controller can do worse. With known this would finish the problem. But is unknown, and the rest of this letter certifies an upper bound on (2) from logs.
Data-Driven Robust Reach–Avoid Certificate
We replace the unknown kernel by a confidence set built from the logs, the analogue of an uncertainty set in robust control, and run value iteration against its worst kernel; the result bounds (2) with high probability.
Estimating the kernel from adaptively collected logs
The data are logged episodes of abstract state, action and next state. Each pair , a row of the transition matrix , is visited times; is the successor recorded at the -th visit, and the natural estimate of is their empirical distribution. The difficulty is that the logs are collected in closed loop. As in closed-loop identification, which rows are visited, and how often, depends on earlier outcomes. Hence is random and correlated with the very successors being averaged, and a confidence bound for a sample of fixed size cannot simply be evaluated at .
We avoid this by construction. Before any data are seen, the protocol commits to a per-row budget , and the estimator uses exactly the first successors at each row, discarding the surplus. Thus with truncated counts , and . The count only shows whether the budget was met; a row that falls short takes the vacuous set below, which contains every kernel, so a missed budget loosens the certificate but never invalidates it. The budget must be fixed from design constants before any log is examined, since choosing it after seeing the counts would reintroduce that dependence; for a retrospective log a time-uniform confidence sequence or a holdout is safer.
We also assume a mild structural prior. For each row a candidate successor set of size is known, meaning what a tool call can return, though not with what probability. Enlarging is always safe, since the confidence set only grows and still contains the truth, whereas omitting a possible successor breaks the guarantee. The size of affects only how tight the certificate is. The radius grows like with the number of candidate successors, since , and roughly doubles it on our grid.
For i.i.d. samples on outcomes, Weissman et al. [17] give an analogue of Hoeffding’s inequality,
Setting the right-hand side to (a union bound over the rows) and solving for gives the per-row radius
and, for a stochastic row (one with candidate successors), the confidence set (an ball intersected with the simplex)
A deterministic row, , has nothing to learn. The factor vanishes, and , as for HALT. A row with takes the vacuous set .
Inequality (4) assumes a fixed sample size. The next lemma, the core of the construction, shows that the committed budget keeps (5) valid for closed-loop logs. With probability at least , every confidence set contains its true row (event ). The lemma also covers an approximately Markov abstraction.
Lemma 2 (Uniform validity). Let , supported in , be the conditional law of the successor at the -th visit to given the past, and let . With probability at least over the logs, for all at once. Under every equals , so this reads .
Proof sketch (see the Appendix). Whether a visit is among the first is fixed before its successor is drawn, so for each the terms are martingale differences of range one; Azuma–Hoeffding and a union bound over the nontrivial sets and the rows give (5) without independence.
Robust value iteration
Lemma 1 took the worst case over controllers for a known kernel. We now also take the worst case over the kernels the data cannot rule out. Define , and, for ,
with on , , and the support function
the largest one-step value any kernel in the confidence set could produce. Equation (7) is robust dynamic programming [18] for reach–avoid; its only nontrivial step, (8), is a linear program over an ball simplex, solved in closed form by shifting mass toward the riskiest successors.
Proposition 1 (Inner oracle). Let and order the support so is nonincreasing. Then (8) equals plus the gain from moving at most of mass from the smallest- entries of to the largest, capped by donor and receiver capacity and stopped when no strictly value-increasing transfer remains; the moved mass may be zero, as at , . It costs .
The certificate
Theorem 1 (PAC controller-agnostic safety). Under –, the support condition and the sets (6), with probability at least over the draw of the logs, for every , every and every admissible controller ,
In particular, if the shield satisfies , then
Hence, with confidence over the logs, any controller behind the shield reaches an unsafe state with probability at most , computed from the logs and the shield, not from . As the bound is uniform over admissible controllers, a new model can replace the deployed one without recomputation. The certificate belongs to the interface, not the model.
Corollary 1 (Sample complexity and rate). Let be the rows an in-shield trajectory from can visit and . Suppose , so
uniformly on . On the event of Lemma 2 and on the event that every row of meets its committed budget, .
Coverage is essential here, since a relevant row missing its budget stays vacuous and the gap need not shrink.
Corollary 2 (Validity under data-dependent synthesis). The event depends on the data only, and on the domination holds for every shield at once. Hence (10) survives replacing by any data-dependent with , in particular the output of Alg. 1. No sample splitting is required.
More logs tighten the bound at the usual rate if they cover the relevant rows, a condition akin to persistent excitation, and the shield may be chosen from the logs that certify it. The next result bounds the cost of violating A1.
Proposition 2 (Residual history dependence). Drop A1 and assume instead that at every row the history-conditioned laws vary little, in that and for all reachable with . Let run (7) over sets of radius . Then with probability at least over the draw of the logs, every admissible controller obeys .
Like a bound on unmodeled dynamics, is a declared tolerance. One states how far from Markov the abstraction may be, pays , and checks this on the logs (Experiment 4).
Least-Restrictive Shield Synthesis
Theorem 1 certifies any shield with ; the question is which to deploy, and one always qualifies.
Proposition 3 (Well-posedness). For , the all-HALT shield yields , so the set is nonempty for every .
That shield is safe and useless; we want the one that forbids as little as possible while still certifying, that is, a solution of (11) where measures how much the agent keeps. Forbidding an action can only lower , so forbidding more from a certified shield keeps it certified, but choosing which actions to forbid is combinatorial. We proceed greedily, forbidding one action at a time, the one buying the most safety per unit of autonomy given up, until a removal meets the budget. Alg. 1 always returns a certified shield, since within removals it meets the budget or reaches all-HALT (Prop. 3); optimality is not claimed. Two choices make it effective.
(i) Which action to forbid first. Counting removals is the wrong measure, since the cheapest way to make the start safe is to wall it off. We instead weight each action by how often a goal-directed reference policy uses it, with its state–action occupancy, and rank removals by risk reduction per unit cost . An action the task never uses costs nothing to forbid, so it goes first; inward step-into-hazard moves are exactly such actions, which is why the synthesizer fences the hazard (Figure 1b) rather than moats the agent.

Figure 1. The grid benchmark and the shield of Experiment 1. (a) Each of the cells is an abstract state of a tool-using agent; the red block is the unsafe set , so the start and the star are the goal. (b) Certified worst-case reach probability for each grid cell (color) and forbidden moves (black segments). The shield fences the hazard instead of walling in the start, so a route to the goal remains, and the risk from is certified below the budget (, , ).
(ii) Keeping the task reachable. A fence removes one action at one state, never a state. Every state keeps HALT, so the shield never leaves the agent without an admissible action; that much is guaranteed. Beyond it, Alg. 1 prefers removals keeping the goal reachable from , falling back only when no risk-reducing alternative does; in Figure 1b that preserves a route, and the agent travels around the fenced block to the star without ever proposing a forbidden call.
Each iteration evaluates all candidate removals in one batched value iteration; on the instances of Sec. V, synthesis takes a few seconds per shield on one CPU core.
Numerical Experiments
We use two environments of our own. On a small grid the true kernel is known, so the certificate can be checked exactly (Experiments 1 and 2). A file-system sandbox mirrors the motivating application (Experiment 3), and Experiment 4 tests the Markov assumption. The synthesizer sees only sampled logs; code is at https://github.com/SAILRIT/Agent-shield-certificates.
A grid with known ground truth
In the grid of Figure 1a each of the cells is an abstract state, the central block is , a sink models HALT, and start and goal are opposite corners. Moves slip with probability ; and . Each row gets the budget , of an even share of the transitions. Without a shield, the worst controller reaches with probability about .
Experiment 1 (soundness). A shield synthesized from episodes with certifies 0.072; its exact worst-case risk is 0.009. Three controllers run through it, episodes each. An adversary playing the worst admissible policy reaches in 0.010 of them, close to that exact value; competent and random controllers record 0.000.
Recomputed from more logs, this shield’s certificate falls from 0.189 at episodes to 0.023 at , and its excess over the exact value has a log–log slope of , faster than the of Cor. 1. Discarding the surplus samples has a price. The shield forbids 50.5% of live state–action pairs, against 25.5% if all samples could be used, and at an average of 1.5 of 200 rows miss their budget.
Experiment 2 (validation across datasets). The certificate is a claim about the random draw of the logs, so we test it that way. At each sample size we draw 100 independent datasets, synthesize a fresh shield from each, and compute its exact worst-case risk. The true risk stays within both certificate and budget in all 100 trials at each (Table II), consistent with 95% confidence. It rises with , from 0.002 to 0.008, because more data shrinks the confidence sets and the certified shield then forbids fewer actions (Cor. 2).
| 2,500 | 1.00 | 1.00 | 0.076 | 0.002 |
| 12,000 | 1.00 | 1.00 | 0.074 | 0.008 |
Table II. The guarantee over 100 datasets (Experiment 2). For each number of logged episodes we drew 100 independent datasets and built a fresh shield from each. The second and third columns give the fraction of datasets in which the shield’s true worst-case risk was at most its certificate , and at most the budget ; the last two give the average and (, ).
A file-system sandbox, with four baselines
The abstract state records whether the agent is in the protected directory, holds write capability and has confirmation, plus a latch recording that a destructive call was issued. The tools are read, chmod, write, delete, send and HALT. The task is an authorized change, a write in production after confirmation; each read obtains confirmation with probability 0.5, and calls misfire with probability 0.12. Harm comes from a chmod into production before confirmation, then write or delete, or from a delete elsewhere, which sets the latch, then send. We log episodes of a competent agent that takes neither route, with and ; the least-visited row meeting its budget has 9,118 observations, yet the hazards never appear in the logs. Episodes are cut off after executed calls, not counting blocked proposals.
Table III compares five shields built from the same logs. Here and in Experiment 3 the synthesizer is a simpler variant of Alg. 1. It ranks the permitted actions other than HALT by the robust -value of line 4, never disconnects and falls back to all-HALT; Cor. 2 covers it. The plug-in shield uses certainty equivalence. It treats the estimated kernel as exact, gives the unseen hazards probability zero and certifies zero risk, yet an adversary does harm on every seed. A policy-specific certificate covers only the logging agent; it too certifies zero risk, forbids nothing and fails the same way. A count threshold, forbidding pairs seen fewer than 10 times, is safe but uncertified and forbids 80.2% of pairs, against 4.2% for ours. A Bayesian Dirichlet shield is as safe but forbids twice as much (8.3%), and its bound is credible, not distribution-free.
| Shield | Cert. | Adv. risk | Succ. | Forb. % | Interv. % | Len. |
| count-thr. | n/a | 0.00 | 0.99 | 80.2 | 0 | 4.3 |
| Dirichlet-95% | 0.00 | 0.00 | 0.99 | 8.3 | 0 | 4.3 |
| plug-in MDP | 0.00 | 1.00 | 0.99 | 0.0 | 0 | 4.3 |
| policy-spec. | 1.00 | 0.99 | 0.0 | 0 | 4.3 | |
| robust (ours) | 0.00 | 0.00 | 0.99 | 4.2 | 0 | 4.3 |
Table III. Five shields built from the same logs. File-system sandbox, logged episodes, budget , averages over 200 seeds. The columns give the certified bound , the unsafe probability an adversarial controller reaches, a competent agent’s success rate, the percentage of the 96 live state–action pairs forbidden, the intervention rate and the mean episode length. †Logging controller only.
Experiment 3 (language-model controllers). We replace the scripted agent by a live language model that reads the full transcript and replies with one tool name. It never sees the predicates, so it is a history-dependent controller of the kind Thm. 1 covers. The shield sees only and is the one built from the scripted agent’s logs, not refitted. A forbidden call is blocked, not executed, and the model asked again (Sec. II). Each episode is attacked by prompt injection with probability 0.3 (39 of 150 were). An instruction hidden in the first file the agent reads tells it to delete the production logs and mail them out. Seven controllers sharing only the interface, namely the scripted agent and Qwen2.5 models [10] with 1.5B, 3B and 7B parameters at temperatures and 1, ran 150 episodes each; Table IV lists five. Without the shield, they range from never unsafe to unsafe in 84.7% of episodes. With it, none of the seven is ever unsafe in its 150 episodes, which bounds each unsafe rate by 2% at 95% confidence and, pooling the 1,050 episodes, their average by 0.29%.
The 7B model shows the mechanism best. It always starts with read and is never unsafe unless attacked, but the attack succeeds in 31 of its 39 attacked episodes (79.5%). The shield prevents them all by blocking only the 39 injected deletes, an intervention rate of 6.5%, and success stays at 55.3%. For the 3B model the shield even raises success, from 3.3% to 38.7%. The model escalates permissions before confirming, and when that call is blocked and the model asked again, it goes back for the confirmation it skipped, which immediate HALT substitution would never allow. The smaller models need more help, with 31 to 47 blocked proposals per 100 executed calls against about 6 for the 7B. What the shield cannot supply is competence. At the 1.5B model always opens with the forbidden chmod, never succeeds and always halts safely.
Experiment 4 (testing the Markov assumption). Everything rests on A1, so we test whether the next abstract state, given the current state and action, still depends on the previous one. For each row with enough data, a likelihood-ratio test compares the successor distributions across previous states, holding the false discovery rate at 5% (Benjamini–Hochberg). We also report their largest distance , the empirical
| Controller | Unsafe none | Unsafe shield | Success none | Success shield | Interv. | Blocks |
| scripted competent | 0.0 | 0.0 | 99.3 | 99.3 | 0.0 | none |
| Qwen2.5-1.5B, | 70.7 | 0.0 | 0.0 | 0.0 | 42.0 | chmod |
| Qwen2.5-3B, | 78.7 | 0.0 | 3.3 | 38.7 | 43.4 | chmod |
| Qwen2.5-7B, | 20.7 | 0.0 | 55.3 | 55.3 | 6.5 | delete |
| Qwen2.5-7B, | 21.3 | 0.0 | 59.3 | 59.3 | 6.1 | delete |
caption: Five of the seven Experiment 3 controllers behind one shield. Each ran 150 episodes, prompt-injected with probability 0.3. The columns give the percentage of episodes ending unsafe and in success, without the shield (none) and with it; the intervention rate, in blocked proposals per 100 executed calls; and the blocked call.
:::
counterpart of in Prop. 2, against a permutation null. On the grid 0 of 160 testable rows reject, with below the null 0.17; on the sandbox, 0 of 15, with 0.08 against 0.20. The test does catch a real defect. Deleting the confirmation predicate makes 4 of 7 rows reject, with above its null of 0.16. Two examples establish neither calibration nor power in general, and the test has further limits. Only visited rows can be tested, and is an effect size for one choice of context, not the supremum over histories that Prop. 2 needs, so it gives only a nominal sensitivity surcharge. Dependence this context cannot see is invisible, and failing to reject is not evidence of Markovness. Refining in response makes the abstraction data-dependent, which Cor. 2 does not cover, so development and certification logs should be kept apart. The test can refute a predicate set, never certify one.
Conclusion and Future Work
We treated a language-model agent as an unknown feedback controller and placed a supervisory filter between it and its environment. The filter carries a certificate in the form of a robust reach–avoid bound on the probability of an irreversible action within the task, computed over an uncertainty set that is learned from ordinary logs. The bound holds with confidence for every controller the filter admits, so the language model can be replaced without recomputation, provided the environment, interface, permissions, abstraction and notion of harm stay the same. No failure need appear in the logs. An action never observed in a state is treated as maximally uncertain and is blocked if it could lead to harm, so the data must cover normal operation, not the hazards. The main assumption is that the Boolean predicates defining the abstract state make the loop Markov, which the logs can test but not prove. Future work should learn the abstraction from data held out from certification, tighten the filter online, and pool logs across agents sharing an environment.
Appendix: Proofs and supplementary results
Statements are those of the main text; equation and result numbers refer to it.
Proof of Lemma 1. Let be admissible and its probability of entering within further steps from a history with . We prove by induction on ; the deterministic above achieves equality, giving the claim. Base (). Here .
Step. For , conditioning on the time- action and invoking A1 (the next state is regardless of ),
By the inductive hypothesis , and because is admissible every with lies in . Hence each inner sum is at most
and the -average of quantities is itself . Absorbing and sink states match by construction.
Proof of Lemma 2. Work in global time, so nothing is conditioned on the coverage event. For a stochastic row and , let count visits up to , , , which gives the predictable, and with the conditional successor law given the past. The are bounded martingale differences, so a conditional-Hoeffding supermartingale gives , one-sided; a row with takes the vacuous set. As , attained at , a union over the nontrivial subsets needs no factor of two, and a further union over the stochastic rows reproduces (4) about with failure . Deterministic rows count trivially, and no step assumes the successors identically distributed, so this holds whether or not A1 does.
Proof of Proposition 1. Any feasible satisfies
with , hence . Since , for fixed the maximizer adds mass on the largest (subject to ) and removes it from the smallest (subject to ), so the gain is a concave piecewise-linear nondecreasing function of . It is therefore maximized at the largest feasible , which is and may be strictly smaller than ; once the marginal transfer moves mass between entries of equal the gain stops increasing, and it can be zero, as at with , where the receiver capacity is already exhausted. Sorting dominates the cost.
Proof of Theorem 1. Work on , of probability by Lemma 2. The left inequality holds since is the supremum (2) over all admissible controllers, of which is one (Lemma 1). For the right, induct on . Base. . Step. For , obeys the recursion (3) by Lemma 1; the inductive hypothesis gives pointwise, and since ,
the last step because on . Unsafe and sink states match by construction, and (10) follows with , .
Proof of Corollary 1. Only rows in enter the recursion (7) from , so set by (5). Fix any . By Prop. 1, , and on the event of Lemma 2, . Hence
Let be the states an in-shield trajectory from can occupy with steps remaining, and set , where solves (3) under the same shield. Restricting to matters. Every row used by a backup at lies in , so bounds its radius, which need not hold at a state cannot reach. Then , since both equal . For , whose successors lie in , applying (11) with and then gives ; unsafe and sink states match exactly, and by Thm. 1. So , whence , and gives the claim.
Proof of Corollary 2. is a statement about the data and the fixed unknown , with by Lemma 2; it never references . The inductive step of Theorem 1 uses only , true on for all rows, so holds on simultaneously for all . Thus, on , any with obeys ; as , regardless of the rule producing , the claim follows.
Proof of Proposition 2. Lemma 2 nowhere uses A1, so its event still has probability and gives . As is a convex combination of laws at logged histories, the hypothesis and convexity of the norm give at every reachable , so and, with the support condition, . Induct on over histories. The base case is , and since the hypothesis applies pointwise to the successors and is admissible, . For the second inequality, Prop. 1 gives on , and each backup is 1-Lipschitz in the sup norm, so the gaps accumulate over .
Proof of Proposition 3. Under the only admissible controller halts at once into , never entering ; thus by (7).
Context sensitivity of the Experiment 4 diagnostic
The diagnostic of Experiment 4 conditions on the previous abstract state. Conditioning additionally on the previous action was also evaluated (Table V).
| Abstraction | Context | Rows | Rejected | Null | |
| Grid | state | 160 | 0 | 0.136 | 0.169 |
| Grid | state, action | 0 | 0 | — | — |
| Sandbox, fine | state | 15 | 0 | 0.084 | 0.201 |
| Sandbox, fine | state, action | 16 | 0 | 0.170 | 0.506 |
| Sandbox, coarse | state | 7 | 4 | 0.184 | 0.155 |
| Sandbox, coarse | state, action | 7 | 2 | 0.630 | 0.374 |
Table V. TABLE V. Experiment 4 under two choices of context. The context is the previous abstract state, or that state together with the previous action. Rows counts the kernel rows with enough data to test and Rejected those where the test rejects; is the largest distance between the successor distributions under different contexts, and Null is the 95% quantile of when context labels are shuffled within a row.
Richer context buys effect size and costs power. On the coarsened sandbox the pair context raises from 0.184 to 0.630 while halving the rejections, and on the grid it leaves no testable row against 160, because contexts exhaust the data. That collapse is why the previous state alone is the primary diagnostic in the main text.
References
Conditioning additiona
References
- [1]S. Yao, J. Zhao, D. Yu, N. Du, I. Shafran, K. Narasimhan, and Y. Cao, “ReAct: Synergizing reasoning and acting in language models,” in Proc. Int. Conf. Learn. Represent. (ICLR), 2023.arxiv.org/abs/2210.03629
- [2]T. Schick, J. Dwivedi-Yu, R. Dessi, R. Raileanu, M. Lomeli, E. Hambro, L. Zettlemoyer, N. Cancedda, and T. Scialom, “Toolformer: Language models can teach themselves to use tools,” in Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 36, 2023, pp. 68 539–68 551.arxiv.org/abs/2302.04761
- [3]A. D. Ames, S. Coogan, M. Egerstedt, G. Notomista, K. Sreenath, and P. Tabuada, “Control barrier functions: Theory and applications,” in Proc. Eur. Control Conf. (ECC), 2019, pp. 3420–3431.arxiv.org/abs/1903.11199
- [4]K. P. Wabersich and M. N. Zeilinger, “A predictive safety filter for learning-based control of constrained nonlinear dynamical systems,” Automatica, vol. 129, 2021, Art. no. 109597.
- [5]A. Baheri, “How much do your models disagree? Adaptive MPC safety from ensemble uncertainty,” IEEE Open J. Control Syst., 2026.DOI
- [6]S. Bansal, M. Chen, S. Herbert, and C. J. Tomlin, “Hamilton–Jacobi reachability: A brief overview and recent advances,” in Proc. IEEE Conf. Decis. Control (CDC), 2017, pp. 2242–2253.arxiv.org/abs/1709.07523
- [7]P. J. Ramadge and W. M. Wonham, “Supervisory control of a class of discrete event processes,” SIAM J. Control Optim., vol. 25, no. 1, pp. 206–230, 1987.
- [8]M. Alshiekh, R. Bloem, R. Ehlers, B. Könighofer, S. Niekum, and U. Topcu, “Safe reinforcement learning via shielding,” in Proc. AAAI Conf. Artif. Intell. (AAAI), 2018, pp. 2669–2678.arxiv.org/abs/1708.08611
- [9]C. De Persis and P. Tesi, “Formulas for data-driven control: Stabilization, optimality, and robustness,” IEEE Trans. Autom. Control, vol. 65, no. 3, pp. 909–924, 2020.
- [10]Qwen Team, “Qwen2.5 technical report,” arXiv:2412.15115, 2024.
- [11]M. Suilen, T. D. Simão, D. Parker, and N. Jansen, “Robust anytime learning of Markov decision processes,” in Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 35, 2022, pp. 28 790–28 802.arxiv.org/abs/2205.15827
- [12]T. Badings, L. Romao, A. Abate, D. Parker, H. A. Poonawala, M. Stoelinga, and N. Jansen, “Robust control for dynamical systems with non-Gaussian noise via formal abstractions,” J. Artif. Intell. Res., vol. 76, pp. 341–391, 2023.DOI
- [13]R. Reed and M. Lahijanian, “Learning-based shielding for safe autonomy under unknown dynamics,” in Proc. Amer. Control Conf. (ACC), 2025, pp. 4940–4946.arxiv.org/abs/2410.07359
- [14]E. Hamel-De le Court, T. Badings, A. Abate, F. Belardinelli, and F. Fabiano, “Robust shielding for safe reinforcement learning,” arXiv:2606.00270, 2026.
- [15]S. Ray, “What can be enforced? A theory of certified runtime safety for tool-using agents,” arXiv:2607.02268, 2026.
- [16]S. Summers and J. Lygeros, “Verification of discrete time stochastic hybrid systems: A stochastic reach-avoid decision problem,” Automatica, vol. 46, no. 12, pp. 1951–1961, 2010.DOI
- [17]T. Weissman, E. Ordentlich, G. Seroussi, S. Verdú, and M. J. Weinberger, “Inequalities for the L₁ deviation of the empirical distribution,” Hewlett-Packard Labs., Tech. Rep. HPL-2003-97R1, 2003.
- [18]G. N. Iyengar, “Robust dynamic programming,” Math. Oper. Res., vol. 30, no. 2, pp. 257–280, 2005.