AsyncSandboxClient

class baseten.sandbox.AsyncSandboxClient(*, api_key, team_id=None, token_provider=None, base_url_override=None, headers=None, retry=None, http2=None, http_client_override=None, close_http_client_on_close=None)

Bases: object

Async form of SandboxClient.

Can be used as an async context manager to ensure the underlying HTTP client is closed on exit.

Parameters:
  • api_key (str)

  • team_id (str | None)

  • token_provider (AsyncSandboxTokenProvider | None)

  • base_url_override (str | None)

  • headers (Mapping[str, str] | None)

  • retry (SandboxRetryOptions | None)

  • http2 (bool | None)

  • http_client_override (httpx.AsyncClient | None)

  • close_http_client_on_close (bool | None)

async close()

Close the client, optionally closing the underlying HTTP client.

Return type:

None

async create(*, name=None, create_if_not_exists=None, image=None, memory=None, region=None, envs=None, labels=None, external_id=None, lifecycle=None, ports=None, network=None, filesystem=None)

Create a sandbox. As SandboxClient.create().

Parameters:
Return type:

AsyncSandboxCreateResult

async delete(*, name)

Delete a sandbox. As SandboxClient.delete().

Parameters:

name (str)

Return type:

SandboxInfo

async get(*, name: str) → AsyncSandbox
async get(*, info: SandboxInfo) → AsyncSandbox

Get an AsyncSandbox to work in. As SandboxClient.get().

Parameters:
Return type:

AsyncSandbox

async get_info(*, name, show_secrets=None)

Get a sandbox’s current record. As SandboxClient.get_info().

Parameters:
  • name (str)

  • show_secrets (bool | None)

Return type:

SandboxInfo

property http_client: AsyncClient

The underlying HTTP client.

property images: AsyncImageClient

Images that sandboxes are created from.

async list(*, query=None, statuses=None, external_id=None, page_size=None)

List sandboxes. As SandboxClient.list().

Parameters:
  • query (str | None)

  • statuses (Sequence[Literal['DEPLOYING', 'DEPLOYED', 'FAILED', 'DEACTIVATING', 'DEACTIVATED', 'DELETING', 'TERMINATED', 'ARCHIVING', 'ARCHIVED', 'UNARCHIVING', 'BUILDING', 'UPLOADING'] | str] | None)

  • external_id (str | None)

  • page_size (int | None)

Return type:

AsyncIterator[SandboxInfo]

property options: SandboxClientOptions

Client options.

property raw_api: AsyncApiClient

The generated management API client, authenticated for sandboxes.

For operations this SDK does not wrap. The generated API surface is not covered by stability guarantees and may change between versions.

sandbox_from_url(*, url)

Get an AsyncSandbox for a URL. As SandboxClient.sandbox_from_url().

Parameters:

url (str)

Return type:

AsyncSandbox

async update(*, name, lifecycle=None, envs=None, external_id=None, labels=None)

Update a sandbox’s configuration. As SandboxClient.update().

Parameters:
Return type:

SandboxInfo