Skip to content

Sandbox

Create, connect to, list, pause, resume, fork and kill sandboxes, and the sandbox’s own settings.

Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.

Python TypeScript Go Ruby Java

One sandbox, with optional short-lived data-plane access from create/connect/resume.

run_code and the *_code_context methods need a template with the interpreter kernel (code-interpreter-all).

Python exposes these as methods; see below.

def connect(cls, sandbox_id: str, *, timeout_seconds: int | None=None, on_resume: str | None=None, wait: bool=True, request_timeout: float | None=None, client: SandboxClient | None=None) -> 'Sandbox'
static

A handle to sandbox_id with fresh data-plane access. **This resumes a paused sandbox** (and may extend its timeout): use Sandbox.get for a handle that leaves a paused sandbox paused. on_resume is how a paused sandbox comes back: "restore" (the default) brings back its memory and processes, "reboot" keeps only the disk and boots the guest cold from it (a sandbox paused with mode="filesystem" always reboots). It is ignored for a running sandbox. The API answers once a resume is accepted; with wait (the default) this follows the sandbox until it has left resuming/starting, as resume does, so commands and files work at once. wait=False returns at once.

Parameter Type Default
sandbox_id str
timeout_seconds int | None None
on_resume str | None None
wait bool True
request_timeout float | None None
client SandboxClient | None None

Returns 'Sandbox'

Source: sdk/python/svm/sandbox.py:307
def create(cls, *, template: str='base', timeout_seconds: int=300, metadata: dict[str, str] | None=None, envs: dict[str, str] | None=None, cpu_count: int | None=None, memory_mb: int | None=None, disk_mb: int | None=None, network: dict[str, Any] | None=None, secure: bool=True, auto_pause: bool=False, profile: str | None=None, gpu: str | None=None, volume_mounts: list[dict[str, Any]] | None=None, git_credentials: list[dict[str, str]] | None=None, bucket_mounts: list[dict[str, Any]] | None=None, snapshot_id: str | None=None, mcp_servers: list[dict[str, Any]] | None=None, name: str | None=None, lifecycle: dict[str, Any] | None=None, private_network: bool=False, idempotency_key: str | None=None, wait: bool=False, prefer_wait_seconds: int | None=None, request_timeout: float | None=None, client: SandboxClient | None=None) -> 'Sandbox'
static
Parameter Type Default
template str 'base'
timeout_seconds int 300
metadata dict[str, str] | None None
envs dict[str, str] | None None
cpu_count int | None None
memory_mb int | None None
disk_mb int | None None
network dict[str, Any] | None None
secure bool True
auto_pause bool False
profile str | None None
gpu str | None None
volume_mounts list[dict[str, Any]] | None None
git_credentials list[dict[str, str]] | None None
bucket_mounts list[dict[str, Any]] | None None
snapshot_id str | None None
mcp_servers list[dict[str, Any]] | None None
name str | None None
lifecycle dict[str, Any] | None None
private_network bool False
idempotency_key str | None None
wait bool False
prefer_wait_seconds int | None None
request_timeout float | None None
client SandboxClient | None None

Returns 'Sandbox'

Source: sdk/python/svm/sandbox.py:243
def get(cls, sandbox_id: str, *, request_timeout: float | None=None, client: SandboxClient | None=None) -> 'Sandbox'
static

A handle to sandbox_id without data-plane access, and without changing its state: a paused sandbox stays paused. Lifecycle calls (get_info, pause, resume, kill, snapshots, fork) work; commands and files need resume() or Sandbox.connect first.

Parameter Type Default
sandbox_id str
request_timeout float | None None
client SandboxClient | None None

Returns 'Sandbox'

Source: sdk/python/svm/sandbox.py:327
def list(cls, *, state: str | list[str] | None=None, metadata: dict[str, str] | None=None, template: str | None=None, page_size: int | None=None, page_token: str | None=None, request_timeout: float | None=None, client: SandboxClient | None=None) -> SandboxPage['Sandbox']
static

One page of the team’s sandboxes. **Without state this includes killed, failed and lost ones** (the API’s default, kept for history); pass state=Sandbox.LIVE_STATES for the ones that exist now.

