Skip to content

Sandbox

Source: leap0/_sync/sandbox.py

Sandbox(client: object, data: SandboxData | SandboxStatus)

Sandbox object with bound service clients.

This object exposes sandbox metadata directly and provides bound service handles so you can call methods like sandbox.filesystem.read_file(...) instead of passing the sandbox object into every client call.

Attributes: filesystem: Bound filesystem client. git: Bound git client. process: Bound process client. pty: Bound PTY client. lsp: Bound LSP client. ssh: Bound SSH client. code_interpreter: Bound code interpreter client. desktop: Bound desktop client.

refresh() -> Sandbox

Refresh sandbox metadata in place.

Returns: Sandbox: This sandbox object with refreshed metadata.

pause(http_timeout: float | None = None) -> Sandbox

Pause the sandbox and update this handle with the latest metadata.

Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.

Returns: Sandbox: This sandbox object with updated metadata.

delete(http_timeout: float | None = None) -> None

Delete the sandbox.

Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.

invoke_url(path: str = '/', *, port: int | None = None) -> str

Build an HTTPS URL that routes directly to this sandbox.

Args: path: Request path inside the sandbox application. port: Port number for the generated URL.

Returns: str: Sandbox-scoped HTTPS URL.

websocket_url(path: str = '/', *, port: int | None = None) -> str

Build a WSS URL that routes directly to this sandbox.

Args: path: Request path inside the sandbox application. port: Port number for the generated URL.

Returns: str: Sandbox-scoped websocket URL.