OpenAI has published a technical explanation of the Codex sandbox, the mechanism that controls what the agent can do when it runs commands directly on the user's computer. The starting point is simple: Codex works in the environment the user already has, so clear boundaries on files and network are needed.
A sandbox limits what a program can touch while it runs. For example, to sort photos you might let commands read and modify the pictures folder while blocking network access to prevent uploads. For a code review, you might allow access to online documentation while keeping source files read-only. These constraints are set through permission profiles that define file system and network restrictions for each session.

Image: OpenAI — https://openai.com/codex/
The default choices
The default profile, called :workspace, allows writes only inside the project folder while keeping folders such as .git and .codex read-only. Codex can edit code without asking for approval on every change, but cannot directly alter its configuration or Git hooks.
File reads stay broad, because compilers, runtimes and build tools depend on SDKs and libraries installed outside the project. Limiting reads to the workspace would break many ordinary workflows. The trade-off is that sensitive files elsewhere on the machine, such as configuration files holding API keys, may remain readable.
Network access is disabled. This blocks attempts to send data to external services, but it also prevents downloading dependencies, which requires separate authorization.
OpenAI acknowledges these limits do not eliminate every risk. An agent could, for instance, inject malicious code into an already installed package in the modules folder: a change Git might not flag, because that folder is often excluded from version control. If the user's editor runs that package on save, the malicious code would execute outside the sandbox. This is why the company pairs the sandbox with training and alignment of the model, which should steer its use toward the user's intent.
Why not containers or virtual machines
Virtual machines and containers are the most common ways to isolate a process. Codex takes a different route: rather than moving computation into a separate environment, it uses each operating system's native security tools to constrain commands inside the user's own environment.
The reason is practical. Many developers use their laptop as a customized workspace, and recreating it in a container takes effort. Developing an iOS app on a Mac makes the point: inside Docker, Codex could not run the build toolchain or launch the iPhone simulator. OpenAI therefore prefers to invest in OS-specific sandboxing so Codex can run in the environment best suited to the task.
The same programming interface is exposed on macOS, Windows and Linux. It takes a command and a permission profile and, when network access is partly allowed, requires a proxy that enforces the limits. Every child process inherits its parent's restrictions, including descendants that outlive the original process.
Who can customize permissions
The setup is meant for individual users and companies. Organizations can define stricter permission profiles and combine them with other protections. Developers who want to reuse the sandbox in their own tools can do so through the same API.
According to OpenAI, avoiding a virtual environment keeps the work closer to what users do every day, but it shifts part of the responsibility onto the correctness of each native mechanism. For now the company documents the available profiles and their consequences, leaving users to decide how much trust to grant the agent.
The topic is not new for AlexTech. Anthropic released sandbox-runtime, an open source technology that isolates processes on macOS and Linux with a similar approach, which we described in detail in this article. The comparison shows that access boundaries have become central to every agentic coding tool.

No comments yet. Be the first!