Skip to content

Python SDK

Install the SDK with pip install sic-agent-sandbox. It depends only on httpx. The reference below comes from the docstrings in agent_sandbox.client.

agent_sandbox.client.SandboxClient

Synchronous client.

base_url and api_key default to the AGENT_SANDBOX_URL and AGENT_SANDBOX_API_KEY environment variables.

create(image=None, *, cpus=None, memory_mb=None, pids_limit=None, network=False, read_only_rootfs=True, timeout_seconds=None, env=None)

Create a sandbox. Unset limits use the server defaults.

fork(snapshot, *, timeout_seconds=None, network=None, cpus=None, memory_mb=None)

Start a new sandbox from a snapshot.

agent_sandbox.client.Sandbox

A handle to one remote sandbox.

exec(command, *, env=None, workdir=None, timeout_seconds=None)

Run a command to completion.

exec_stream(command, *, env=None, workdir=None, timeout_seconds=None)

Run a command and yield output events as they arrive.

agent_sandbox.client.ExecResult dataclass

agent_sandbox.client.ExecEvent dataclass

One line of a streamed command: stdout, stderr, or exit.

agent_sandbox.client.SnapshotInfo dataclass

agent_sandbox.client.FileInfo dataclass

agent_sandbox.client.SandboxAPIError

Bases: Exception

An error response from the server.