Meridia Insight Tech for Good Frontiers

The AI agent can be fooled. Its execution harness doesn’t have to be.

A prompt injection can steer an AI agent toward deployment. A stateful execution harness can still refuse—because the required approval or test result is

43/60: the modeled request probability above which the release harness puts the security scan first.

An AI agent can be told to deploy software before its tests finish. A certified execution harness can refuse—not because it recognizes a suspicious sentence, but because the approval, test result or rollout state required for deployment is not there. In a paper about securing tool-using AI, that distinction is the central idea: don’t ask the language model to remember the rules; make the system’s state determine which actions can happen.

The proposal is timely because agents are moving from answering questions to taking consequential actions: editing code, sending messages, changing cloud services and triggering releases. Those actions can have effects that a later apology cannot reverse. Gu and Zhu’s framework uses Petri nets, a mathematical way to represent actions and the resources they consume, to place a formal gate between an untrusted AI and its tools. The result is not a detector that promises to spot every attack. It is a mechanism that can block certain classes of operational failure even when the model has been manipulated.

That promise has boundaries. The framework protects the modeled workflow, not every possible harm in the world. It depends on a faithful model and on the agent having no way around the gate. And safety is only part of the problem: a gate that keeps refusing an agent can waste inference calls and obstruct legitimate work. The paper’s more subtle contribution is to ask how a safe harness can interfere as little as possible.

The Science

The authors, Chao Gu of Queen’s University Belfast and Quanyan Zhu of New York University, frame an agent’s software surroundings—the harness or scaffold—as a trusted execution layer. The language model proposes a tool call; the harness decides whether that call is admitted. A prompt may contain malicious instructions, and the model may follow them. The safety decision does not depend on the model correctly identifying the attack.

The formal machinery is a Petri net. Think of it as a workflow board with places that hold marks and transitions that move them. A mark can stand for an approval, a completed security scan, a remaining unit of budget, or a capability. A transition represents an action such as running tests or deploying. It can fire only when the marks it requires are present. Actions can consume marks, so a one-time approval cannot authorize unlimited deployments.

This is more than a visual diagram. It lets a workflow encode operational rules in its structure. If deploying requires an approval mark, the deployment transition is unavailable until that mark exists. If the approval is consumed when used, the same authorization cannot simply be replayed. The paper describes constraints such as “deployments cannot outnumber approvals” as linear constraints on actions; an added monitor place tracks the resource that remains.

The harness applies four checks to each proposed action. First, the interface must map the proposal to a known action. Second, a validator checks content or policy conditions that the net cannot express, such as whether an argument is on an allowlist. Third, the action must be enabled by the current Petri-net state. Fourth, the supervisor must permit it. All four must pass before execution. A refusal is returned to the model, which may try again.

The supervisor is a controller synthesized from the workflow. In conventional supervisory control, some events are controllable—the harness can stop an action—and others are uncontrollable, such as a tool outcome or a human decision that has already occurred. The supervisor is designed to keep the system away from forbidden states without pretending it can prevent uncontrollable events. Its conventional version is “maximally permissive”: it allows every action that can be allowed while retaining safety.

The authors call the resulting model an agentic execution Petri net, or AEPN. It can also record who is responsible for an action and what tool or message it represents. The net’s operational state is held by the harness, rather than inferred from the LLM’s conversation history. Figure 1 shows the overall separation between the untrusted proposer and the execution gate; Figure 2 breaks down how a proposal passes through the checks and changes the state.

For the formal guarantee to apply to a real running system, the paper states four assumptions. In broad terms, the net must track the system faithfully, the harness’s interface and checks must work as modeled, and actions or events must not bypass the gate. One explicit concern is a direct path from the LLM to the environment that skips admission. If such a bypass exists, the proof about the harness cannot secure that route. The authors also describe the harness as a trusted computing base: its kernel, validator, supervisor, interface and logs must themselves be protected.