Parameter Type Default
state str | list[str] | None None
metadata dict[str, str] | None None
template str | None None
page_size int | None None
page_token str | None None
request_timeout float | None None
client SandboxClient | None None

Returns SandboxPage['Sandbox']

Source: sdk/python/svm/sandbox.py:356

Not in the Python SDK’s Sandbox.

def attach_domain(self, domain: str, port: int) -> dict[str, Any]
from SandboxExtras

Serve port on a custom domain the team claimed with create_domain (it serves once verify_domain passes).

Parameter Type Default
domain str
port int

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:183
def backup(self, directory: str, *, provider: str, bucket: str, secret_name: str, prefix: str | None=None, request_timeout: float | None=600.0) -> dict[str, Any]
from SandboxExtras

Archive directory into the team’s bucket (provider is s3, gcs or azure_blob) with the credentials of the team secret secret_name, which never enter the sandbox. The result is the backup: pass it to restore_backup.

Parameter Type Default
directory str
provider str
bucket str
secret_name str
prefix str | None None
request_timeout float | None 600.0

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:148
browser: Browser

Property (read-only).

Accessibility-tree browsing through the sandbox’s Playwright MCP server (INT-014); needs the browser template.

Not in the Python SDK’s Sandbox.

Not in the Python SDK’s Sandbox.

Not in the Python SDK’s Sandbox.

commands

Property (read-only).

def connect_by_name(cls, name: str, *, timeout_seconds: int | None=None, on_resume: str | None=None, wait: bool=True, request_timeout: float | None=None, client: SandboxClient | None=None) -> 'Sandbox'
static

Connect to the team’s live sandbox that has name, resuming it if it is stopped (see connect for on_resume and wait).

Parameter Type Default
name str
timeout_seconds int | None None
on_resume str | None None
wait bool True
request_timeout float | None None
client SandboxClient | None None

Returns 'Sandbox'

Source: sdk/python/svm/sandbox.py:345
def create_code_context(self, cwd: Optional[str]=None, language: Optional[str]=None, request_timeout: Optional[float]=None) -> Context
from CodeInterpreterMixin

A new kernel context for language (python by default) working in cwd.

Parameter Type Default
cwd Optional[str] None
language Optional[str] None
request_timeout Optional[float] None

Returns Context

Source: sdk/python/svm/code_interpreter.py:229
def create_snapshot(self, *, name: str | None=None, idempotency_key: str | None=None, request_timeout: float | None=120.0) -> dict[str, Any]
from SandboxExtras

Snapshot this sandbox; the result carries snapshot_id. A snapshot of a large sandbox takes a minute or more, so the call waits up to request_timeout (120 s) instead of the client’s default.

Parameter Type Default
name str | None None
idempotency_key str | None None
request_timeout float | None 120.0

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:256
def delete_backup(cls, object_name: str, *, provider: str, bucket: str, secret_name: str, client: 'SandboxClient | None'=None) -> None
from SandboxExtras

Delete one backup object (its object_name as backup or list_backups returned it) from the team’s bucket, without a sandbox. Deleting an object that is already gone is not an error.

Parameter Type Default
object_name str
provider str
bucket str
secret_name str
client 'SandboxClient | None' None
Source: sdk/python/svm/sandbox_extras.py:295
def delete_snapshot(cls, snapshot_id: str, *, client: 'SandboxClient | None'=None) -> None
from SandboxExtras
Parameter Type Default
snapshot_id str
client 'SandboxClient | None' None
Source: sdk/python/svm/sandbox_extras.py:275
desktop: DesktopClient

Property (read-only).

Computer-use controls for a sandbox created from the desktop template.

def egress(self) -> dict[str, Any]
from SandboxExtras

The layer-7 egress rules, with ca_certificate (trust it in the guest) and proxy_url (set as HTTPS_PROXY).

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:135
def egress_proxy(self) -> dict[str, Any]
from SandboxExtras

This sandbox’s customer egress proxy setting and the one in force (effective_source, effective_url).

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:242
files

Property (read-only).

def fork(self, count: int=1, *, metadata: dict[str, str] | None=None, timeout_seconds: int | None=None, idempotency_key: str | None=None, request_timeout: float | None=300.0) -> list['Sandbox']
from SandboxExtras

