Dedicated server · monthly

Run Your Self-Hosted Executor on Dedicated Hardware

$465 / month · 128GB model
Start an order
DDR4 ECC SSH / RDP

2026 OpenAI Codex Self-Hosted Sandbox: How to Deploy It More Securely?

This guide is for developers and small teams moving Codex task execution to a remote Linux environment. It explains the difference between a self-hosted executor and remote Codex CLI use, then walks through isolation, secrets, connectivity, verification, and ongoing maintenance.

OpenAI documents the self-hosted environment’s connection as an outbound WebSocket from the user’s environment to the agent harness. That means this setup is for teams that need to control where agent commands run—not for hosting OpenAI’s model on their own server. Keep the executor isolated by user or workload, issue it a restricted environment key, and keep application API keys outside the sandbox. If the goal is simply to run Codex CLI on a remote machine, treat that as a different deployment choice. (Self-hosted environment connection flow)

Who this is for: AI application developers and small teams planning to run agent code on a remote Linux host.
Also useful for: Technical leads comparing a laptop, container, and remote execution environment before granting access to internal code or tools.

Last updated November 2, 2026. Technical details checked against OpenAI’s self-hosted environment documentation.

OpenAI Codex self-hosted sandbox deployment: define what runs where

The term “self-hosted” can be misleading. In the Agents API architecture, the agent harness handles orchestration, while the executor runs in an environment controlled by the user. The executor is where commands run and workspace files are accessed. Moving that environment to a remote Linux server changes the location of execution; it does not move model inference onto that server. OpenAI’s architecture overview describes the division of responsibility.

That distinction matters for cost, privacy, and system design. A remote server can keep a working directory and its execution tools under the team’s administration. It does not, by itself, mean that prompts or model processing stay entirely within that server. Teams with strict data-residency requirements should review the complete application and API data flow, not only the executor location.

The documented self-hosted environment can be a laptop, a container, or a remote sandbox. These are options, not interchangeable security guarantees. A container on a shared host still depends on host configuration and isolation boundaries. A remote server may offer more control over operating system access and lifecycle, but its network rules, account permissions, logs, and update process then become the operator’s responsibility.

Execution choice Best fit Main security and operating trade-off
Local laptop Development and controlled testing Convenient access to local tools, but the execution environment is tied to a user workstation and its existing credentials.
Container Reproducible tasks with a managed host Helps define dependencies and filesystem boundaries; isolation still relies on container and host configuration.
Remote Linux environment Persistent or centrally managed execution Separates execution from a developer’s workstation, but requires deliberate network, identity, patching, and log controls.
Remote Codex CLI session A person wants to use CLI tooling on a remote host This is not automatically the Agents API self-hosted executor flow; verify the desired workflow before configuring either one.

Is an OpenAI Codex self-hosted sandbox the same as running Codex CLI remotely?

No. The Agents API self-hosted flow connects an executor in a user-controlled environment to the agent harness. Running Codex CLI on a remote host is a separate way to use CLI tooling there. Similar terminology does not make the configuration, credentials, lifecycle, or security boundary the same.

Before deploying, write down which interface the application will use and which process will execute commands. Then follow the documentation for that path. Do not copy an executor setup into a remote CLI session, or assume that a CLI login provides the environment registration and connection behavior required by the Agents API. The command names and installation instructions can change; check the current Agents API configuration guide and the documentation for the exact CLI release in use.

Set boundaries before preparing the host

The first security decision is not the server size. It is what an agent may read, change, or contact. Start by identifying the users, repositories, tools, and data that each workload needs. A team’s internal code may be appropriate for an agent to inspect, while production credentials, unrelated repositories, and personal files usually are not.

OpenAI warns that agents sharing an execution environment may share access to files, credentials, and other resources in that environment. Treat a shared environment as a shared trust boundary, not as separate workspaces merely because requests are initiated by different people. Review the official sandbox security guidance before deciding whether workloads can share a host or container.

A useful boundary plan answers these questions:

  • Which repository and working directory are available to each executor?
  • Can a task read files outside its workspace?
  • Which local tools or MCP services are reachable, and what can they change?
  • Can the task access production systems, deployment credentials, or private package registries?
  • Which actions require a person to review or approve them?
  • What should happen to the environment and its files when a task ends?

