hyperlight-sandbox
Python API for running code in isolated Hyperlight sandboxes with swappable backends
What it is and what it does
Hyperlight-sandbox is a Python API for running untrusted or isolated code inside sandboxes with multiple backend options (WASM, HyperlightJS) and guest language support (Python, JavaScript). It lets you register tools that guest code can call, capture output, and manage sandbox state through snapshots and restores. The package ships with separately installable backend and guest packages, so you only pull in what you need—for example, installing with [wasm,python_guest] gives you WASM execution with a Python runtime.
The core workflow is straightforward: create a Sandbox with your chosen backend and guest module, register any tools the guest code should access, then run code and inspect stdout or other outputs. Output files under /output are ephemeral per run. This design is useful for scenarios where you need to execute code safely without giving it full system access, or where you want to isolate execution contexts from one another.
Use it for:
- Run untrusted user-submitted code safely without exposing the host system.
- Execute code in isolated contexts with controlled tool access for multi-tenant applications.
- Snapshot and restore sandbox state for testing, debugging, or resuming long-running computations.
- Combine Python and JavaScript code execution in the same application via different guest packages.
- Build code execution services (e.g., online judges, notebook environments) with pluggable backends.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Hyperlight-sandbox provides a Python API for executing code inside isolated sandboxes with pluggable backends (WASM, HyperlightJS) and guest language runtimes, enabling secure code execution with tool registration and snapshot/restore semantics.
Yes, if you need isolated code execution with a clean Python API and don't mind the Alpha maturity level. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a reasonable choice. However, verify that snapshot/restore semantics and backend stability meet your production requirements before relying on it for critical workloads.
Install
hyperlight-sandbox on PyPI
pip
pip install hyperlight-sandboxuv
uv add hyperlight-sandboxpoetry
poetry add hyperlight-sandboxInstalling hyperlight-sandbox
Before you install
Low install friction with a pure-Python wheel distribution. Active maintenance with recent commits and steady releases since March 2026. Requires Python 3.10 or later and optional backend/guest package extras depending on your use case.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most production deployments.
Quickstart
pip install hyperlight-sandbox[wasm,python_guest]
from hyperlight_sandbox import Sandbox
sandbox = Sandbox(backend="wasm", module="python_guest.path")
sandbox.register_tool("add", lambda a=0, b=0: a + b)
result = sandbox.run("result = call_tool('add', a=3, b=4)\nprint(result)")
print(result.stdout)
Requires Python 3.10 or later; backend and guest package extras must be installed based on your chosen backend (e.g., [wasm,python_guest] for WASM with Python guest).
Verify before relying
- Whether snapshot/restore semantics work correctly across all supported backends and guest runtimes.
- Performance characteristics and overhead of sandbox initialization and code execution.
- Compatibility and stability of the HyperlightJS backend relative to WASM.
- Whether the package is production-ready or remains in active development (Alpha status).
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 51 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 197,533/month — #9,757 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hyperlight_sandbox-0.5.0-py3-none-any.whl
Keywords: hyperlight, wasm, sandbox, isolation, code-execution
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
agent-framework-hyperlightIntegrates sandboxed code execution into…
permissive · top 15,000 on PyPI
hyperlight-sandbox-backend-wasmProvides a WebAssembly backend implementation…
permissive · top 15,000 on PyPI
hyperlight-sandbox-python-guestProvides a Python guest runtime for the…
permissive · top 15,000 on PyPI
llm-sandboxExecutes code generated by large language…
unclear · top 15,000 on PyPI
e2b-code-interpreterRuns AI-generated or arbitrary Python code in…
permissive · top 5,000 on PyPI
e2bE2B provides a Python SDK to create and control…
permissive · top 5,000 on PyPI
quickjs-rsExecutes JavaScript code inside a WebAssembly…
permissive · top 15,000 on PyPI
daytonaDaytona is a Python SDK for managing and…
permissive · top 5,000 on PyPI
bashkitBashkit is a sandboxed bash interpreter for…
permissive · top 15,000 on PyPI
pydantic-monty-runtimeProvides the `monty` command-line binary, a…
permissive · top 15,000 on PyPI