Copy this running sandbox, memory, disk and running processes, into count children in one call. This sandbox is paused for the capture and keeps running; no snapshot is left behind. The call waits up to request_timeout (300 s), since writing a large guest’s memory takes a while. The children carry this sandbox’s metadata unless metadata is given ({} for none), so a cleanup that selects by metadata finds them too. timeout_seconds is each child’s lifetime (the API’s default is 300 s).

Parameter Type Default
count int 1
metadata dict[str, str] | None None
timeout_seconds int | None None
idempotency_key str | None None
request_timeout float | None 300.0

Returns list['Sandbox']

Source: sdk/python/svm/sandbox_extras.py:324
def forward_local(self, port: int, *, local_port: int=0, host: str='127.0.0.1')

Listen on host:local_port (0 asks for a free port) and forward each connection to port in the sandbox, over the envd port forward (ports.forward), one stream per connection.

Returns a LocalForward: its url and port say where to point a browser; close() stops it.

Parameter Type Default
port int
local_port int 0
host str '127.0.0.1'
Source: sdk/python/svm/sandbox.py:453
def from_snapshot(cls, snapshot_id: str, *, count: int=1, metadata: dict[str, str] | None=None, timeout_seconds: int | None=None, client: 'SandboxClient | None'=None) -> list['Sandbox']
static · from SandboxExtras

Start count sandboxes from a snapshot, each connected and ready for commands and files. metadata tags every new sandbox and timeout_seconds sets its lifetime (the API’s default is 300 s); these are the create options the snapshot fork call takes (template, resources and the rest come from the snapshot).

Parameter Type Default
snapshot_id str
count int 1
metadata dict[str, str] | None None
timeout_seconds int | None None
client 'SandboxClient | None' None

Returns list['Sandbox']

Source: sdk/python/svm/sandbox_extras.py:303
def get_by_name(cls, name: str, *, request_timeout: float | None=None, client: SandboxClient | None=None) -> 'Sandbox'
static

The team’s live sandbox that has name (no data-plane access: connect it to run commands).

Parameter Type Default
name str
request_timeout float | None None
client SandboxClient | None None

Returns 'Sandbox'

Source: sdk/python/svm/sandbox.py:336
def get_host(self, port: int) -> str

The public host of port in this sandbox: <port>-<sandbox id>.<domain>, served over HTTPS (HTTP, WebSocket and SSE) for as long as something listens on the port. A sandbox created with secure=True (the default) also wants its access.traffic_access_token in the X-Traffic-Access-Token header; the token changes when the sandbox resumes. Needs a handle from create, connect or resume, which carry the domain.

Parameter Type Default
port int

Returns str

Source: sdk/python/svm/sandbox.py:436
def get_info(self, *, request_timeout: float | None=None) -> SandboxInfo
Parameter Type Default
request_timeout float | None None

Returns SandboxInfo

Source: sdk/python/svm/sandbox.py:463
def get_mcp_token(self) -> str | None
from SandboxExtras

The gateway’s traffic token. Send it in the X-Traffic-Access-Token header, not Authorization: Bearer (401); None when secure=False. Secret; it changes when the sandbox resumes, so fetch it again after a resume.

Returns str \| None

Source: sdk/python/svm/sandbox_extras.py:237
def get_mcp_url(self) -> str
from SandboxExtras

