Start command
The start command lets you specify a process that runs at the end of the template build — not when a sandbox is created. During the build, E2B executes the start command, waits for the ready command to confirm the process is up, and then takes a snapshot of the entire sandbox including the running process. When you later create a sandbox from that template, the snapshotted process is already running — there is no startup wait. This is how you get servers, seeded databases, or any long-running process available instantly when spawning sandboxes with the SDK.The start command runs once during template build and is captured in a snapshot. It does not re-execute each time you create a sandbox. If you need to run a command every time a sandbox is created, use
sandbox.commands.run() after creating the sandbox instead.This also means that environment variables passed to Sandbox.create() are not available to the start command process — it already ran during the build. If your start command needs environment variables, set them in the template definition using setEnvs() / set_envs().