Lizard SDK for Python
Run commands, work with files and execute code in Linux sandboxes on Kubernetes. The SDK also manages Lizard apps, databases, storage and projects.
Install
Requires Python 3.10+. The Python client is synchronous.
pip install lizard-sdk
Create an API key and project at lizard.build, then set:
export LIZARD_API_KEY="your-api-key"
Create a sandbox
Save this as quickstart.py. Replace my-project with your project's ID, slug or unique name, then run python quickstart.py.
from lizard import Lizard
lizard = Lizard(project="my-project")
with lizard.create("base", timeout_ms=300_000) as sandbox:
sandbox.fs.write("/tmp/hello.txt", "Hello from Lizard!")
result = sandbox.process.exec_("cat /tmp/hello.txt")
if result.exit_code != 0:
raise RuntimeError(result.stderr)
print(result.stdout)
The context manager kills the sandbox when the block ends, including when it raises an error. If you create a sandbox without with, call sandbox.kill() in a finally block.
Stream command output
Inside the with block above:
result = sandbox.process.exec_(
'printf "hello\\n"',
timeout_ms=30_000,
on_stdout=lambda chunk: print(chunk, end=""),
on_stderr=lambda chunk: print(chunk, end=""),
)
if result.exit_code != 0:
raise RuntimeError(result.stderr)
Run Python
Run Python with the interpreter template. Each process command starts a separate Python process, so Python variables do not survive between calls. Save intermediate results to files. The API returns stdout, stderr, and an exit code; it does not return typed notebook results or chart objects.
from lizard import Sandbox
sandbox = Sandbox.create("interpreter", project_id="proj_123", timeout_ms=300_000)
try:
result = sandbox.process.exec_("python -c 'print(2 ** 10)'")
print(result.stdout, result.stderr, result.exit_code)
finally:
sandbox.kill()
CodeSandbox, runCode / run_code, and execution-context methods remain in the SDK, but the hosted template catalog does not provide their required execution server. The legacy default code-interpreter-v1 is unavailable. Changing its name to interpreter does not enable this API. Use Sandbox.create("interpreter") and process commands as shown below.
Configuration
The SDK reads LIZARD_API_KEY and, optionally, LIZARD_API_URL (default: https://lizard.build). You can also pass api_key and api_url to the constructor or static sandbox methods.
Pass timeout_ms to create() to set the sandbox lifetime. The default is five minutes. timeout_ms on process.exec_() or run_code() controls that call, not the sandbox lifetime.
Runtime limits
Sandboxes run on Kubernetes. Use volumes mounted at /workspace to keep files after a sandbox ends. Pause, resume, fork, snapshot creation, snapshot restore, and file watching return HTTP 501 on the current backend.
get_host() returns a hostname without https://. File writes accept UTF-8 text or valid UTF-8 bytes; read_bytes() supports binary downloads.
Current command and lifetime limits
Command results contain stdout, stderr, and the exit code. Command timeouts are limited to 1–600 seconds. The current runtime does not apply the SDK command options envs, workdir, or user; set the directory and environment in the shell command when needed. Create-time envs and metadata are also not applied.
The SDK and CLI default to a five-minute lifetime. The raw API and dashboard default to no expiration. Set an explicit lifetime: timeoutMs: 0 at creation disables expiration; a positive value sets a deadline. setTimeout accepts 1000–2147483647 ms, not zero. Commands do not reset the deadline. This is not an idle timer.
Learn more
Metadata
Release files for lizard-sdk 0.1.44
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lizard_sdk-0.1.44.tar.gz | 36.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lizard_sdk-0.1.44-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 79.9 kB
Release files / lizard_sdk-0.1.44.tar.gz
| Download URL | lizard_sdk-0.1.44.tar.gz |
|---|---|
| Size | 36.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bc7d152cdb8744908cbd656be4162902880f515917b911170738f32febb775d
|
|
BLAKE2b-256 checksum How to use checksums |
8550fc867d16ee4ed6a602e9e7cba88871017cd13340be3f48cde4fce1c22ef1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logRelease files / lizard_sdk-0.1.44-py3-none-any.whl
| Download URL | lizard_sdk-0.1.44-py3-none-any.whl |
|---|---|
| Size | 43.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e75a16be5f2e7a6ab1f08e5774696697fe0658e822c3f1ed3d2f694be129d2b
|
|
BLAKE2b-256 checksum How to use checksums |
c7a26375ea62f89c97b09667e10df35745cf0684db515a8929be4edae63178ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency log