Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

BoxFab Python SDK

Python SDK for BoxFab, an agent execution cloud: start isolated Firecracker sandboxes, run commands, move files, and reach services running inside them.

Alpha. 0.1.0a1 is the first release. The API follows the E2B SDK it is derived from and may still change.

The BoxFab Python SDK is derived from the open-source E2B Python SDK and includes modifications for BoxFab's sandbox infrastructure. BoxFab is an independent project and is not affiliated with or endorsed by E2B. See UPSTREAM.md for the exact source revision and what was changed.

Install

Python 3.11 or newer.

pip install boxfab

Authenticate

Get an API key from your BoxFab administrator and export it:

export BOXFAB_API_KEY="e2b_..."

(Keys keep the e2b_ prefix of the underlying protocol.) You can also pass api_key= to any call. The SDK reads only BOXFAB_* variables; E2B_* variables are ignored, so a BoxFab program never picks up an E2B key and never talks to E2B's service by accident.

Quick start

from boxfab import Sandbox

with Sandbox.create() as sandbox:          # killed when the block exits
    result = sandbox.commands.run("echo Hello from BoxFab")
    print(result.stdout)

Sandbox.create("base", timeout=600) picks a template and a lifetime in seconds (default 300).

Commands

from boxfab import CommandExitException

result = sandbox.commands.run("ls -la /home/user")
print(result.exit_code, result.stdout, result.stderr)

try:
    sandbox.commands.run("exit 3")
except CommandExitException as e:          # non-zero exit codes raise
    print(e.exit_code, e.stderr)

server = sandbox.commands.run("python3 -m http.server 8080", background=True)
print(sandbox.get_host(8080))              # 8080-<sandbox id>.<domain>, served over HTTPS
server.kill()

Files

sandbox.files.write("/home/user/hello.txt", "hi")
print(sandbox.files.read("/home/user/hello.txt"))
print([e.name for e in sandbox.files.list("/home/user")])
data = sandbox.files.read("/home/user/hello.txt", format="bytes")

Reconnect, pause and resume

sandbox_id = sandbox.sandbox_id
sandbox.pause()                            # keeps memory and disk
sandbox = Sandbox.connect(sandbox_id)      # resumes it
sandbox.kill()

Async

import asyncio
from boxfab import AsyncSandbox

async def main():
    sandbox = await AsyncSandbox.create()
    try:
        result = await sandbox.commands.run("uname -a")
        print(result.stdout)
    finally:
        await sandbox.kill()

asyncio.run(main())

Explicit client

from boxfab import BoxFab

client = BoxFab(api_key="e2b_...", domain="sandd.contextfab.io")
sandbox = client.Sandbox.create()

Configuration

Variable Default Meaning
BOXFAB_API_KEY none API key
BOXFAB_DOMAIN sandd.contextfab.io BoxFab domain; the API is https://api.<domain>, sandbox ports are https://<port>-<id>.<domain>
BOXFAB_DEBUG false plain HTTP to a local development stack
BOXFAB_HTTP_VERSION, BOXFAB_CONNECTION_RETRIES, BOXFAB_MAX_CONNECTIONS, BOXFAB_MAX_KEEPALIVE_CONNECTIONS, BOXFAB_KEEPALIVE_EXPIRY as upstream transport tuning

Every call also accepts api_key=, domain=, request_timeout= and the other connection parameters directly.

About the domain. The alpha runs on BoxFab's current deployment at sandd.contextfab.io. This is a temporary name; a BoxFab-branded domain will become the default in a later release, and BOXFAB_DOMAIN lets you switch without upgrading.

Known limitations

  • Verified against the live service: sandbox create/connect/list/kill, commands (stdout, stderr, exit codes, timeouts, background processes), files (read, write, list, remove, signed upload/download URLs), port URLs, pause/resume, timeouts and info, async with concurrency. Other upstream features (template builds, volumes, secrets, MCP, IAM tokens, network rules, git helpers, PTY, filesystem watch) are included but not yet verified on BoxFab; volumes, secrets and MCP depend on services the deployment may not run.
  • E2B add-on packages (e2b-code-interpreter, e2b-desktop) build on the e2b package and do not use boxfab.
  • Docstrings still say "E2B" in places; behaviour is as documented here.

Development

uv sync
uv run pytest tests tests_boxfab -n 8                     # unit tests (offline)
SDK=boxfab BOXFAB_API_KEY=... uv run pytest integration   # live tests, create a few sandboxes
uv build

boxfab/ and tests/ are generated from upstream by scripts/sync_upstream.py; change the rules there, not the generated files. See UPSTREAM.md. Releases: see RELEASING.md.

License

MIT. See LICENSE and, for the upstream E2B SDK, LICENSE-E2B.

BoxFab is a product of ContextFab, Inc.

Metadata

Release files for boxfab 0.1.0a1

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

Source distribution (sdist)

Source distribution for boxfab 0.1.0a1
File Size Uploaded Provenance Actions
boxfab-0.1.0a1.tar.gz 271.4 kB With provenance Details for boxfab-0.1.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for boxfab 0.1.0a1
File Interpreter ABI Platform Actions
boxfab-0.1.0a1-py3-none-any.whl Python 3 none any Details for boxfab-0.1.0a1-py3-none-any.whl

Total release size: 702.4 kB

Release files / boxfab-0.1.0a1.tar.gz

Download URL boxfab-0.1.0a1.tar.gz
Size 271.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3b343178d520773a3d068094792a4a9bd73edc59ee07d7cdaa86bda95b2f83bc
BLAKE2b-256 checksum
How to use checksums
339c37e76193994b117a8bf5894d7a2f35389f3de49ead9995a2760d8d160e23
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 Nov 1, 2026.

Transparency log

Release files / boxfab-0.1.0a1-py3-none-any.whl

Download URL boxfab-0.1.0a1-py3-none-any.whl
Size 431.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbd94b69979996a1bcb2db7da72642dc3b070262d2087e18ba8d9a1a2d66892c
BLAKE2b-256 checksum
How to use checksums
f05dc248a1774ebdc35f5966aa39ce2fbc20784fa67022e0dd1bbae3b1d963e2
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 Nov 1, 2026.

Transparency log

Security for boxfab 0.1.0a1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for boxfab-0.1.0a1.tar.gz

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 Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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