That last point matters. “Certified” here means the safety claim is proven for the formal model and transfers to execution under stated assumptions; it does not mean the software has been certified by a regulator, nor that the whole AI system is safe against every threat. A permitted tool call could still carry a secret in its arguments, for example, if the validator and workflow do not prevent it. The framework targets operational failures—out-of-order actions, repeated use of approvals, budget overspending, or conflicting use of a shared resource—not every semantic or cybersecurity risk.

What They Found

The first result is a state-based answer to prompt injection. Suppose an issue description contains hidden instructions to deploy immediately. The wording can influence what the model proposes, but it cannot create the missing test, scan or approval marks. If deployment is not enabled in the current state, the harness refuses it regardless of how persuasive the request sounds. This is a different security posture from relying on a system prompt that tells the same model not to deploy.

The core technical wrinkle appears after refusal. A conventional supervisor treats a disabled action as simply unavailable. An LLM agent, however, sees an error and may make another proposal. Each retry consumes another inference call. A maximally permissive supervisor minimizes the actions it blocks locally, but that does not necessarily minimize the number of refusals over an entire task. It may allow the agent to keep proposing actions that are safe in principle but poorly timed for the proposer’s behavior, leading to repeated blocks elsewhere.

Gu and Zhu formalize this as a “replanning closed loop,” where the proposer may try again after a refusal and each retry has a cost. Their analysis shows that the conventional maximally permissive supervisor can be arbitrarily more intrusive than a stricter safe alternative. “Arbitrarily” is a theoretical statement across possible proposer models: there is no fixed upper bound on how much worse the refusal cost can be. It is not a claim that an observed deployed agent incurred a particular number of extra calls.

They then characterize the maximally permissive supervisor that is least intrusive for a given proposer model. In effect, it compares the expected downstream cost of allowing an action now with the cost of refusing it and prompting a retry. It can disable an action that the conventional supervisor would allow if taking it is expected to make the overall interaction more costly. Crucially, this refinement only removes actions from the conventional supervisor. If the proposer’s probability estimates are wrong, the refined policy may be less efficient than expected, but it remains safe under the same model assumptions.

The paper applies the method to an autonomous release agent. Its workflow includes preparing a patch, running tests and a security scan, obtaining approval, and deploying. The synthesis result identifies a counterintuitive requirement: safe deployment needs a step the supervisor can still refuse after a rollout has started. Otherwise, a release might go live after an incident has frozen releases. A two-phase rollout creates such an intervention point, allowing the supervisor to stop the final release even after the process is underway.

The release example also illustrates how least-intrusive control can order actions. When two actions may occur in either order, the refinement can sometimes keep both orders available; under precise conditions, it can enforce an order using at most one monitor place. For the paper’s illustrative proposer—which requests premature deployment only after the tests—the refinement puts the security scan first if and only if the request probability exceeds \(43/60\). That is a threshold in a model, not an empirically measured rate of prompt injection.

Illustrative scan-order threshold

The paper’s release-agent example gives a threshold of 43/60 for the probability of requesting premature deployment after tests; above it, the least-intrusive refinement puts the security scan first.

Illustrative scan-order threshold
LabelValue
Request-probability threshold43 fraction numerator / denominator

Assumptions for safety transfer

The authors state four assumptions under which safety proven for the net transfers to the running system.

Assumptions for safety transfer
LabelValue
Transfer assumptions4 assumptions

The paper’s formal results can be summarized as three related claims: safety is enforced against every sequence of proposals and uncontrollable events in the modeled system; the usual maximally permissive supervisor need not minimize refusals once retries are counted; and a proposer-specific value-threshold refinement can achieve least intrusiveness while staying inside the conventional supervisor’s safe choices. The study also states four assumptions for transferring the model’s safety to the running system.

Monitor-place bound for ordering concurrent actions

Under the paper’s precise conditions, the refinement orders two concurrent actions by at most one monitor place.