The index URL (https://<port>-<id>.<domain>/mcp) of this running sandbox’s MCP gateway; a GET lists the servers. Send MCP JSON-RPC to <url>/<server name>, with get_mcp_token in the X-Traffic-Access-Token header (Authorization: Bearer is refused with 401).

Returns str

Source: sdk/python/svm/sandbox_extras.py:231
def get_snapshot(cls, snapshot_id: str, *, client: 'SandboxClient | None'=None) -> dict[str, Any]
from SandboxExtras

One snapshot of the caller’s (snapshot_id, name, source_sandbox_id, template_id, size_bytes, metadata, created_at; a snapshot listed is ready to restore, it has no state field).

Parameter Type Default
snapshot_id str
client 'SandboxClient | None' None

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:270
git

Property (read-only).

Clone, status, branches, commit, push, pull, remotes and config with git in the sandbox.

id: str

Property (read-only).

def identity_token(self, audience: str, *, ttl_seconds: int | None=None) -> dict[str, Any]
from SandboxExtras

A short-lived OIDC token (token, expires_at) naming this sandbox, its team and template, for a cloud provider that trusts the issuer (e.g. AWS AssumeRoleWithWebIdentity with audience="sts.amazonaws.com").

Parameter Type Default
audience str
ttl_seconds int | None None

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:223
def inbound(self) -> dict[str, Any]
from SandboxExtras

The inbound allowlist of this sandbox’s public URLs and custom domains (allow_cidrs; empty means open).

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:173

Not in the Python SDK’s Sandbox.

Not in the Python SDK’s Sandbox.

def is_running(self) -> bool
from SandboxExtras

Whether the sandbox is running right now (asks the API; does not use the cached state).

Returns bool

Source: sdk/python/svm/sandbox_extras.py:112
def kill(self, *, request_timeout: float | None=None) -> bool
from SandboxExtras

Stop and delete the sandbox. True when it existed, False when it was already gone, so a cleanup can call it twice. A second kill on the handle that killed it returns False without a request. Another handle of a sandbox that has already ended may still get True: the API’s kill is idempotent and answers success for an ended sandbox.

The server waits up to 30 s for a sandbox that is still starting, pausing or resuming before it stops it, so the default wait here is longer than the client’s usual timeout.

Parameter Type Default
request_timeout float | None None

Returns bool

Source: sdk/python/svm/sandbox_extras.py:93
def list_backups(cls, *, provider: str, bucket: str, secret_name: str, prefix: str | None=None, page_token: str | None=None, page_size: int | None=None, client: 'SandboxClient | None'=None) -> dict[str, Any]
from SandboxExtras

One page of the backup objects in the team’s bucket, without a sandbox: &#123;"items": [&#123;"object\_name", "size\_bytes", "modified\_at"&#125;], "next\_page\_token"&#125;. prefix is the one the backups were created with (every object under it is listed; the whole bucket without one). It names a folder, not the start of a name: nightly lists nightly/... and is the same as nightly/, while night lists nothing of it. Pass next_page_token back as page_token for the next page (absent on the last). secret_name is the team secret holding the bucket credentials, as for backup.

Parameter Type Default
provider str
bucket str
secret_name str
prefix str | None None
page_token str | None None
page_size int | None None
client 'SandboxClient | None' None

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:279
def list_code_contexts(self) -> List[Context]
from CodeInterpreterMixin

Returns List[Context]

Source: sdk/python/svm/code_interpreter.py:233
def list_snapshots(cls, *, source_sandbox_id: str | None=None, client: 'SandboxClient | None'=None) -> list[dict[str, Any]]
from SandboxExtras

The caller’s snapshots, optionally only those of one sandbox.

Parameter Type Default
source_sandbox_id str | None None
client 'SandboxClient | None' None

Returns list[dict[str, Any]]

Source: sdk/python/svm/sandbox_extras.py:264
lsp

Property (read-only).

Completions, definitions, references and diagnostics from a language server in the sandbox.

mcp_approvals

Property (read-only).

Decide tool calls the MCP gateway holds for approval, and read its audit log (INT-010).

metrics

Property (read-only).

The sandbox’s own CPU, memory, disk and process figures (see MetricsClient).

def open_tunnel(self, port: int)

A raw TCP tunnel to port inside the sandbox (see Tunnel).

Parameter Type Default
port int
Source: sdk/python/svm/sandbox.py:448
def otel_export(self) -> dict[str, Any]
from SandboxExtras

The OpenTelemetry export in force for this sandbox: its own, or the team’s (scope). Header values are never returned.

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:187
def pause(self, *, wait: bool=False, mode: str | None=None, request_timeout: float | None=None) -> SandboxInfo

Pause the sandbox. mode="memory" (the default) keeps memory and disk; mode="filesystem" keeps only the disk (written to the object store), so the sandbox reboots when it resumes and a request to its URL does not wake it.

Parameter Type Default
wait bool False
mode str | None None
request_timeout float | None None

Returns SandboxInfo

Source: sdk/python/svm/sandbox.py:491
ports

Property (read-only).

The ports listening in the sandbox and TCP forwards to them (see PortClient).

def private_network(self) -> dict[str, Any]
from SandboxExtras

This sandbox’s name and address on its team’s private network, and its teammates with reachable (same host only).

Create the sandbox with private_network=True to join; otherwise this raises NotFoundError.

Returns dict[str, Any]

Raises NotFoundError

Source: sdk/python/svm/sandbox_extras.py:166
pty

Property (read-only).

def record_tool_call(self, name: str, *, started_at: datetime | str, duration_ms: int, run_id: str | None=None, call_id: str | None=None, status: str='ok', error_type: str | None=None, model: str | None=None, input_tokens: int | None=None, output_tokens: int | None=None, cost_usd: float | None=None, effect_ids: list[str] | None=None, tool_type: str | None=None, attributes: dict[str, str] | None=None) -> dict[str, Any]
from SandboxExtras

Report a tool call the agent made in its own process as a GenAI execute_tool span in this sandbox’s trace, with the run, its tokens and cost, and the effects-ledger ids it caused. exported in the result is False when no export is in force.

Parameter Type Default
name str
started_at datetime | str
duration_ms int
run_id str | None None
call_id str | None None
status str 'ok'
error_type str | None None
model str | None None
input_tokens int | None None
output_tokens int | None None
cost_usd float | None None
effect_ids list[str] | None None
tool_type str | None None
attributes dict[str, str] | None None

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:205
def refresh_access(self) -> SandboxAccess

Fetch the data-plane access again now, through the sandbox’s connect call. The clients do this on their own when the sandbox rejects the token (and shortly before expires_at when there is one). The platform re-issues the sandbox’s current token, so the result is usually the same token: only a resume rotates it, and it ends with the sandbox. Today the access carries no expires_at (None): the token has no fixed lifetime. A changed token is not a sign the refresh worked, nor an unchanged one that it failed.

Returns SandboxAccess

Source: sdk/python/svm/sandbox.py:228
def remove_code_context(self, context: Union[Context, str]) -> None
from CodeInterpreterMixin
Parameter Type Default
context Union[Context, str]
Source: sdk/python/svm/code_interpreter.py:244
def restart_code_context(self, context: Union[Context, str]) -> Context
from CodeInterpreterMixin
Parameter Type Default
context Union[Context, str]

Returns Context

Source: sdk/python/svm/code_interpreter.py:237
def restore_backup(self, backup: dict[str, Any], *, directory: str | None=None, request_timeout: float | None=600.0) -> dict[str, Any]
from SandboxExtras

Unpack a backup into directory (the directory it was taken from by default), after checking its SHA-256.

Parameter Type Default
backup dict[str, Any]
directory str | None None
request_timeout float | None 600.0

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:157
def resume(self, *, timeout_seconds: int | None=None, on_resume: str | None=None, wait: bool=True, request_timeout: float | None=None) -> SandboxInfo

Resume a paused sandbox; on_resume is as for connect.

Parameter Type Default
timeout_seconds int | None None
on_resume str | None None
wait bool True
request_timeout float | None None

Returns SandboxInfo

Source: sdk/python/svm/sandbox.py:505

Not in the Python SDK’s Sandbox.

def rollout(self, n: int, **options: Any) -> 'Rollout'
from SandboxExtras

Fan this sandbox out into n branches, run a command in each and score it: rollouts.create(self, n, ...) with the same options (command or script, verifier, keep, wait, …). The command’s stdout reaches a command or script verifier on its stdin (a script also has it in $SVM_STDOUT).

Parameter Type Default
n int
options Any optional

Returns 'Rollout'

Source: sdk/python/svm/sandbox_extras.py:342
def run_code(self, code: str, language: Optional[str]=None, context: Optional[Union[Context, str]]=None, on_stdout: Optional[Callable[[OutputMessage], Any]]=None, on_stderr: Optional[Callable[[OutputMessage], Any]]=None, on_result: Optional[Callable[[Result], Any]]=None, on_error: Optional[Callable[[ExecutionError], Any]]=None, envs: Optional[Dict[str, str]]=None, timeout: Optional[float]=None, request_timeout: Optional[float]=None) -> Execution
from CodeInterpreterMixin

Run code in a stateful kernel and return its Execution (results, logs, error). Without context it runs in the sandbox’s default context for language (python by default); envs runs it in a scratch context with those variables. The on_* handlers see output as it arrives. Raises ExecutionTimeoutError after timeout seconds (60 by default).

Parameter Type Default
code str
language Optional[str] None
context Optional[Union[Context, str]] None
on_stdout Optional[Callable[[OutputMessage], Any]] None
on_stderr Optional[Callable[[OutputMessage], Any]] None
on_result Optional[Callable[[Result], Any]] None
on_error Optional[Callable[[ExecutionError], Any]] None
envs Optional[Dict[str, str]] None
timeout Optional[float] None
request_timeout Optional[float] None

Returns Execution

Raises CodeInterpreterError, ExecutionTimeoutError

Source: sdk/python/svm/code_interpreter.py:201
sessions

Property (read-only).

Persistent shell sessions that keep the working directory and exports between runs.

def set_egress_proxy(self, mode: str, *, url: str | None=None, username: str | None=None, password: str | None=None, identity_audience: str | None=None) -> dict[str, Any]
from SandboxExtras

Send allowed egress through the customer’s proxy (mode="proxy", url="http://host:port"), directly ("none"), or as the team says ("inherit"). Applies while layer-7 egress rules are enabled.

Parameter Type Default
mode str
url str | None None
username str | None None
password str | None None
identity_audience str | None None

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:246
def set_lifecycle(self, *, auto_stop_seconds: int | None=None, auto_archive_seconds: int | None=None, auto_delete_seconds: int | None=None, on_timeout: str | None=None, auto_resume: bool | None=None, request_timeout: float | None=None) -> SandboxInfo

Replace the sandbox’s lifecycle timers; a timer left out is turned off. A new auto-stop timer is the deadline from now. on_timeout ("pause" or "kill") is what reaching the deadline does, and auto_resume whether a request to the paused sandbox’s public URL wakes it; unlike the timers, a value left out is left as it is.

Parameter Type Default
auto_stop_seconds int | None None
auto_archive_seconds int | None None
auto_delete_seconds int | None None
on_timeout str | None None
auto_resume bool | None None
request_timeout float | None None

Returns SandboxInfo

Source: sdk/python/svm/sandbox.py:475
def set_otel_export(self, endpoint: str | None=None, *, headers: dict[str, str] | None=None, service_name: str | None=None, enabled: bool=True) -> dict[str, Any]
from SandboxExtras

Send this sandbox’s spans (lifecycle, commands, files, and GenAI execute_tool spans for tool calls) to an OTLP/HTTP collector, overriding the team’s export. headers=None keeps the headers already set; enabled=False turns export off for this sandbox.

Parameter Type Default
endpoint str | None None
headers dict[str, str] | None None
service_name str | None None
enabled bool True

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:191
def set_timeout(self, timeout_seconds: int, *, request_timeout: float | None=None) -> SandboxInfo

Set the remaining lifetime from now; this can move the deadline earlier or later.

Parameter Type Default
timeout_seconds int
request_timeout float | None None

Returns SandboxInfo

Source: sdk/python/svm/sandbox.py:467
state: str

Property (read-only).

terminals

Property (read-only).

Long-lived tmux-style terminals an agent can type into and read.

tools

Property (read-only).

Token-cheap agent tools in the sandbox: view, search, repo_map, apply_patch and diagnostics, each with a budget.

def update_egress(self, *, enabled: bool, default: str, rules: list[dict[str, Any]] | None=None) -> dict[str, Any]
from SandboxExtras

Replace the layer-7 egress rules; applies within a second, without a restart. Each rule names action and one of domain and cidr, narrowed by port, methods, path and headers. An allow rule may carry "inject": Secret.inject(name, headers) (or Secret.iam_token(audience).inject(headers)): the egress proxy then replaces the placeholder (Secret.fill(name)) in those headers of the HTTPS requests the rule allows with the team secret or a fresh identity token of the sandbox. It works only while enabled, never over plain HTTP, and needs a current server.

Parameter Type Default
enabled bool
default str
rules list[dict[str, Any]] | None None

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:139
def update_inbound(self, allow_cidrs: list[str]) -> dict[str, Any]
from SandboxExtras

Admit only these client networks to the public URLs and custom domains; others get 403. [] opens them again. The edge applies a change within about 2 seconds (it caches the allowlist that long), so a request sent at once may still see the old list.

Parameter Type Default
allow_cidrs list[str]

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:177
def update_network(self, **policy: Any) -> dict[str, Any]
from SandboxExtras

Change the egress policy of the running sandbox, e.g. allow_internet_access=True or deny_out=[...].

Parameter Type Default
policy Any optional

Returns dict[str, Any]

Source: sdk/python/svm/sandbox_extras.py:131
def wait_until_running(self, timeout: float=120.0, interval: float=0.05) -> SandboxInfo
from SandboxExtras

Poll until the sandbox is running; raises TimeoutError if it is not within timeout seconds or has ended.

Parameter Type Default
timeout float 120.0
interval float 0.05

Returns SandboxInfo

Raises TimeoutError

Source: sdk/python/svm/sandbox_extras.py:116

Not in the Python SDK’s Sandbox.

Python TypeScript Go Ruby Java

SandboxInfo contains non-secret lifecycle metadata.

Property Type Description
end_at str
failure dict[str, str] | None
gpu str | None
lifecycle dict[str, Any] | None
metadata dict[str, str]
name str | None
private_network dict[str, str] | None
profile str | None
raw dict[str, Any]
sandbox_id str
started_at str
state str
template_id str
def from_json(cls, value: dict[str, Any]) -> 'SandboxInfo'
static
Parameter Type Default
value dict[str, Any]

Returns 'SandboxInfo'

Source: sdk/python/svm/sandbox_types.py:86
os: str | None

Property (read-only).

Guest OS derived from the server’s explicit VMM profile; unknown stays unknown.

Python TypeScript Go Ruby Java

SandboxPage is one control-plane page of sandbox records.

Not in the Python SDK’s SandboxPage.

Not in the Python SDK’s SandboxPage.

items: list[T]

Property (read-only).

next_page_token: str | None

Property (read-only).

Not in the Python SDK’s SandboxPage.

Python TypeScript Go Ruby Java

SandboxAccess holds one-time, short-lived data-plane credentials.

Property Type Description
data_plane_url str
domain str
envd_access_token str | None
expires_at str | None
git_config str | None
traffic_access_token str | None
def from_json(cls, value: dict[str, Any]) -> 'SandboxAccess'
static
Parameter Type Default
value dict[str, Any]

Returns 'SandboxAccess'

Source: sdk/python/svm/sandbox_types.py:45

Not in the Python SDK’s SandboxAccess.

Python TypeScript Go Ruby Java

Current data-plane access for one sandbox. refresh fetches a new SandboxAccess (the sandbox’s connect call).

Property Type Description
access SandboxAccess The access to use now, replaced first when it is within skew seconds of expiring.

Not in the Python SDK’s AccessHandle.

def metadata(self) -> tuple

Returns tuple

Source: sdk/python/svm/access.py:64

Not in the Python SDK’s AccessHandle.

def secrets(self) -> tuple[str, ...]

Returns tuple[str, ...]

Source: sdk/python/svm/access.py:68

Not in the Python SDK’s AccessHandle.

def unauthenticated(self, error: grpc.RpcError) -> bool

Whether error was the sandbox rejecting the token and the call may run again.

The first rejection of a token is retried with the same token after a short wait: a resume, a connect or a rotation mints a token just before the first call and the edge may not have seen it yet (it re-reads a changed record at most every 40 ms). Only a second rejection fetches a new token, which replaces (and so invalidates) the one every other caller holds, so it is the last resort and not the first.

Parameter Type Default
error grpc.RpcError

Returns bool

Source: sdk/python/svm/access.py:78
def unauthenticated_refresh(self) -> bool

Fetch a new access now; whether the token changed.

Returns bool

Source: sdk/python/svm/access.py:71

Not in the Python SDK’s AccessHandle.