Template names are unique identifiers used to reference and create sandboxes from your templates. They serve as human-readable names that make it easy to identify and use your templates across your applications.
A name is a string identifier that you assign to a template when building it. Once a template is built with a name, you can use that name to create sandboxes from the template.
// Build a template with a nameawait Template.build(template, 'my-python-env', { cpuCount: 2, memoryMB: 2048,})// Create a sandbox using the nameconst sandbox = await Sandbox.create('my-python-env')
# Build a template with a nameTemplate.build( template, 'my-python-env', cpu_count=2, memory_mb=2048,)# Create a sandbox using the namesandbox = Sandbox.create('my-python-env')
Before a name is used, it’s trimmed of surrounding whitespace and lowercased. The result must match the pattern ^[a-z0-9-_]+$:
Lowercase letters (a–z), numbers (0–9), dashes (-), and underscores (_)
Between 1 and 128 characters
Leading and trailing dashes or underscores are allowed
Uppercase letters are accepted on input and lowercased automatically, so My-Template and my-template refer to the same name. Any other character (spaces inside the name, dots, slashes, and so on) is rejected.
Template names are scoped to your team. This means:
Your template named my-app is stored as your-team-slug/my-app
You can reference it simply as my-app within your team
Other teams can have their own my-app template without conflict
Public templates should be referenced using the full namespaced format (team-slug/template-name)
Backwards Compatibility: Existing public templates remain accessible without the team slug prefix. New public templates should be referenced using the full namespaced format (team-slug/template-name).
Create different variants of the same template with different configurations:
// Small instanceawait Template.build(template, 'myapp-small', { cpuCount: 1, memoryMB: 512,})// Large instanceawait Template.build(template, 'myapp-large', { cpuCount: 8, memoryMB: 8192,})
# Small instanceTemplate.build( template, 'myapp-small', cpu_count=1, memory_mb=512,)# Large instanceTemplate.build( template, 'myapp-large', cpu_count=8, memory_mb=8192,)
When building variants with the same template definition but different CPU/RAM configurations, E2B’s caching system will reuse common layers, making subsequent builds much faster.