Operational Realities of Running Codex and Claude Code on Your Own Infrastructure Versus Handing It to a Managed Platform
Self-hosting moves execution in-house, but inference still leaves your perimeter.

Running Codex or Claude Code in the cloud without managing infrastructure means choosing managed execution, but the layers can still be split across providers. With a bring-your-own API key cloud coding agent runner, how inference is billed and how isolation works are separate questions that the cloud-hosting label alone cannot answer. The operational choice is layered, with residency, fleet ownership, throughput, verification, and cost each imposing a different constraint.
How Codex and Claude Code actually split compute from inference
The inference plane processes model requests, while the execution plane runs the agent’s tools, repository operations, and builds. These layers can be separated, but not completely. In Claude Code’s self-hosted environments, Anthropic still handles model inference and session routing and keeps the transcript, while the customer provides the infrastructure for execution. Repository location therefore does not establish where all repository-derived context goes.
The supported inference routes also have specific boundaries. Inference cannot be redirected to Microsoft Foundry or an LLM gateway, while Bedrock and Google Cloud’s Agent Platform are supported through runner configuration. A customer-controlled runner should not be confused with a customer-controlled model.
OpenAI develops the Codex CLI, app-server, and SDK as open-source components. That makes the harness inspectable, but provides neither free inference nor ownership of managed orchestration. OpenAI’s Agents API, announced September 10, 2026, runs the harness as a managed service, including orchestration and long-running sessions. Developers choose execution on OpenAI-managed infrastructure, their own infrastructure, or sandbox partners including Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop, and Vercel. This partner roster identifies execution options and leaves bring-your-own-key support and isolation to be assessed separately.
Should most teams run Claude Code or Codex in the cloud without managing infrastructure?
Anthropic’s guidance favors Anthropic-hosted environments for most teams because they require no infrastructure to run or maintain. That is the practical starting point. Self-hosting adds runner lifecycle management, image maintenance, egress policy work, Git credential engineering, and on-call responsibility for execution. Unless control over that layer solves a concrete problem, it transfers work without establishing a corresponding gain.
Anthropic’s preview announcement identifies three reasons organizations accepted that burden. They needed access to internal services and databases without public-internet exposure, internal compilers and SDKs installed before sessions began, or source code and build artifacts kept in-house for compliance. Each reason concerns a specific execution boundary. The benefit is not self-hosting in the abstract, but access, readiness, or residency that the hosted environment cannot provide.
For some organizations, the trade-off is not legally available. Artifact residency can require in-house execution, while restrictions on external inference can rule out even that hybrid arrangement. Code context still crosses to Anthropic’s API in self-hosted mode, and the Agents API currently supports data residency only in the United States and does not support Zero Data Retention. Neither offering has a fully air-gapped path.
The compliance ceiling: what self-hosted environments solve and what they still don't
Self-hosted Claude Code execution keeps repository checkouts, build outputs, secrets, and files created or modified by the session inside the customer’s perimeter. That is a meaningful but bounded form of residency. Prompts, responses, tool results, and the session transcript still cross to Anthropic’s API for inference. Anthropic stores the transcript for session continuity, so local artifact storage does not mean all session information remains local.
The network connection has a narrower boundary than the information flow. Runners use outbound-only HTTPS to api.anthropic.com, and corporate egress proxies are supported. This outbound-only arrangement addresses inbound connectivity while still allowing the outbound transfer of inference context.
Production access introduces a separate accountability requirement under the SOC 2 framing. Agent actions must be attributable to a named identity, limited to that identity’s permissions, and recorded where the actor cannot alter the record. The controls that apply here cover restricted access under CC6.1, unauthorized software under CC6.8, activity monitoring under CC7.2, and change management under CC8.1. The evidence includes the policy configuration, a record of the session, and proof that changes went through review. Running locally does not by itself provide that assurance.
Complete air-gapping sits beyond these arrangements. It requires inference through a self-hosted or on-premises model, which the current Claude Code architecture does not support. The architectural distinction is therefore between keeping artifacts local and keeping every inference input local, rather than between two broadly labeled “secure” deployment modes.
Fleet management: what the platform team inherits when execution moves in-house
Anthropic explicitly advises planning for a platform or developer-experience team to own setup and ongoing maintenance. That team builds the runner image, operates the fleet, and controls the network boundary. Ownership extends beyond the initial deployment. A startup with two platform engineers absorbs this work differently from a Series B organization with a dedicated DevEx team, even when both need the same execution controls.
Fixed mode keeps a set number of runners continuously available, fitting predictable workloads while incurring idle cost. On-demand mode uses an orchestrator to watch queued sessions, start runners when work arrives, and stop them when finished. Bursty usage favors that second pattern. It also fits existing CI/CD infrastructure that already starts and stops machines, though the organization still owns the runner lifecycle.
Isolation and recovery add further fleet behavior. A runner locks to one user’s account when it claims its first session, preventing checked-out code from mixing between users. If it stops polling for an extended period, the server requeues the session to another runner. Faire’s George Jacob describes how self-hosted environments bring Claude Code into existing workflows and keep security and operational controls in place, with compute that scales with demand to support PR generation, CI fixes, and developer workflow events.
Coordination now extends across machines as well. Claude Code v2.1.224 added SendMessage and ListAgents, allowing a long-running refactoring session to coordinate with shorter-lived sessions handling subtasks. That replaces the workarounds previously needed for this coordination. It also makes the execution fleet a substrate for coordinated work rather than merely a collection of independent development sessions.
Parallel agent workflows at scale: where managed and self-hosted diverge in practice
Codex Cloud lets coding agents run in parallel through cloud-based triggers, Goal Mode, and a large library of plugins. Agents work directly inside repositories, make cross-file changes, execute unit tests, and open pull requests autonomously. For complex tasks, they can generate multiple implementation previews for human selection.
Production volumes show the scale of that shift. Stripe’s internal Minions agent produces more than a thousand PRs per week, while Ramp reports that agents account for more than half of its merged PRs. Spotify Honk passed more than a thousand AI-generated merges through November 2025. These figures describe different measures and periods. They establish substantial agent activity, but do not establish a common infrastructure requirement or prove that one hosting model caused the volume.
OpenAI’s internal data platform illustrates a broader execution pattern. It serves thousands of internal users across hundreds of petabytes and tens of thousands of datasets. Codex-powered agents monitor pipelines, trace anomalies such as stalled jobs or schema drift, and sometimes restart jobs or reallocate resources. They then generate fixes, validate them, and prepare them for deployment.
Anthropic-hosted sessions have a concrete resource envelope. Each receives roughly four vCPUs, sixteen GB of RAM, and thirty GB of disk, and large builds can be stopped. Sessions also stop after inactivity, when the VM is reclaimed. Builds that need a lot of memory, work that needs to keep running, and bursts of parallel sessions each run into different limits. At that point, the laptop-or-managed binary becomes a fleet-design question about where work runs and how execution capacity follows demand.
PR review and test verification as the quality gate agents still need
More parallel execution moves pressure downstream into review. A fleet can make changes faster, but those changes may still need work before they are ready to ship. Managed and self-hosted environments share this problem because execution ownership does not establish correctness. Review and verification belong in the infrastructure design, with agents building, running tests, and verifying changes in a real environment before opening a pull request.
Testμ 2026’s banking demonstration made that loop concrete. A Sentry alert for an internet banking failure reached Slack and triggered an agent session without a human prompt. The elapsed time was eight to nine minutes. Rather than beginning an investigation after being woken at midnight, the engineer could wake to a reviewable package with CI green.
A rushed, unscoped instruction to fix whatever failed and get CI green was followed by a separate review agent finding multiple bugs. One generated a blank slug for every fully non-Latin article title. The failure connects prompt scope to verification design, because a broad instruction can produce changes that pass one gate while failing another. Scoped work, real-environment testing, and review belong in the agent workflow before throughput rises.
Cost structure across managed, self-hosted, and cloud agent platforms
Deployment modes expose different units of cost. Managed offerings can bundle platform support, admin tooling, centralized billing, SSO, spend caps, and usage analytics. With self-hosted execution, the engineering organization runs the infrastructure again and still pays for inference separately. The comparison depends on what the platform fee replaces and what the team must operate.
Cursor’s tiers range from a free plan through Plus, limited to Grok models, Premium, Super, and Ultra, to a Teams plan billed per user per month. That structure differs from a bill assembled from inference, execution, and internal operations. Small teams can reasonably read managed pricing at face value when it avoids runner ownership. Larger teams need to work out costs for their actual workloads, including what they would pay beyond the direct API bill.
Stoneforge explicitly notes that breakeven depends on specific usage patterns. Predictable demand can leave fixed runners well used, while bursts can make on-demand execution more economical. Neither pattern removes image maintenance, network policy, or operational support. Those responsibilities remain part of the comparison even when they do not appear on the inference invoice.
Devin illustrates a different forecasting problem. In practice, ACU charges for a power-user can rise far above the base price, and credits and quotas can make it hard to predict what a team will spend. The base price is only one input.
How the decision actually layers for engineering leaders at different org stages

