Skip to main content
PATCH
Update environment

Authorizations

Authorization
string
header
required

A Recursion API key, created in the console under API keys.

Headers

Idempotency-Key
string

Replay-protection key in an organization-wide namespace shared by keyed mutations. It must contain 1 to 256 visible ASCII characters and be sent as exactly one header value. Request identity is the exact HTTP method, escaped path, raw query, and raw body bytes. For the legacy automation-run route only, the historical fingerprint ignores top-level JSON formatting and object-key order and removes the retired top-level idempotency_key field. The same request replays the original successful response; any different request returns 409 idempotency_conflict, and an active matching request returns 409 idempotency_in_progress. Completed receipts are retained for approximately 24 hours, pending claims may be reclaimed after approximately 1 hour, and no deduplication is guaranteed after expiry.

Required string length: 1 - 256
Pattern: ^[!-~]+$
x-tenant-id
string

Optional tenant consistency check. When present, it must name the tenant bound to the API key, including when x-organization-id is default.

Minimum string length: 1
x-organization-id
string

Organization in which to act. Required for a tenant-scoped API key. Optional for an organization-scoped key, where it must name that same organization. The value may be an organization id or default.

Minimum string length: 1

Path Parameters

environmentId
string<uuid>
required

Environment id (UUID) as returned by managedAgentsCreateEnvironment or managedAgentsListEnvironments.

Body

application/json

Writable fields for a partial environment update. Omitted fields keep their stored values; null is not accepted.

computerUse
boolean

Whether the environment boots the shared interactive browser display.

config
object

Provider-specific overflow settings. Omit to keep them; send {} to clear them.

description
string

Free-text note about what this environment provides. Send an empty string to clear it.

envVars
object

Plaintext environment variables. Omit to keep them; send {} to clear them.

expectedAccess
object
write-only

Required when a Runs PATCH changes or bypasses a nonempty network policy, or enables privileged Docker. Copy networkPolicy and privileged from the last environment read; a stale snapshot is rejected.

httpPort
integer<int64>

Port inside the sandbox to expose over HTTP; 0 exposes nothing.

Required range: 0 <= x <= 9007199254740991
idleStopAfterSeconds
integer<int64>

Seconds of inactivity after which a running sandbox is stopped, from 120 to 2592000 (30 days); 0 uses the provider default.

Required range: 0 <= x <= 7200
metadata
object

Caller-owned key/value data. Omit to keep it; send {} to clear it.

mounts
object[]

Files staged into the sandbox workspace. Omit to keep them; send [] to clear them.

name
string

Human-readable label shown wherever environments are listed.

networkPolicy
object

Internet access for Runs environments. Omit to keep the current setting; send {} for unrestricted access. A nonempty policy limits destinations and cannot be combined with privileged Docker when changing access settings. Choose a compatible placement for limited access.

privileged
boolean

Whether the Runs sandbox may use privileged Docker. When changing access settings, privileged Docker requires unrestricted internet access (networkPolicy: {}). Omit to keep the current value, or send false to disable it.

provider
string

Sandbox runtime that executes the session, chosen from the sandbox providers catalog.

pvcSizeGi
integer<int64>

Size in GiB of the persistent workspace volume; 0 uses the provider default.

Required range: 0 <= x <= 100
resources
object

Caller-sized CPU and memory, accelerator, lifetime, and placement constraints. Send an empty object to return to provider sizing defaults.

scope
string

Who may use the environment. Defaults to organization, meaning it is shared across the owning organization.

secrets
object

Deprecated. Must be empty or omitted; a non-empty map is rejected. Environment secret references are no longer supported: store secret values as vault credentials and attach them to the session with vault IDs or credential references. Send {} to clear references stored before the field was retired.

setup
object

Setup script run after the sandbox is provisioned and before the agent starts. Send an empty script to clear it.

stoppedDeleteAfterSeconds
integer<int64>

Seconds after a sandbox stops before it may be released, from 3600 (an hour) to 2592000 (30 days); 0 uses the service default. This does not expire the session. Send another message to resume it; /workspace files can be used when its workspace reopens.

Required range: 0 <= x <= 9007199254740991

Response

A standalone sandbox environment a session executes in.

A standalone sandbox environment a session executes in.

computerUse
boolean
required

Whether this environment boots the shared interactive Chromium display used by the computer and human-handoff tools. The server projects this to httpPort 6901.

createdAt
string<date-time>
required
read-only

Server-assigned RFC 3339 timestamp of when the environment was created.

environmentId
string
required
read-only

