AsyncSandboxesClient
Source: leap0/_async/sandbox.py
Signature
Section titled “Signature”AsyncSandboxesClient(transport: AsyncTransport, *, sandbox_domain: str | None = None, sandbox_factory: SandboxFactory[SandboxData | SandboxStatus, AsyncSandboxT] | None = None)Overview
Section titled “Overview”Create, inspect, pause, and delete sandboxes asynchronously.
Attributes: None.
Methods
Section titled “Methods”create
Section titled “create”async 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 = False, env_vars: dict[str, str] | None = None, network_policy: NetworkPolicyDict | None = None, http_timeout: float | None = None) -> AsyncSandboxT | 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).
auto_pause: Whether the sandbox should auto-pause 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.
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: AsyncSandboxT | SandboxData | SandboxStatus: Created sandbox object.
async pause(sandbox: SandboxRef, http_timeout: float | None = None) -> AsyncSandboxT | SandboxData | SandboxStatusPause the sandbox and return updated metadata.
Args: sandbox: Sandbox ID or object. http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: AsyncSandboxT | SandboxData | SandboxStatus: Updated sandbox object.
async get(sandbox: SandboxRef, http_timeout: float | None = None) -> AsyncSandboxT | 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: AsyncSandboxT | SandboxData | SandboxStatus: Current sandbox object.
delete
Section titled “delete”async 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 for this 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 websocket URL for this 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.