Version your templates using tags for environment-based deployments
Template versioning allows you to maintain multiple versions of the same template using tags. This enables workflows like semantic versioning, environment-based deployments, and gradual rollouts.
Build with multiple tags to assign several version labels to the same build artifact.
Copy
Ask AI
import { Template } from 'e2b'// Build with multiple tags pointing to the same artifactawait Template.build(template, ['my-template:v1.2.0', 'my-template:latest'])
When building with multiple tags, E2B creates a single build artifact that all tags reference. This saves build time and storage.
// Build new versionawait Template.build(template, 'my-app:v1.5.0')// Promote through environmentsawait Template.assignTag('my-app:v1.5.0', 'my-app:staging')// After testing, promote to productionawait Template.assignTag('my-app:v1.5.0', 'my-app:production')// Use in your applicationconst env = process.env.NODE_ENVconst sandbox = await Sandbox.create(`my-app:${env}`)
Maintain rolling tags that always point to specific versions.
Copy
Ask AI
// Build with version and latest tagawait Template.build(template, ['my-tool:v3.0.0', 'my-tool:latest'])// Mark a tested version as stableawait Template.assignTag('my-tool:v2.9.0', 'my-tool:stable')// Users can choose their risk toleranceconst latestSandbox = await Sandbox.create('my-tool:latest') // Newestconst stableSandbox = await Sandbox.create('my-tool:stable') // Tested