Skip to content

Templates

A template defines the container image and startup configuration that sandboxes are created from. Create a template once, then use it to spawn any number of sandboxes.

If your template provides a desktop interface, expose it through the normal sandbox HTTP/WS path, such as noVNC, and use template-local automation APIs for screenshots, input, and recordings.

System templates are maintained by Leap0 and available to all accounts. Their names are prefixed with system/ and cannot be created or modified through the API.

TemplateDescription
system/code-interpreter:v0.1.0Python 3.12 and Bun runtimes with 50+ pre-installed data-science packages. Used with the Code Interpreter agent tool.
system/desktop:v0.1.0XFCE desktop sandbox with noVNC access, screenshots, input automation, window inspection, and screen recording. Used with the Computer Use (Desktop) agent tool.

Use a system template the same way you use your own. Pass its name as template_name when creating a sandbox.

Provide a name and a container image URI.

from leap0 import Leap0Client
client = Leap0Client()
template = client.templates.create(
name="python-fastapi-hello",
uri="docker.io/library/python:3.12-slim",
)
print(template.id)

Change the display name of a template.

from leap0 import Leap0Client
client = Leap0Client()
client.templates.rename("<template_id>", name="python-fastapi-v2")

Permanently remove a template. Existing sandboxes created from the template are not affected.

from leap0 import Leap0Client
client = Leap0Client()
client.templates.delete("<template_id>")

Templates can pull images from private container registries. Pass a credentials object with the authentication details for your registry provider.

{
"name": "my-private-image",
"uri": "registry.example.com/org/app:latest",
"credentials": {
"type": "basic",
"username": "my-user",
"password": "my-password"
}
}