Skip to main content
Pre-release

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

BoxFab Desktop (Python)

A virtual Linux desktop in a BoxFab sandbox, for computer-use agents: mouse and keyboard control, screenshots, application windows, and a live stream of the screen in the browser.

Getting started

1. Get a BoxFab API key

Get a key from the BoxFab dashboard and set it as BOXFAB_API_KEY. The SDK reads only BOXFAB_* variables.

2. Install the SDK

pip install boxfab-desktop

Stream access. desktop.stream.start() runs without a password unless you pass require_auth=True. The stream URL contains the sandbox ID, and anyone who has the URL can see and control the desktop. Pass require_auth=True whenever the URL leaves your backend; the auth key is then part of the URL returned by get_url(auth_key=...), so share that URL only with the intended viewer.

3. Create Desktop Sandbox

from boxfab_desktop import Sandbox

# Create a new desktop sandbox
desktop = Sandbox.create()

# Launch an application
desktop.launch('google-chrome')  # or vscode, firefox, etc.

# Wait 10s for the application to open
desktop.wait(10000)

# Stream the application's window
# Note: There can be only one stream at a time
# You need to stop the current stream before streaming another application
desktop.stream.start(
    window_id=desktop.get_current_window_id(), # if not provided the whole desktop will be streamed
    require_auth=True
)

# Get the stream auth key
auth_key = desktop.stream.get_auth_key()

# Print the stream URL
print('Stream URL:', desktop.stream.get_url(auth_key=auth_key))

# Kill the sandbox after the tasks are finished
# desktop.kill()

4. Bind the configuration to a client

The top-level Sandbox export reads its configuration from the environment variables. To use an explicit configuration — e.g. several API keys or domains in one process — create a BoxFab client and use the resource classes it exposes:

from boxfab_desktop import BoxFab

client = BoxFab(api_key="e2b_***", domain="us-west.boxfab.dev")

desktop = client.Sandbox.create()
desktop.stream.start()

# The core resources are bound to the client's configuration as well.
volume = client.Volume.create("my-volume")
exists = client.Template.exists("my-template")
secret = client.Secret.create("openai-api-key", "sk-***")

# The classes can be assigned and used like the top-level ones.
Sandbox = client.Sandbox
paginator = Sandbox.list()

Per-call params still take precedence over the client's params, and clients are isolated from each other and from the env-configured top-level exports.

Features

Streaming desktop's screen

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Start the stream
desktop.stream.start()

# Get stream URL
url = desktop.stream.get_url()
print(url)

# Stop the stream
desktop.stream.stop()

Streaming with password protection

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Start the stream
desktop.stream.start(
    require_auth=True  # Enable authentication with an auto-generated key
)

# Retrieve the authentication key
auth_key = desktop.stream.get_auth_key()

# Get stream URL
url = desktop.stream.get_url(auth_key=auth_key)
print(url)

# Stop the stream
desktop.stream.stop()

Streaming specific application

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Get current (active) window ID
window_id = desktop.get_current_window_id()

# Get all windows of the application
window_ids = desktop.get_application_windows("Firefox")

# Start the stream
desktop.stream.start(window_id=window_ids[0])

# Stop the stream
desktop.stream.stop()

Mouse control

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

desktop.double_click()
desktop.left_click()
desktop.left_click(x=100, y=200)
desktop.right_click()
desktop.right_click(x=100, y=200)
desktop.middle_click()
desktop.middle_click(x=100, y=200)
desktop.scroll(10) # Scroll by the amount. Positive for up, negative for down.
desktop.move_mouse(100, 200) # Move to x, y coordinates
desktop.drag((100, 100), (200, 200)) # Drag using the mouse
desktop.mouse_press("left") # Press the mouse button
desktop.mouse_release("left") # Release the mouse button

Keyboard control

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Write text at the current cursor position with customizable typing speed
desktop.write("Hello, world!")  # Default: chunk_size=25, delay_in_ms=75
desktop.write("Fast typing!", chunk_size=50, delay_in_ms=25)  # Faster typing

# Press keys
desktop.press("enter")
desktop.press("space")
desktop.press("backspace")
desktop.press(["ctrl", "c"]) # Key combination

Window control

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Get current (active) window ID
window_id = desktop.get_current_window_id()

# Get all windows of the application
window_ids = desktop.get_application_windows("Firefox")

# Get window title
title = desktop.get_window_title(window_id)

Screenshot

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Take a screenshot and save it as "screenshot.png" locally
image = desktop.screenshot()
# Save the image to a file
with open("screenshot.png", "wb") as f:
    f.write(image)

Open file

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Open file with default application
desktop.files.write("/home/user/index.js", "console.log('hello')") # First create the file
desktop.open("/home/user/index.js") # Then open it

Launch applications

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Launch the application
desktop.launch('google-chrome')

Run any bash commands

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

# Run any bash command
out = desktop.commands.run("ls -la /home/user")
print(out)

Wait

from boxfab_desktop import Sandbox
desktop = Sandbox.create()

desktop.wait(1000) # Wait for 1 second

Under the hood

The desktop-like environment is based on Linux and Xfce at the moment. We chose Xfce because it's a fast and lightweight environment that's also popular and actively supported. However, this Sandbox template is fully customizable and you can create your own desktop environment. BoxFab's template is in boxfab/desktop, generated from e2b-dev/desktop.

BoxFab sandboxes are Firecracker microVMs, run on the open-source E2B sandbox infrastructure. This package is derived from the open-source E2B Desktop SDK; UPSTREAM.md lists every change.

Using the E2B Desktop SDKs. BoxFab serves the same API and provides the desktop template, so the E2B Desktop SDKs work with it as well. Set both variables, the domain first:

export E2B_DOMAIN=us-west.boxfab.dev
export E2B_API_KEY="<your BoxFab API key>"

Without E2B_DOMAIN, the E2B SDKs send requests, including the key, to E2B's own service.

Tested against BoxFab with e2b-desktop 2.7.2 (Python) and @e2b/desktop 2.5.0 (JavaScript).

License

MIT, as the E2B Desktop SDK it is derived from; see LICENSE.

BoxFab is a product of ContextFab, Inc.

Metadata

Release files for boxfab-desktop 0.1.0a2

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-desktop 0.1.0a2
File Size Uploaded Provenance Actions
boxfab_desktop-0.1.0a2.tar.gz 11.2 kB With provenance Details for boxfab_desktop-0.1.0a2.tar.gz

Built distribution (wheel)

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

Total release size: 23.1 kB

Release files / boxfab_desktop-0.1.0a2.tar.gz

Download URL boxfab_desktop-0.1.0a2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f8145bab9e5eab4f597db9f642eb676b79812820f3b0975a93c41f7803c487f6
BLAKE2b-256 checksum
How to use checksums
b4fc7d71dbeb8263d4b0a47ac7c80d927aab325bea9c7c9375d727ece83ff6ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 16, 2026.

Transparency log

Release files / boxfab_desktop-0.1.0a2-py3-none-any.whl

Download URL boxfab_desktop-0.1.0a2-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1c1db25f2634140c170ef26b3a00a1eb01a81612898d26b3fbe6bf48f7097b8
BLAKE2b-256 checksum
How to use checksums
fac3048c9c0699e8208b4ed9426dc488de9b004b8a6ae57c69efaad039b34695
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 16, 2026.

Transparency log

Security for boxfab-desktop 0.1.0a2

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for boxfab_desktop-0.1.0a2.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 16, 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.

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