SandboxesClient
Source: leap0/_sync/sandbox.py
Signature
Section titled “Signature”SandboxesClient(transport: Transport, *, sandbox_domain: str | None = None, sandbox_factory: SandboxFactory[SandboxData | SandboxStatus, SandboxT] | None = None)Overview
Section titled “Overview”Create, inspect, pause, and delete sandboxes.
Sandboxes are isolated execution environments with their own compute, filesystem, and network boundary.
Attributes: None.
Methods
Section titled “Methods”create
Section titled “create”create(*, template_name: str = DEFAULT_TEMPLATE_NAME, vcpu: int = DEFAULT_VCPU, memory_mib: int = DEFAULT_MEMORY_MIB, timeout_min: int = DEFAULT_TIMEOUT_MIN, auto_pause: bool = False, otel_export: bool | None = None, telemetry: bool | None = None, env_vars: dict[str, str] | None = None, network_policy: NetworkPolicyDict | None = None, http_timeout: float | None = None) -> SandboxT | SandboxData | SandboxStatusCreate a new sandbox from a template.
Args:
template_name: Name of the template to use.
vcpu: Number of virtual CPUs (1 to 8).
memory_mib: Memory in MiB (512 to 8192, must be even).
timeout_min: Sandbox timeout in minutes (1 to 480, default 5).
auto_pause: Automatically pause the sandbox into a snapshot on timeout.
otel_export: Inject OpenTelemetry exporter environment into the sandbox.
Requires OTEL_EXPORTER_OTLP_ENDPOINT in the local environment and
also forwards OTEL_EXPORTER_OTLP_HEADERS when present.
telemetry: Deprecated alias for otel_export. Use otel_export instead.
env_vars: Environment variables to set inside the sandbox.
network_policy: Outbound network policy for the sandbox.
http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: SandboxT | SandboxData | SandboxStatus: Created sandbox object.
pause(sandbox: SandboxRef, http_timeout: float | None = None) -> SandboxT | SandboxData | SandboxStatusPause a running sandbox.
Args: sandbox: Sandbox ID or object. http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: SandboxT | SandboxData | SandboxStatus: Updated sandbox object.
get(sandbox: SandboxRef, http_timeout: float | None = None) -> SandboxT | SandboxData | SandboxStatusGet the latest sandbox metadata.
Args: sandbox: Sandbox ID or object. http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: SandboxT | SandboxData | SandboxStatus: Current sandbox object.
delete
Section titled “delete”delete(sandbox: SandboxRef, http_timeout: float | None = None) -> NoneTerminate and delete a sandbox.
Args: sandbox: Sandbox ID or object.
invoke_url
Section titled “invoke_url”invoke_url(sandbox: SandboxRef, path: str = '/', *, port: int | None = None) -> strBuild an HTTPS URL that routes directly to the sandbox.
Args: sandbox: Sandbox ID or object. path: Path used by this operation. port: Port number for the generated URL.
Returns: object: Result returned by this operation.
websocket_url
Section titled “websocket_url”websocket_url(sandbox: SandboxRef, path: str = '/', *, port: int | None = None) -> strBuild a WSS URL that routes directly to the sandbox.
Args: sandbox: Sandbox ID or object. path: Path used by this operation. port: Port number for the generated URL.
Returns: object: Result returned by this operation.