OpenAI Technical Staff Member Michael Bolin Explains Why Codex Chooses OS-Native Sandboxes Over Containers
Codex does not use Docker or virtual machine isolation; instead, it calls upon macOS Seatbelt, Linux bubblewrap with seccomp-bpf, and Windows MXC to constrain command file system and network access within the user's existing environment. The article provides specific implementation mechanisms and configuration examples for all three platforms.
AI coding agents need to execute commands on the user's local machine, which creates a core contradiction: the agent must have access to dependencies such as compilers, runtimes, and SDKs, yet be restricted from arbitrarily reading sensitive files or uploading data externally. In an article, Michael Bolin, a member of OpenAI's technical staff, presents Codex's solution: rather than moving computation into containers or virtual machines, Codex leverages each operating system's native sandboxing mechanisms to constrain commands running in the user's existing environment.
This design choice is driven by specific reasons. Bolin uses iOS development as an example: if Codex were running inside a Docker container, it would be unable to invoke the iOS build toolchain composed of native Mac executables, nor could it launch the iPhone simulator. Delegating builds and simulator operations to the host machine means these operations fall outside the container's sandbox and require separate restrictions. The Codex team's judgment was that, rather than maintaining two layers of isolation, it is better to invest resources in building native sandboxes for each platform, allowing commands to always run in the environment most suitable for the task.
On macOS, Codex utilizes Apple's Seatbelt mechanism, applying policies written in Sandbox Profile Language (SBPL) via the /usr/bin/sandbox-exec command. SBPL is a Scheme-based language; Codex's baseline policy begins with (deny default), blocking all outbound connections by default and only opening explicitly allowed ports. When a network proxy is enabled, rules are injected into the policy to allow connections to the local HTTP proxy (localhost:3128) and SOCKS proxy (localhost:8081). The article notes that SBPL is not documented by Apple for third-party use, and the sandbox-exec command is marked as deprecated in its man page. However, macOS still provides Seatbelt configuration files in /usr/share/sandbox, and software such as Google Chrome continues to rely on it, so Codex plans to continue using it.