Skip to main content

Open-source fork-on-write microVM sandbox primitive (E2B-compatible surface)

Project description

forkd — Python SDK

E2B-compatible sandbox API backed by forkd.

from forkd import Sandbox

with Sandbox() as sandbox:
    result = sandbox.commands.run("python3 -c 'import numpy; print(numpy.zeros(3))'")
    print(result.stdout)        # [0. 0. 0.]
    print(result.exit_code)     # 0

Or with explicit lifecycle:

sandbox = Sandbox()
result = sandbox.commands.run("echo hello")
sandbox.kill()

Bonus: warmed-state eval

If your snapshot parent imported numpy, you can skip subprocess overhead and use the warmed PID-1 interpreter directly:

with Sandbox() as sandbox:
    out = sandbox.eval("numpy.zeros(5).tolist()")   # ~8 ms
    # vs commands.run("python3 -c '...'") which is ~108 ms (fresh subprocess)

Requirements

The forkd Rust CLI must be installed and on PATH, plus a parent snapshot must already exist (forkd snapshot --tag pyagent ...). See the main README for the full setup.

Status

Pre-alpha. Currently supports:

  • Sandbox() / Sandbox.create() — spawn one sandbox
  • sandbox.commands.run(cmd) — run command, get stdout/stderr/exit_code
  • sandbox.eval(expr) — eval Python in warmed PID 1
  • sandbox.kill() — terminate

Not yet (blocked on issues #1 + #4):

  • Multiple concurrent Sandbox() instances (all share parent's MAC/IP)
  • sandbox.files.read/write — filesystem operations
  • Streaming output

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forkd-0.3.4.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forkd-0.3.4-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file forkd-0.3.4.tar.gz.

File metadata

  • Download URL: forkd-0.3.4.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forkd-0.3.4.tar.gz
Algorithm Hash digest
SHA256 409a534cbd432e53103f3fe366d7e21d2c553683b2b16e51ccca1e59926d0b2c
MD5 6b0ddd0209e7b419961a191c8970b9f2
BLAKE2b-256 22f240f57249d1382a1367d8b2c157dc580de0f3597d822cb7cebbdd39d5e5a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for forkd-0.3.4.tar.gz:

Publisher: publish-pypi.yml on deeplethe/forkd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file forkd-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: forkd-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forkd-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a3786e0c5ce6ef863d32eed5b5f0fc2716296b86a32629bcd3cb19f697ea64c9
MD5 b5411ff3976b32698fe1e52de2b49010
BLAKE2b-256 d39aa6e02638bc88752ce0ec400776b0bb73a7da3da44570a5cb6582684d30d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for forkd-0.3.4-py3-none-any.whl:

Publisher: publish-pypi.yml on deeplethe/forkd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page