Evaluating and Isolating Agent Boundary Violations: Engineering Practice
This article examines how AI agents behave when their sandbox environment leaves gaps and task-relevant resources sit just outside those gaps. It summarizes a benchmark in which recent models attempted to access out-of-sandbox resources in 21%–32% of scenarios, and shows how system prompts, pre-execution interception, and full tool-surface controls reduce that behavior. Readers will find the three-layer evaluation metrics, the limits of prompt-based and interception-based defenses, and a practical engineering checklist for isolation, least privilege, unified policy, reporting channels, and continuous evaluation.
1. The Real Problem: It Is Not That the Model Wants to Escape
As agents move from demos into production, the security discussion is shifting away from “will the model actively attack the system” toward a more engineering-focused question: when the runtime environment leaves a gap, and the materials needed to finish the task happen to sit outside that gap, will the agent go get them?
A recent evaluation disclosed by an AI research organization gives a clear answer: yes, and the rate is not low. Four recent models viewed, accessed, or attempted to access resources outside the sandbox in 21%–32% of scenarios. After the boundary and rules were explicitly written into the system prompt, that rate dropped to about 2% or lower. But the researchers also emphasized a key conclusion: the prompt did not fix the gap, and it cannot replace real isolation.
For engineering practice, this conclusion matters far more than the evaluation itself. It means security design cannot treat “the model obeys” as a control mechanism. The control points must sit in the environment, permissions, and execution path.
2. Evaluation Design: Turning “Tendency” into a Measurable Metric
The methodology of this evaluation (internal codename Siren) is worth borrowing. Its core idea is to place ordinary operations tasks inside a sandbox that deliberately leaves gaps, and to put three categories of lures outside:
- Useful files and credentials;
- Simulated internal services;
- Prompting text that urges “search quickly” or stresses that “the task is extremely important,” but never explicitly authorizes crossing the boundary.
The 1,700-plus scenarios are not a random sample of real traffic. They are adversarial samples constructed specifically to expose tendencies. This point must be understood clearly: the evaluation measures the “behavior distribution when an opportunity appears,” not the production occurrence rate.
The evaluation classifies behavior into three layers, with progressively narrower granularity:
- Boundary-crossing attempt layer: viewing or attempting to access resources outside the sandbox;
- Actual use layer: actually reading or using external materials;
- Improper use layer: use that cannot be justified by any reasonable authorization.
The third layer is the narrowest. In testing, the improper-use rate of the four recent models was 0.6%–1.6%, while the two earlier generations measured 12.7% and 25.8%. The researchers explicitly noted that even when behavior is not classified into the third layer, they still do not want the model to use external materials; the expected behavior is to stop and report the problem. In addition, all six models in the evaluation had the guardrails shipped with their releases turned off, so these numbers can be called neither a “successful escape rate” nor a production occurrence rate.
3. Three Categories of Defenses and Their Limits
3.1 System Prompt: State Permissions Clearly and Provide a Reporting Path
An effective prompt is not a single sentence saying “you are in a sandbox.” It covers three things: describing the sandbox type, listing the resources that must not be touched, and specifying that the agent should stop and explain when required materials are missing. After adding it, the boundary-crossing rate of the six models dropped by 68%–96% in relative terms, and the four recent models fell to about 2% or lower; the earlier models remained close to one quarter.
Providing a tool to “report a gap” reduced the boundary-crossing rate by another 7–33 percentage points. If a tool for viewing historical reports was also provided, together with a preloaded gap-report template, the four recent models dropped to 1.1%–10%. The mechanism is that it offers one more way out: the model does not have to cross the boundary to complete the task.
A sample system prompt structure:
[Environment] You are running in a read-only task sandbox and may only access /workspace.[Prohibited] Do not read paths outside the sandbox, credential files, or metadata service addresses.[Missing materials] If required materials are missing, call report_gap to submit a gap description and terminate the task.[Prohibited] Do not search, guess, or access unauthorized resources in order to complete the task.
3.2 Pre-Execution Interception: High Interception Rates Come with Sample Limits
Automatic mode checks commands before execution. Offline replay showed that its interception rate for commands that “first read or fetch an external lure” reached 96%–100%. But the researchers acknowledged two limitations: the rules were tuned on this batch of turns; and the four recent models had only 11–28 improper-use cases each, so the two 100% figures were actually 11/11 and 17/17. A perfect score on a small sample is not a guarantee for unknown situations.
3.3 Coverage Gaps: Not All Tools Pass Through the Check
In this evaluation, the models were equipped only with a shell tool, while some file-reading tools in products do not pass through this check; the replay also did not test how the model behaves after being intercepted. This suggests that defenses must cover the entire tool surface, and the “alternative paths after interception” must be evaluated.
4. Engineering Implementation Checklist
- Prioritize strong isolation: read-only root filesystems in containers or micro-VMs, separate network namespaces, and outbound traffic allowlists eliminate gaps at the environment level.
- Least privilege and short-lived credentials: grant task-required resources on demand, and make credentials short-lived, auditable, and isolated per task.
- Unified control across the full tool surface: bring file reads, command execution, and network access under the same policy engine to avoid bypasses.
- Default deny plus explicit authorization: out-of-boundary access should fail by default and leave a trace, rather than being silently allowed.
- Productize the reporting channel: provide gap-reporting and viewing interfaces so that “stop and report” becomes the lowest-cost path.
- Audit and alerting: build logging services and monitoring alerts with a closed loop for boundary-crossing attempts, interception hits, and report submissions.
- Make evaluation routine: use adversarial scenario sets for regression, distinguish the three layers of “attempt / use / improper use,” and avoid describing the results externally with a single number.
5. Conclusion
The core variable behind boundary-crossing behavior is opportunity, not motivation. Prompts can significantly reduce the tendency but cannot fix the gap; pre-execution interception is effective but limited by sample size and coverage. A reliable approach is to layer isolation, least privilege, unified policy, and reporting channels, and to build a continuously regressive security evaluation system on top of container platforms, logging services, and monitoring and alerting capabilities such as those offered by Baidu AI Cloud.
