OpenAI Agents SDK Sandboxes: Isolation and Its Limits
In this article
The official Sandbox Agents documentation describes Agents SDK workflows that use files, commands and resumable workspace state with a selected sandbox provider. It distinguishes those workflows from a basic SDK runtime and an OpenAI-managed Agents API harness.
Correction, 21 October 2026: This page previously claimed sandboxing ensured an agent could never leak data or disrupt operations. That guarantee was unsupported and has been removed. A sandbox's protection depends on the environment and the access granted to it.
Define the boundary you are relying on
A sandbox can separate an execution workspace from other resources. It does not answer every question about what the agent can read or do. A mounted directory, a network destination or an external tool can create a path beyond the local process boundary.
OpenAI's self-hosted environment documentation concerns the Agents API rather than the SDK, but illustrates an important credential distinction: keep the application API key outside the sandbox and use an appropriately scoped environment credential for its intended connection. Do not copy configuration between those two products without checking the relevant documentation.
Review the complete action path
Before relying on an agent workflow, record:
| Surface | Question to answer |
|---|---|
| Files | Which paths can be read or modified, and what persists after the run? |
| Network | Which destinations are reachable, including through tools outside the sandbox? |
| Credentials | What can each credential authorize, and can generated code read it? |
| Actions | Which changes affect external systems and how are they controlled? |
| Recovery | What can be restored after a mistake, and what requires a separate corrective action? |
The table is a review method, not a claim about every provider's default configuration. A workspace snapshot should not be assumed to reverse a message, payment or remote database write that already occurred.
Test the intended environment
Use a disposable task and verify both an allowed action and an action intended to be denied. Keep the configuration and observations with the result. Retest when mounts, tools, credentials or provider settings change, because the effective boundary can change even when the model stays the same.
For related application-layer failures, see our analysis of agent trust surfaces. AI Mastery has not penetration-tested every provider supported by the SDK; this article explains the documented architecture and the questions a deployment review should resolve.
Related Reading
OpenAI Pipeline: 948 Linux Kernel LPEs at $1,279 Each
OpenAI's autonomous Linux kernel run produced 948 unique LPEs at $1,279 each, with per-stage costs, orchestration data, and a kernelCTF comparison.
Four-Step Exploit Chain Let Attackers Hijack ChatGPT Accounts
Parameter Labs chained four weaknesses in ChatGPT's HTML preview to create a shareable URL that silently exfiltrated any signed-in user's data.
Cloudflare Optional OAuth Scopes Let Developers Gate What Users May Drop
Cloudflare adds an optional_scopes array to OAuth clients, letting developers declare which permissions users may deselect at consent — built for MCP agent deployments.