See what exists
templateID, its aliases, cpuCount, memoryMB and diskSizeMB. The CLI prints the same:
styne template list (--json for the API’s answer). A template you cannot start, or that does not exist, answers
404 not_found on create.
The image has root,
/root as the home directory, Python 3, Node, git and curl, and is also named code. The list may also
show a browser template. It is for browsers, and it does not start a sandbox. See
limits for sizes; asking for more than the template has answers 400.
Which to pick
Start frombase. It is the image every example in these docs uses and the one the E2B SDKs map to (Sandbox.create("base"));
a name that does not exist, such as node or python, answers 404. Install what your task needs at run time, or once into
a snapshot.
Make your own start state
Install the toolchain in a sandbox, check it, save it, and start every later sandbox from the name. The state includes the installed packages, your repository checkout and anything running in memory.POST /sandboxes/{id}/snapshots with a name, and POST /sandboxes with {"snapshot": "<name>"} instead of templateID.
A sandbox started from a snapshot has the size of the template the snapshot came from.
Things to know
- A snapshot is placed on the node that holds it, so a create from a name waits for capacity on that node only.
- Names are yours: other accounts never see them, and a name is unique in your account.
- Rebuild a snapshot when your toolchain changes: save a new name (
toolbox-v2), move your harness to it, delete the old one. Sandboxes already started are not affected by a delete.
Resolve an alias
templateID the alias stands for, for example {"templateID": "...", "public": true}; an unknown alias answers 404. The list is also served at GET /default-templates and GET /v2/templates, the paths the E2B SDK reads, with the same answer as GET /templates.