Monitor-place bound for ordering concurrent actions
LabelValue
Monitor places needed (maximum)1 place
Actions whose order may be controlled2 place

Why This Changes Things

Most defenses aimed at prompt injection try to judge language. A classifier asks whether text looks malicious; a system prompt asks the model to follow a rule; an access-control list asks whether a user has permission. These can be useful, but each misses something the Petri-net harness tracks: what has already happened, what authorization has already been spent, and what remains possible now.

That difference is especially important for one-time approvals and actions with irreversible effects. A permission that can be reused may be valid in a broad sense but wrong for the current stage of a workflow. A mark that is consumed when used ties authorization to a particular event. The harness is not persuaded by an urgent instruction because urgency is not a resource represented in the net.

The approach also reframes the role of the model. The LLM can still plan and propose; it does not have to be perfectly robust to hostile inputs. The trusted layer narrows the model’s power to act. That is a practical division of labor: language models are flexible at interpreting messy requests, while a smaller runtime kernel enforces exact constraints. It resembles the distinction between a pilot’s judgment and an aircraft’s hard flight envelope, though software workflows are much more varied and the model of the workflow must be built carefully.

Least-intrusive control matters for adoption. If safeguards routinely block harmless steps, users may disable them or route around them. The paper’s approach recognizes that refusals have a cost, not only in compute and latency but in the friction imposed on work. The optimized supervisor tries to account for the likely behavior of a particular proposer. Yet the guarantee is asymmetric: a bad probability model can undermine the efficiency claim, not the safety claim, because the refinement only tightens the safe policy.

This is a meaningful, if bounded, form of defense in depth. It complements sandboxing, which limits the damage a tool can do, and validators, which inspect arguments and content. It does not replace either. The authors explicitly note that a secret included in an otherwise permitted call may escape a workflow-only model. Nor does a formal proof ensure that the workflow specification captured every real-world hazard. An omitted transition, inaccurate assumption about tool behavior, or bypass can leave a gap between the mathematical guarantee and the deployed system.

The world-level significance is not that an AI agent can now be trusted with any tool. It is that some permissions can be converted from instructions into enforceable, stateful constraints. As organizations give agents access to code repositories, deployment pipelines, cloud accounts, payment systems or shared resources, a harness that tracks approvals and budgets could make “not yet,” “already used,” and “not during an incident” operational facts rather than wishes in a prompt.

What’s Next

The next challenge is building models that match real software. Teams will need to decide which events count as approvals, which conditions are consumed versus merely checked, how tool outcomes are represented, and where human escalation belongs. The paper assumes a bounded AEPN—one with a finite reachable set for synthesis—and points to invariants as a way to establish boundedness in its release example. Real systems may have many interacting tools, dynamic resources and loosely specified side effects. Scaling the model without losing fidelity is a practical research problem.

The least-intrusive result also depends on a proposer model. A deployed model’s proposal probabilities can shift with prompt, context, model version or attacker strategy. The authors’ safety claim survives a wrong estimate so long as the refinement only removes conventional-safe transitions, but its promise of fewer refusals is tailored to the proposer it was optimized for. Evaluating that tradeoff across changing models and realistic workloads will matter before using it to tune production systems.

There is also a human-factors question: what should an agent see when an action is refused? A terse error may cause unproductive retries; a useful explanation could help the model choose a valid next step, but might also expose system details. The paper counts retries as inference-call cost and formalizes their effect, but deployment teams will still have to design the messages, escalation paths and audit logs around the formal kernel.

The broader opening is a way to make agent permissions consumable, auditable and tied to workflow state. If that layer is engineered well—and if the assumptions are checked rather than merely asserted—it can let AI systems act with more autonomy without asking the model itself to be the final authority on whether its own actions are safe. The key question shifts from “Can we make the agent ignore every malicious instruction?” to “Can we ensure that an unsafe action is impossible to execute, even when the agent does not?”

Comments (0)

No comments yet. Be the first to share your thoughts.