Keep the initial scope narrow. Add repository access, tools, and network permissions only when a real task requires them. If a task can complete without production credentials or broad outbound access, do not include either “just in case.”

A successful connection only proves that the executor can connect. It does not prove that its filesystem, credentials, or network access are appropriately restricted.

Should Codex exec-server run in a container or on a remote server?

Choose the environment based on the boundary the team needs. A container is a reasonable fit when tasks need reproducible dependencies and the host can enforce strong isolation. A dedicated remote Linux environment may suit longer-running or centrally managed work, but it requires the same scrutiny of user permissions, process access, updates, logs, and outbound traffic.

The name Codex exec-server should not be treated as a universal deployment recipe. Confirm the current executor terminology and launch procedure in the official documentation for the Agents API flow being used. Avoid promoting a command copied from an older example into a production service without checking its version and supported configuration.

A container is not automatically safer than a remote server, and a remote server is not automatically isolated from other workloads. The meaningful questions are whether the executor can escape its intended workspace, whether another user or process can read its credentials, and whether it can reach systems beyond the approved list.

Prepare dependencies, identity, and outbound connectivity

Before installing anything, identify the required working directory, dependencies, and executor connection parameters from the current official instructions. Use a clean environment with only the packages and tools the repository needs. Pin dependencies where the project supports it, record how they are updated, and avoid embedding secrets in the image or build scripts.

Do not treat an example command, environment variable, or version number as a permanent production standard. The self-hosted environment guide is the reference for the current registration and connection flow. Recheck it when changing the executor build, rotating credentials, or moving the workload to another host.

What outbound connections does the Codex self-hosted execution environment need?

The documented connection uses an outbound WebSocket. Start with the destination and connection requirements in the current OpenAI documentation, then allow only what that deployment needs. The documentation supports checking the required outbound path; it is not a reason to assume that an inbound listener must be opened to the public internet.

The executor may also need access to package sources, a source-control service, or internal tools. Those are workload-specific destinations, not automatically part of the OpenAI connection requirement. Build an allowlist from the actual dependency and tool flow. If unrestricted outbound access is temporarily needed for diagnosis, make the exception explicit, time-limited, and reviewable.

Keep the host’s administration path separate from the agent’s task permissions. A service account should not inherit an administrator’s SSH identity or access to unrelated application directories. If the executor needs to fetch private dependencies, prefer a narrowly scoped credential for that purpose over a general-purpose account token.

How should environment keys and application API keys be separated?

Use an environment key for the executor’s environment connection, and manage application API keys separately. The executor key should be limited to its intended role and stored in a protected runtime secret mechanism. Application keys should remain in the application layer or another approved secret store—not in the agent’s workspace, source code, container image, command history, or routine logs.

This separation reduces the consequences of a workspace leak or an overly broad task. It does not eliminate risk: an agent that can read a secret at runtime may still be able to expose it through files, output, or a reachable service. Review the key’s scope, who can rotate it, and how revocation works before enabling execution.

For teams handling personal or confidential data, compare the planned data flow with the organization’s own retention and access rules. NodeKVM’s privacy information is relevant when assessing the hosting relationship; it does not replace a review of OpenAI’s API data handling or the team’s application controls.

Start the executor and verify the path with a safe test

Use a non-sensitive repository first. The purpose is to verify that registration, connection, command execution, workspace permissions, and cleanup behave as expected before internal code or tools are exposed.

Follow the current documented startup and registration procedure. Confirm that the environment reaches the expected connected state through the status events described in the official lifecycle documentation. If it does not, inspect the executor’s startup output, environment registration, network policy, and key handling. Avoid pasting secret values into diagnostic logs or support tickets. (Environment lifecycle and status)

