Skip to main content

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

Release files for forkd 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for forkd 0.5.3
File Size Uploaded
forkd-0.5.3.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for forkd 0.5.3
File Interpreter ABI Platform
forkd-0.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / forkd-0.5.3.tar.gz

Download URL forkd-0.5.3.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5f854b67328e078c58186a6ebb8479357f01f47267932f31ac926d264a708eff
BLAKE2b-256 checksum
How to use checksums
402ae5215c4f811b2c8789d6fbf6f0dffe603a2bdcf2a0ca564a0f9867fb308a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 22, 2026.

Transparency log

Release files / forkd-0.5.3-py3-none-any.whl

Download URL forkd-0.5.3-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da98b6b9ee083a803f6cd6ace32eb1d7e1294ca2315f78fb3baff1d83ad7fa42
BLAKE2b-256 checksum
How to use checksums
cfb1faf54ddc1f5a8ac3802a7bf5c268e0a2acae6cbd59ee494aeeb68f5be9f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page