Skip to content

Latest commit

 

History

History

README.md

E2B Desktop Template

This is the template for the E2B Desktop Sandbox.

Building the production template

To build the official desktop template from this repo, use build_prod.py. This is the script CI and releases run.

  1. Install the build dependencies:
poetry install
  1. Provide your credentials in .env:
E2B_API_KEY=e2b_***
  1. Build the template:
poetry run python build_prod.py

During development you can build the desktop-dev template instead:

poetry run python build_dev.py

If you want to customize the Desktop sandbox (e.g.: add a preinstalled package) you can do that by creating a custom sandbox template.

Creating a custom template

  1. Install E2B SDK
pip install e2b dotenv
  1. Create a custom sandbox template:

template.py

from e2b import Template

template = Template().from_template("desktop")
  1. 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(),
)
  1. Set your environment variables in a .env file (loaded by load_dotenv()):
E2B_API_KEY=e2b_***
  1. Build the template:
python build.py
  1. 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')