The Research Report
OpenAI Agents SDK Sandbox Agents: A New Prompt Architecture for Secure, Bounded Execution
In April 2026 the OpenAI Agents SDK received its biggest upgrade yet: sandbox agents. The update adds a native, model‑aware execution layer that lets agents inspect files, run commands, and edit code inside isolated environments. On the surface this looks like a toolbox upgrade, but the consequences for prompt design, safety, and developer workflow are deeper. In this article we unpack what sandbox agents are, how they reshape prompt architecture, and what practical steps teams should take to adopt them.
1. What Sandbox Agents Are
A sandbox agent is an agent instance that runs its tool calls inside a controlled, container‑style environment. The environment can be a local Docker container, a cloud‑hosted sandbox service (Blaxel, Cloudflare Workers, Modal, Vercel, etc.), or a custom runtime exposed through the SDK’s SandboxRunConfig. The SDK ships with a Python implementation and a planned TypeScript implementation. The key capabilities include:
- File System Access – agents can read/write files within a mounted workspace. The SDK provides Codex‑style filesystem tools,
applypatchandfilesearch. - Command Execution – via the built‑in
shelltool, agents can run arbitrary commands, but only those permitted by the sandbox configuration. - Dependency Management – a sandbox can declare a
requirements.txtorpackage.jsonthat the runtime installs before the agent begins work. - State Persistence – snapshots of the sandbox’s filesystem and environment are automatically persisted after each turn. If the sandbox crashes, the SDK can re‑hydrate the state in a fresh container and continue.
- Capability Scoping – the developer declares which tools are enabled (
shell,applypatch,filesearch, etc.) and which external services the sandbox may call. The model can see these capabilities through a structuredmanifestand can reason about them while planning.
The manifest is a JSON object attached to the agent request:
{
"files": ["src/*.py", "requirements.txt"],
"tools": ["shell", "apply_patch"],
"environment": {
"PYTHONPATH": ".",
"NODE_ENV": "production"
}
}
The model receives this manifest as part of its system prompt, enabling explicit capability scoping – the model now knows exactly which operations it can call and can decide whether a step is feasible before attempting it.
2. How Sandbox Agents Change Prompt Architecture
2.1 From Flat Prompts to Structured Context
Historically, an agent’s prompt consisted of three layers:
- System Prompt – role, constraints, output format.
- User Message – the task description.
- Tool Calls – triggered when the model decides to act.
With sandbox agents, a fourth layer appears: the sandbox manifest. The manifest is not free‑form text; it is a structured schema that the model can parse. Prompt engineers now need to:
- Encode capabilities explicitly in the manifest rather than sprinkling them in the system prompt.
- Design prompts that reference the manifest (e.g., “You may read any file listed in the workspace.”).
- Consider environment constraints (e.g., runtime versions, limited network access) as part of the reasoning process.
The effect is a prompt architecture that mirrors a capability‑aware API contract. The model treats the manifest as an interface specification, similar to how developers treat a REST API.
2.2 Prompt‑Driven Resource Allocation
Because the sandbox can enforce resource quotas (CPU, memory, time), developers can expose these limits in the prompt. For example, a prompt may say:
You have 30 seconds of CPU time and 256 MiB of RAM. Prioritize the most critical file modifications.
The model now optimizes its plan against these hard constraints, reducing runaway tool usage and aligning with the budget‑centric thinking introduced in Claude Opus 4.7.
2.3 Safety‑First Prompting
Sandbox agents enforce zero‑data‑retention for any file writes that happen inside the container unless the developer explicitly persists them. This encourages a safety‑first prompt style where the model does not assume it can leave sensitive data on disk. Prompt engineers can now write:
All temporary files must be deleted before the sandbox shuts down.
The SDK automatically validates that the agent adheres to this rule, providing a concrete enforcement point that was previously only advisory.
3. Practical Implications for Developers
3.1 Updating Your Agent Instructions
When moving from a non‑sandboxed agent to a sandboxed one, adjust the system prompt:
- Replace implicit tool availability with a manifest description.
- Add explicit resource limits (time, memory, CPU) as part of the prompt.
- State persistence expectations – “Only files listed under
output/should be persisted after the run.”
A minimal system prompt for a code‑refactoring agent might look like:
You are a Python refactoring assistant. You can read any file under `src/` and write patches using the `apply_patch` tool. Your sandbox runs on Python 3.11 with a 60‑second CPU limit. Do not write to files outside `src/`.
3.2 Designing the Manifest
The manifest should be concise but complete. Include:
- File glob patterns that define the workspace.
- Enabled tools (shell, applypatch, filesearch).
- Environment variables needed for the task.
- Resource quotas (optional, can be enforced by the sandbox runtime).
Example manifest for a data‑analysis agent:
{
"files": ["data/*.csv", "scripts/analysis.py"],
"tools": ["shell", "file_search"],
"environment": {"PYTHONPATH": "scripts"},
"runtime": {"cpu_seconds": 120, "memory_mb": 512}
}
3.3 Testing and Debugging
The SDK now provides sandbox logs that capture stdout/stderr and filesystem diff after each turn. Use these logs to verify that the model respects the manifest:
openai agents logs --run-id 12345
If the model tries to access a file outside the allowed glob, the sandbox blocks the call and returns a PermissionError that the model can surface in its reasoning trace.
3.4 Migration Checklist
- Enable the sandbox beta in your SDK config (
sandbox_enabled: true). - Define a manifest for each agent type.
- Update system prompts to reference the manifest and remove redundant tool descriptions.
- Add resource limits to the prompt where appropriate.
- Run integration tests against the sandbox to verify tool access and state persistence.
- Monitor token usage – the sandbox adds a modest overhead, but the tighter control usually reduces overall token spend.
4. Future Directions
OpenAI has announced that TypeScript support and advanced sandbox features (network whitelist, GPU acceleration) are coming later in 2026. The roadmap includes:
- Dynamic manifest generation – the model can request additional files or tools during a run, and the orchestrator can approve them on the fly.
- Nested sandboxes – agents can spawn sub‑agents each with their own manifest, enabling multi‑stage pipelines.
- Policy‑as‑code – developers can codify security policies that the sandbox enforces automatically (e.g., no outbound network calls to ports > 1024).
These extensions will push the prompt architecture further toward a capability‑first contract, where the model’s reasoning space is explicitly bounded by the declared capabilities of its execution environment.
5. Bottom Line
Sandbox agents turn the OpenAI Agents SDK from a collection of loosely‑bound tools into a secure, capability‑aware platform. Prompt engineers now embed a structured manifest into the prompt, making the model’s toolset a first‑class prompt surface. This yields safer execution, better resource planning, and clearer expectations for both developers and the model.
The practical steps are simple: enable the sandbox, craft a manifest, tighten your system prompt, and test. Doing so will bring your agentic workflows in line with the emerging best practices around token budgeting, effort tiers, and bounded execution that are reshaping the LLM ecosystem in 2026.