hyperlight-sandbox 0.10.0


pip install hyperlight-sandbox

  Latest version

Released: Nov 14, 2026

Project Links

Meta
Requires Python: >=3.10

Classifiers

Development Status
  • 3 - Alpha

Intended Audience
  • Developers

Programming Language
  • Python :: 3
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: 3.15
  • Rust

Operating System
  • POSIX :: Linux
  • Microsoft :: Windows

hyperlight-sandbox

Python API package for running code inside Hyperlight sandboxes with separately installable backends and packaged guest packages.

Quick Start

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)
print(result)
""")
print(result.stdout)  # "7\n"

Install the local repo packages for development with:

uv sync          # installs core + guest packages via workspace
just python-build  # builds maturin backends

Packaged guest packages expose importable module references such as python_guest.path and javascript_guest.path. The API resolves those to the packaged .aot artifact automatically.

Example dependency sets:

  • Sandbox(backend="wasm", module="python_guest.path") requires hyperlight-sandbox[wasm,python_guest]
  • Sandbox(backend="wasm", module="javascript_guest.path") requires hyperlight-sandbox[wasm,javascript_guest]
  • Sandbox(backend="hyperlight-js") requires hyperlight-sandbox[hyperlight_js]

Use Sandbox(backend="wasm", module="javascript_guest.path") to run the packaged JavaScript Wasm guest package.

Use Sandbox(backend="hyperlight-js") to run the separate HyperlightJS backend package.

macOS

Apple Silicon wheels provide developer-only support for macOS 13 and newer. The backend wheels include a signed Rust helper with the com.apple.security.hypervisor entitlement. This path is experimental, not for production.

Snapshot Semantics

  • snapshot() captures guest runtime state.
  • Output file contents under /output persist across run() calls, but open file handles must be reopened in each run.
  • restore() rewinds runtime state and clears output files.

Build

just python-build
Extras:
Dependencies: