E2B templates allow you to define custom sandboxes.
You can define the base image, environment variables, files to copy, commands to run, and
a start command that runs during the template build and is captured in a snapshot — so the process is already running when you create a sandbox from that template.
This gives you fully configured sandboxes with running processes ready to use with zero wait time for your users.There are two ways how you can start creating a new template:
import 'dotenv/config';import { Sandbox } from 'e2b';// Create a Sandbox from development templateconst sandbox = await Sandbox.create("template-tag-dev");// Create a Sandbox from production templateconst sandbox = await Sandbox.create("template-tag");
from dotenv import load_dotenvfrom e2b import Sandboxload_dotenv()# Create a new Sandbox from the development templatesbx = Sandbox(template="template-tag-dev")# Create a new Sandbox from the production templatesbx = Sandbox(template="template-tag")
The template name is the identifier that can be used to create a new Sandbox.