Server-assigned id of the environment; pass it when starting a session that should run in this sandbox.

name
string
required

Human-readable label shown wherever environments are listed.

organizationId
string
required
read-only

Organization that owns the environment. Server-assigned from the caller's credentials.

provider
string
required

Sandbox runtime that executes the session, chosen from the sandbox providers catalog.

resources
object
required

Caller-sized CPU and memory for CPU environments, or one exclusive accelerator with service-owned limits of 8,000 millicores (8 vCPU) and 32,768 MiB (32 GiB) of memory for GPU environments, plus lifetime and placement constraints.

scope
string
required

Who may use the environment. Defaults to organization, meaning it is shared across the owning organization.

setup
object
required

Setup script run after the sandbox is provisioned and before the agent starts.

updatedAt
string<date-time>
required
read-only

Server-assigned RFC 3339 timestamp of the most recent update to the environment.

config
object

Provider-specific overflow settings this schema does not model. Passed to the provider unchanged.

description
string

Free-text note about what this environment provides.

envVars
object

Plaintext environment variables exported in the sandbox. They become the whole container environment, including the runner entrypoint's, so PATH is refused (env_vars.PATH): managed images select /workspace/.venv themselves. A Runs session using one-time setup after its runner changes also refuses startup-hook names such as BASH_ENV, HOME, PYTHONPATH, and LD_PRELOAD; re-test to capture a compatible image instead. Never put secrets here; store them as vault credentials instead. On update, omit to keep the current variables; send {} to clear them.

httpPort
integer<int64>

Port inside the sandbox to expose over HTTP for services the agent starts; 0 exposes nothing.

Required range: 0 <= x <= 9007199254740991
idleStopAfterSeconds
integer<int64>

Seconds of inactivity after which a running sandbox is stopped, from 120 to 2592000 (30 days); 0 uses the provider default. A computer-enabled environment requires 0 or at least 600 seconds so its five-minute handoff heartbeat arrives before idle-stop.

Required range: 0 <= x <= 9007199254740991
image
string
read-only

Container image the sandbox boots. Omit to use the provider's default image. For the Agent runner provider only the deployment's own runner repository or a sibling published beside it (for example rma-runner-recursion) is accepted, and it must be omitted when an accelerator is requested, which always boots the platform's GPU runner. Customize the sandbox itself with setup.script.

metadata
object

Caller-owned key/value data stored with the environment and returned unchanged.

mounts
object[]

Files or objects staged into the sandbox workspace when it is created. On update, omit to keep the current mounts; send [] to clear them.

networkPolicy
object

Internet access for Runs environments. An empty object means unrestricted access.

privileged
boolean

Whether a Runs sandbox may use privileged Docker. Privileged Docker requires unrestricted internet access (networkPolicy: {}) on create or when changing access settings. Omit on update to keep the current value, or send false to disable it. New Runs environments and transitions from another provider default to false. Existing environments with both limited internet access and privileged Docker remain visible and allow edits to other settings. To start a new session, set networkPolicy: {} or disable privileged Docker.

pvcSizeGi
integer<int64>

Size in GiB of the persistent workspace volume; 0 uses the provider default.

Required range: 0 <= x <= 9007199254740991
secrets
object

Deprecated and always empty for new environments. Environment secret references are no longer supported; use vault credentials instead. An environment stored with references cannot start sessions or setup runs until an update sends {} to clear them; clearing them marks the setup verdict stale, so re-test afterwards.

setupUpdatedAt
string<date-time>
read-only

RFC 3339 timestamp of the last setup script change. Server-assigned.

setupUpdatedByUserId
string
read-only

User who last changed the setup script. Server-assigned.

setupVerification
object
read-only

Server-owned verdict on the setup script: whether a manual or automatic setup run has proven this exact configuration on real compute. Read status and stale before starting sessions; read lastRun.hint first when status is failed.

setupWarnings
object[]
read-only

Advisory findings about the setup script (bash -lc wrapping, curl | sh, unpinned installs, ambiguous system Python, PATH replacement, or non-persistent shell activation), plus legacy_setup_discarded when the stored setup predates setup.script and is not run. Never block a save; computed on read.

stoppedDeleteAfterSeconds
integer<int64>

Seconds after a sandbox stops before it may be released, from 3600 (an hour) to 2592000 (30 days); 0 uses the service default. This does not expire the session. Send another message to resume it; /workspace files can be used when its workspace reopens.

Required range: 0 <= x <= 9007199254740991
template
object

Reviewed template revision used to create this environment.