This is the template for the E2B Desktop Sandbox.
To build the official desktop template from this repo, use build_prod.py.
This is the script CI and releases run.
- Install the build dependencies:
poetry install- Provide your credentials in
.env:
E2B_API_KEY=e2b_***
- Build the template:
poetry run python build_prod.pyDuring development you can build the desktop-dev template instead:
poetry run python build_dev.pyIf you want to customize the Desktop sandbox (e.g.: add a preinstalled package) you can do that by creating a custom sandbox template.
- Install E2B SDK
pip install e2b dotenv- Create a custom sandbox template:
template.py
from e2b import Template
template = Template().from_template("desktop")- Create a build script:
build.py
from dotenv import load_dotenv
from template import template
from e2b import Template, default_build_logger
load_dotenv()
Template.build(
template,
alias="desktop-custom",
cpu_count=8,
memory_mb=8192,
on_build_logs=default_build_logger(),
)- Set your environment variables in a
.envfile (loaded byload_dotenv()):
E2B_API_KEY=e2b_***
- Build the template:
python build.py- Use the custom template:
Python
from e2b_desktop import Sandbox
desktop = Sandbox.create(template="desktop-custom")JavaScript
import { Sandbox } from '@e2b/desktop'
const desktop = await Sandbox.create('desktop-custom')