Environment fields
Send these fields tocreateEnvironment and updateEnvironment. An update is partial: omitted fields keep their saved values.
Fields the service sets
These appear in responses. The service sets them, so don’t send them.
For an Agent runner environment, responses always include
network_policy and privileged. A network_policy of {} means unrestricted.
Runtimes
The runtime (provider) decides what kind of sandbox the environment runs on. listSandboxProviders returns the runtimes API clients can choose, with a displayName, description, and default flag. The list is the same for every organization.
The console uses the catalog’s default runtime and does not show a runtime control. API clients still send
provider when creating an environment; an existing environment’s provider cannot be changed.
What the sandbox starts with
Every environment starts from the Agent runner image: Debian-based Linux with Python 3 and uv, Node.js and npm, git, curl, and apt. There is nosudo; setup and sessions already run as root. Add anything else in the setup script. The agent’s working directory is /workspace.
Environment templates
listEnvironmentTemplates returns reviewed starting points. Each has an id, a revision, a name and summary for the console card, and a definition in the createEnvironment request shape. The console’s Choose a starting point cards fill the create form from the same list. See Start from a template.
Compute
resources sizes the sandbox. Omit it, or choose Use platform default in the console, to use the service’s default size.
In the console, expand Compute, set Compute kind to GPU, and pick a GPU model. Each model shows its memory and whether one is free now; availability is checked again when a sandbox starts.
For CPU sizes, the console offers these shortcuts, in 250-millicore and 1024-MiB steps:
Choose Custom and move the sliders for any other size, up to 24 vCPU (24000) and 100 GiB (102400).
How sizes are checked:
- CPU and memory must fit one machine together. A pair that no machine offers is rejected with
400 invalid_request, and the message names the most memory available at that CPU size. - Available compute can lower the ceiling. CPU environments never exceed 24 vCPU or 100 GiB. The current provider catalog and a restricted network policy, including the default no-internet policy, can impose a smaller maximum; a rejected save returns
400 invalid_requestwith the current limit. - Changing compute makes the setup verdict stale. Run setup again after you resize.
Workspace and lifecycle
Message the same session to reopen its workspace after an idle stop or later release. Its
/workspace files can be used when the workspace reopens successfully. If it cannot reopen, contact support. Delete the session separately when you no longer need it. The API checks these ranges when you save; run a setup test afterward to verify the complete environment configuration.
Sandbox paths
Who shares a sandbox
- Each top-level session gets its own fresh sandbox from the environment. Sessions never share files through an environment.
- Subagents and teammates run in their root session’s sandbox, so they can hand work over by file path. See Multi-agent.
- A change to the environment affects only sandboxes started after it. Running sessions keep the configuration they started with.
Setup
How the script runs:
- As root without the setuid and setgid capabilities, in a separate bash login shell with
set -eo pipefail. The first failing line ends the run. There is nosudo. Run apt asapt-get -o APT::Sandbox::User=root ..., and point it athttpssources: the image’s default apt sources usehttp, and a restrictive network policy can block port 80 and the image’s other sources. - With the environment’s
env_vars,mounts, and network policy. In a setup run, session credentials such as vault grants are never available to it. - Exports,
source, aliases, and shell functions don’t carry over to the agent’s commands.
setup replaces the whole object, and {"script": ""} removes the script.
Setup warnings
setup_warnings lists advice. Warnings never block a save or a run.
Each warning has a
code, a one-based line (0 when it’s about the save), and a message.
Setup verification
setup_verification tells you whether the setup script has passed for the environment’s current configuration. When a script exists, a session can start only when status is verified, stale is false, and the service kept a reusable image from the passing run. Otherwise startSession returns 422 environment_not_verified.
Changes that make the verdict stale:
provider, setup (script or timeout), resources, pvc_size_gi, env_vars, mounts, network_policy, and privileged. Changes that don’t: name, description, metadata, computer_use, idle_stop_after_seconds, and stopped_delete_after_seconds.
Last-run summary
Setup runs
A setup run executes the setup script on fresh compute, records its output, checks the compute, saves a reusable image, and releases the compute. Saving an environment never starts compute. After the save succeeds, callcreateEnvironmentSetupRun with its own Idempotency-Key to start a run.
Setup-run statuses
Only a failure in the
setup phase points at your script. A run can succeed even if saving the reusable image fails; the console then shows Setup passed, but its reusable image failed. and sessions can’t start until a later run saves one.
Setup-run log lines
getEnvironmentSetupRunLog returns lines, a next_after cursor, the run’s status, and truncated.
Setup-run parameters
Network policy
network_policy decides which hosts the sandbox can reach. It governs the setup script, the agent’s commands, package managers, git, and websites the sandbox browser opens. Model calls, the agent’s MCP servers, and the web_search and web_fetch tools don’t go through the sandbox, so the policy doesn’t affect them.
- A session started by an automation or from Slack, in an environment with any restricted policy (limited or no internet access), doesn’t get the
web_fetchtool. - Tools of built-in integration apps, such as Jira and Confluence, run inside the sandbox. Recursion adds the hosts they need to a policy limited to specific hosts when a session’s sandbox is created, unless a rule of yours denies that exact host; a no-access policy blocks them. The same applies to a GitHub grant that reaches the sandbox; see Hosts common tools need.
How rules apply:
- Rules are checked in order. The first rule that matches a host decides.
- Outbound traffic that no rule allows is blocked.
- A rule allows or blocks a whole host. Once allowed, sandbox code can send any request to it, including uploads.
- Unknown fields are rejected with
400 invalid_request.
Common policies
Hosts common tools need
A secret stored in a vault (an environment variable or an MCP bearer token) never opens the network: if the agent uses it from inside the sandbox, the policy must allow the host. A GitHub grant that reaches the sandbox is different: when a session starts on new compute, Recursion adds the GitHub hosts above to a policy with host rules, ahead of your rules, including a policy that allows everything except named hosts. A rule of yours that denies one of those exact hosts is kept and the host is not added; a broader pattern such as
*.github.com is not consulted. The no-internet policy stays closed, and a running sandbox keeps the policy it was created with. The added rules count toward the 200-rule limit, so leave room for them. Cloning a public repository without a GitHub grant still needs the hosts in your rules. See Authenticate with vaults and GitHub access.
Defaults and updates
- Create: omitting
network_policy, or sendingnull, stores{"version": "v1", "rules": []}: no internet. Send{}for unrestricted access. - Update: omitting
network_policykeeps the saved policy. A value you send replaces the whole policy. - Privileged Docker: a nonempty policy cannot be combined with
privileged: trueon create or when access settings change. Use{}for unrestricted access before enabling privileged Docker. - Access precondition: a PATCH that changes a saved policy other than
{}(including the default no-internet policy), or turnsprivilegedon, must includeexpected_accesswith thenetwork_policyandprivilegedvalues from your last read. Missing returns428 precondition_required; out of date returns412 precondition_failed. - Console: Internet access sets Enabled (
{}) or No access (no rules). A host-rule policy, saved or from a template, shows as Only these hosts when it only allows hosts, or Custom host rules when it also blocks hosts or allows*, and lists its hosts read-only. Choosing Enabled or No access replaces it. - Verification: any policy change makes the setup verdict stale.
Privileged Docker
privileged: true lets the agent run Docker containers inside the sandbox. It’s false by default and requires unrestricted internet access (network_policy: {}). The console’s Privileged Docker access checkbox is available after you choose Internet access → Enabled. Changing either setting does not silently change the other. Turning privilege on needs expected_access in a PATCH and makes the setup verdict stale. If an existing environment has both limited internet access and privileged Docker, you can view it and edit other settings. To start a new session, enable unrestricted internet access or turn off privileged Docker. If no compute is available for the requested settings, saving or starting a session fails.
Computer use
computer_use: true adds a shared browser display to the sandbox, which the agent controls with the computer tool. You can follow the recorded screens in the session. The service sets http_port to 6901 for the display. When the agent needs a person for a step such as a sign-in, it calls handoff_to_user and the session waits in awaiting_human; see Sessions.
idle_stop_after_secondsmust be0or at least 600.- The browser follows the network policy. Under a restricted policy, allow each site the agent must visit.
- Turning computer use on or off doesn’t make the setup verdict stale.
Environment variables
env_vars is a map of names to plain-text values exported in the sandbox. Anyone who can view the environment can read the values, and so can any code the agent runs. Never put secrets here; use vaults instead.
PATHis rejected. The sandbox already selects/workspace/.venv; call tools by full path or prepend to$PATHinside a command.- Variables the shell, the loader, or Python read at startup are rejected too:
BASH_ENV,HOME,SHELLOPTS,PS4,PYTHONPATH,PYTHONHOME,PYTHONUSERBASE,PYTHONWARNINGS,PYTHONPLATLIBDIR,LD_PRELOAD,LD_AUDIT,LD_LIBRARY_PATH,GCONV_PATH, andBASH_FUNC_*. Set one inside the command that needs it instead, for examplePYTHONPATH=/workspace/src python main.py. - In an update,
env_varsreplaces the whole map. Send{}to clear it. - Changing variables makes the setup verdict stale.
Mounts
mounts downloads files into the workspace when a sandbox starts, so the agent finds input data on disk at its first turn.
- Two mounts can’t use the same path or one inside the other.
- Mounts are checked when a sandbox starts, not when you save. An invalid mount makes provisioning fail, so run a setup test after you change mounts.
- Anyone who can view the environment can read each
sourceURL. Don’t embed long-lived credentials in it. - In an update,
mountsreplaces the whole list. Send[]to clear it.
Sandbox tools that depend on the environment
The agent’s tools run in the sandbox this environment defines. A few depend on its settings. For the full tool list, see Tools.
A tool being available never grants network access.
Environment lifecycle
Limits
For every product limit, see Limits.
Next steps
Set up an environment
Create, verify, restrict, update, and delete environments.
Deliverables and artifacts
How agents save files to the outputs folder and how they’re collected.
Security
What reaches the sandbox and how credentials flow.
Troubleshooting
Fix common session and environment problems.