A controlled test should verify each boundary separately:

  • Workspace: Confirm that permitted files can be read and changed, while unrelated directories are not available.
  • Command execution: Run a harmless command needed by the test repository. Confirm that the executor does not receive broader host privileges than intended.
  • Network: Check that the required connection works and that unapproved destinations remain unreachable.
  • Credentials: Verify that the task cannot read application secrets that should stay outside the sandbox.
  • Artifacts: Check where task outputs and changed files are stored, who can access them, and what the cleanup process removes. OpenAI’s file and artifact guidance describes the relevant handling model.
  • Disconnect and restart: Confirm that a disconnected executor can be diagnosed and brought back through the documented lifecycle, without exposing credentials during recovery.

A pass on these checks validates the deployment path. It does not prove that every generated command is safe or that the agent will never attempt an out-of-scope action. Keep review requirements in place for changes that can affect production, external services, or sensitive data. OpenAI’s Codex security practices discuss sandboxing, approval, and audit controls; apply the relevant principles to the team’s own environment.

Use this go-live checklist before granting repository access

The following checklist is the decision tool for a first controlled rollout. A blank item is a reason to delay access to sensitive code or systems.

  • [ ] The team has documented whether it is deploying the Agents API executor or using Codex CLI remotely.
  • [ ] Each workload has a defined workspace and a named owner responsible for its access.
  • [ ] The executor runs under a service identity that cannot administer the host or read unrelated user files.
  • [ ] Environment credentials are separate from application API keys and are not stored in source, images, logs, or workspace files.
  • [ ] Outbound access is limited to destinations required for the executor, dependencies, and approved tools.
  • [ ] The initial test used a non-sensitive repository and verified filesystem, command, network, and credential boundaries.
  • [ ] The team has a documented way to inspect connection state, handle errors, rotate keys, and revoke access.
  • [ ] Logs and artifacts have defined access and retention rules, with a cleanup process for temporary work.
  • [ ] A person reviews high-impact changes before they are applied to production systems.
  • [ ] The team has set a process for updating dependencies and rechecking official executor instructions.

If any control cannot be verified, keep the environment limited to a test workload. Do not resolve a failed check by granting broad host access or placing a more privileged key in the executor.

Maintain the environment as a production dependency

A remote executor needs an owner after the initial deployment. Schedule review of the environment’s dependencies, system updates, service identity, network allowlist, and secret scopes. Recheck these controls when the repository adds a new build tool, when a local MCP service is introduced, or when the executor moves between hosts.

Plan for failure and cleanup as well as normal operation. Decide how abandoned workspaces are removed, how logs are reviewed, and how a compromised key is revoked. Keep copies of required project data according to the team’s own backup policy; do not assume that an execution environment automatically provides a backup or recovery service. Check the official lifecycle documentation when changing how executors are started, stopped, or reconnected.

Server capacity should be assessed from the workload, not from an invented universal minimum. Measure repository size, dependency installation time, build behavior, simultaneous jobs, artifact growth, and log retention in a controlled trial. Those observations can inform CPU, memory, storage, and network requirements. They do not establish a general Codex performance guarantee.

The decision is also about operating model. A laptop can be simpler for occasional development. A container can be enough when an existing platform already enforces the required isolation. A remote server becomes more compelling when the team needs a centrally managed execution environment that stays available independently of an individual workstation. The trade-off is ongoing responsibility for patching, credentials, access review, and recovery.

For a long-running remote environment, a shared VPS or public-cloud instance may introduce noisy-neighbor contention, resource limits, or usage charges that are difficult to predict from a single test. A self-managed host also does not remove the need to configure isolation and backups. An exclusive AMD physical server is worth comparing when stable, dedicated compute and control over the operating system matter more than elastic, short-lived capacity. NodeKVM’s server and service information and current pricing and configuration page can be checked for the available systems, storage, access method, and billing terms before choosing. Neither page is a promise of Codex compatibility or a performance result; the executor should be tested against the selected environment before production use.

Dedicated server · monthly

Run Your Self-Hosted Executor on Dedicated Hardware

Deploy your task executor on a dedicated 32-core, 64-thread server. You can order before signing in.

$465 / month
CPUEPYC 7543P
Cores32c / 64t
Memory128 / 256GB ECC
Disks2×1TB direct
FacilityTokyo, Japan
AccessSSH / RDP
Setup feeNone