For seed-stage and small teams, managed execution is almost always the right place to start. With the Claude Code Team plan or the Codex managed service, teams have no runners to operate or fleets to maintain, while per-seat costs are usually acceptable and compliance constraints are rarely pressing. Cloud sessions become useful when work needs to persist after the laptop closes. This choice follows from limited operational capacity, with suitability for eventual workloads remaining a separate question.
Series B-range teams face a different coordination problem. Shared environments, Slack and Linear integration, and visibility across a larger team become more important. Decisions about parallel agents become a team-level concern. A dedicated platform team may also have capacity to own runners when compliance or throughput requires it. The decision shifts from whether infrastructure ownership is possible to whether its benefits justify that ownership.
Regulated enterprises encounter residency as an earlier gate. When code artifacts cannot leave the perimeter, self-hosted execution is necessary, and Anthropic’s self-hosted environments are available in public beta on Team and Enterprise. Residual inference exposure remains a separate decision. Organizations that cannot let context cross to the model API need another way to handle inference, because neither platform offers the fully air-gapped path described here.
The decision process consequently starts with artifact residency, then tests whether the team can operate the required execution environment. If it cannot, managed hosting cannot simply override the residency constraint. Throughput comes next, with fleet design or a cloud agent platform entering when workloads exceed managed-session resources. Verification remains a requirement across those choices, and pricing must be predictable at current and projected team size. For platform and DevEx teams at scale, the final question is which layer to own, including execution, orchestration, or both.


