OmniscioGuidesSelf-hosted environments
Running Claude Code cloud sessions on your own infrastructure
Most teams should not do this. Anthropic says so itself: Anthropic-hosted environments need no infrastructure to run or maintain, and self-hosting is for teams whose network, tooling or compliance requirements call for keeping session execution on infrastructure they control. This page is the architecture and the operational rules, so you can judge whether that trade is worth it before you start building runner images.
The nearest neighbour in this section is Claude Code on the web, which covers ordinary cloud sessions: starting one, watching it from a phone, and pulling it back with --teleport. This page assumes you understand cloud sessions and answers the different question of where they execute. If your team does not use cloud sessions at all, there is nothing here to configure, because a terminal or IDE session always runs on the developer's own machine; Remote Control is the other road, for driving an always-on machine from elsewhere.
Sources read November 23, 2026. By the Omniscio team. Updated .
The three parts, and what happens when a session starts
The mental model is a self-hosted CI runner, and Anthropic says exactly that. An environment groups runners; a runner claims queued sessions and executes them.
When a developer starts a cloud session, the session-start screen shows an environment picker listing Anthropic-hosted environments alongside any your organization created. If they choose yours, Anthropic's control plane puts the session on your environment's queue. A runner claims it, clones the repository the developer chose, and starts a Claude Code process on your host.
The runner authenticates to your git host with credentials you configure. Sessions reach your internal services from inside your network, and they can reach your internal git host the same way. Everything toward Anthropic — queue polling, the session's event stream, and by default model inference — is outbound HTTPS to api.anthropic.com.
| Term | What it is |
|---|---|
| Environment | A named group of your runners, created in claude.ai settings. Sessions route to an environment, never to an individual runner |
| Environment secret | The one shared credential runners use to register. It is shown once at creation and labelled environment key in the admin UI |
| Runner | The long-lived process you deploy. It registers with the environment, receives a runner token, and polls for sessions |
| Session | One Claude Code task, run as a child Claude Code process the runner spawns |
If you read Anthropic's API fields, token claims or metrics, the environment appears as pool and its ID as pool_id. Same thing, two spellings.
The rule that sizes your fleet: one owner per runner
This is the single most useful paragraph on the page, because it turns into a capacity number. A runner serves one owner at a time. The first session it claims locks it to that session's owner, and it then runs sessions only for that owner, up to the capacity set by --capacity. That is how checked-out code never mixes between people, without the runner having to wipe its disk between owners.
Who the owner is depends on how the session started. A session a person starts belongs to that person's account. A Claude Tag channel session has no user account attached, so the owner is the Claude Tag agent that started it — which means every channel session that agent starts shares one owner, whoever sent the Slack message.
So the minimum fleet size is the number of owners you expect to be active at once, counting users and Claude Tag agents. Capacity per runner raises throughput for one owner; it does not reduce the number of owners you have to serve.
What a session and a runner actually do
The session's life after a developer picks your environment:
- A runner with free capacity claims the session and holds a lease on it.
- The runner clones the repository into its working directory and spawns a child Claude Code process.
- The child streams events back over HTTPS while the runner keeps polling, and each poll refreshes the lease and doubles as the heartbeat.
- If the runner stops polling, the lease lapses after about 60 seconds, and the server can then take a few minutes and sometimes longer to requeue the session for another runner.
Each poll request is given 10 seconds. When a request times out, is lost, or comes back with something the runner cannot parse, the runner keeps serving its live sessions and retries after a second or two rather than waiting for the next scheduled poll. A good example is an intercepting proxy that answers the poll with its own page. The retry gap doubles each time, up to 20 seconds, and shortens whenever the lease is close to expiring.
When a runner stops
At the default --drain-grace-sec of 0, a runner exits as soon as its active sessions finish, without polling for more, so whatever runs it — Kubernetes, for instance — restarts it with a fresh disk ready for any owner. A positive value keeps it polling the locked owner's queue for that many seconds before exiting.
A SIGTERM needs no extra flag. If your infrastructure instead destroys hosts at a known wall-clock time with no signal, or with a grace period too short to drain — a sandbox lifetime cap, or spot-instance reclamation — pass --retire-at <epoch-seconds> a few minutes before that time. At the retire time the runner stops taking work, releases each active session through the same release path --release-idle-session-min uses so the session resumes on a fresh runner at the user's next message, and exits 0 once everything is released.
A turn that outlives the kill is still lost, and without --retire-at a signal-less host kill looks exactly like a crash: the control plane records a lost worker rather than a clean release.
The network paths to open
Nothing connects in from Anthropic. Everything is outbound, in four kinds:
- Control plane. The runner polls
api.anthropic.comfor work and posts setup-progress and failure events. Polling is also its heartbeat. - Git. The runner clones from and pushes to your git host over HTTPS or SSH with credentials your deployment provides. With the Anthropic git proxy, git traffic for github.com repositories goes through
api.anthropic.cominstead. - Session child. The child process holds the session's event stream to
api.anthropic.comand makes its own outbound calls for inference and for git commands run during the session. - SCM connector. The orchestrator's SCM connector is not available, so its tunnel does not open.
By default, model inference uses the Anthropic API: the control plane hands each session its endpoint and the session authenticates with an Anthropic-issued, session-scoped OAuth token. Corporate egress proxies are supported, and the runner and orchestrator honour the proxy and mTLS variables the network configuration page describes, such as HTTPS_PROXY and NO_PROXY, set in each process's environment.
One proxy requirement is easy to miss because it fails in a confusing way. Session streaming uses server-sent events over HTTPS, so a proxy in the path must not buffer responses. A runner can pick up a session and then never see Claude answer its first message.
What stays inside, and what does not
Be precise about this with your security team, because the name invites the wrong assumption. Repository checkouts, build artifacts, secrets and any files a session creates or modifies stay on the machines you provision. The conversation itself — prompts, responses and tool results — goes to api.anthropic.com, and Anthropic stores the transcript so the session can be resumed from another surface.
Even when a runner is configured to send model requests to Amazon Bedrock or Google Cloud's Agent Platform, the conversation still goes to api.anthropic.com in the session's event stream. And the control plane stays Anthropic-hosted: orchestration, queueing and the claude.ai interface keep running on Anthropic's infrastructure.
Availability and the exclusions to check first
| Area | Where it stands |
|---|---|
| Plans | Public beta on Team and Enterprise. Off by default; an Owner turns on Allow self-hosted environments on the Cloud environments admin page, which requires cloud sessions to be enabled for the organization |
| Zero Data Retention and HIPAA | Unavailable for organizations with Zero Data Retention enabled or the HIPAA configuration applied |
| Model inference | The Anthropic API by default. A runner configured for Bedrock or Agent Platform does not receive server-managed settings or claude.ai organization policies |
| Surfaces | claude.ai/code, the mobile and desktop apps, cloud scheduled tasks, the terminal with --cloud or an --environment dispatch, and Claude Tag sessions. Claude Security and Code Review do not route here yet |
| Repositories | GitHub or GitHub Enterprise Server; an --environment dispatch can also use another git host |
| Billing | Sessions consume your organization's Claude Code usage the same way Anthropic-hosted sessions do |
Two of these rows can end a project before it starts. If your organization has the HIPAA configuration applied, a self-hosted environment is not available to you at all; the two are exclusive. And a Claude Tag session that runs in one cannot use Access bundles yet.
What you get for the operational cost
Anthropic is direct about the trade: you build and maintain the runner image, operate the fleet, and control its network. In exchange you get three things.
- Network access. Sessions reach internal services, databases and registries without exposing them to the public internet.
- Custom tooling. Pre-install compilers, SDKs and internal CLIs in the runner image, so every session starts ready to build.
- Compliance. Checkouts and build artifacts stay on infrastructure you control — while remembering the conversation still goes to Anthropic.
Anthropic splits the rest of its documentation by task, and each page is the next step once you decide to build: a quickstart for a first session, a deploy page for security hardening and the Kubernetes and Compose recipes, a configuration page for wrapper scripts and on-demand runners, a testing page for a CI smoke test of a runner image, a reference for every flag and metric, and an identity page for validating a session token from your own services.
Common questions
What is a self-hosted environment?
A named destination created in claude.ai admin settings that runs cloud sessions on infrastructure you operate. It groups runners, which claim and execute queued sessions.
Does everything stay inside our network?
No. Checkouts, artifacts, secrets and created files stay put, but the conversation goes to api.anthropic.com and Anthropic stores the transcript.
How many runners do we need?
One per concurrently active owner, counting users and Claude Tag agents, because a runner locks to a single owner.
What happens if a runner stops polling?
Its lease lapses after about 60 seconds and the server can take a few minutes to requeue the session.
Does it work with HIPAA or zero data retention?
No. Both exclude self-hosted environments.
Which sessions cannot use one?
Claude Security and Code Review do not route to self-hosted environments yet.
Every session, one window
Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view. Any model, any harness — Claude Code, Codex, OpenCode, Devin, Pi, and Hermes all supported.