Skip to content

Quickstart

Leap0 is secure infrastructure for running AI-generated code. You start a sandbox from a template, call your running app over HTTP/SSE/WebSocket, interact with files and git, and delete the sandbox when done.

Open the Leap0 app, create an account (or sign in).

Generate an API key in the dashboard to authenticate requests to Leap0, then save it securely because it is shown only once and send it in the authorization header.

pip install leap0

Walk through the full sandbox lifecycle: create, invoke, clone and inspect a repo, list files, and delete.

import os
import httpx
from leap0 import Leap0Client
API_KEY = os.environ["LEAP0_API_KEY"]
client = Leap0Client()
sandbox = client.sandboxes.create(
vcpu=2,
memory_mib=2048,
timeout_min=30,
)
try:
response = httpx.get(
sandbox.invoke_url("/<your-path>"),
headers={"authorization": API_KEY},
)
response.raise_for_status()
print(response.text)
cloned = sandbox.git.clone(
url="https://github.com/octocat/Hello-World.git",
path="/workspace/repo",
branch="main",
)
print(cloned.output)
git_status = sandbox.git.status(path="/workspace/repo")
print(git_status.output)
files = sandbox.filesystem.ls(path="/workspace", recursive=False)
print(len(files.items))
finally:
sandbox.delete()