Skip to content

AsyncTemplatesClient

Source: leap0/_async/templates.py

AsyncTemplatesClient(transport: AsyncTransport)

Create, rename, and delete sandbox templates.

A template is a container image that has been converted into a sandbox root filesystem. Sandboxes are always created from a template.

Example:

template = client.templates.create(
name="my-template",
uri="docker.io/library/python:3.12",
)
print(template.id)

Attributes: None.

async create(*, name: str, uri: str, credentials: RegistryCredentials | RegistryCredentialsDict | None = None) -> Template

Upload a new template from a container image URI.

Args: name: Template name. Must not start with system/ or contain whitespace. uri: Container image URI to pull and convert (e.g. docker.io/library/python:3.12). credentials: Optional registry credentials for private images. Supports basic, AWS, GCP, and Azure authentication.

Returns: Template: Uploaded template metadata.

async rename(template_id: str, *, name: str, http_timeout: float | None = None) -> None

Rename an existing template.

Args: template_id: ID of the template to rename. name: New template name. http_timeout: Optional HTTP request timeout in seconds for this SDK call.

async delete(template_id: str, http_timeout: float | None = None) -> None

Delete a template by ID.

Args: template_id: ID of the template to delete. http_timeout: Optional HTTP request timeout in seconds for this SDK call.