All Products
Search
Document Center

Function Compute:Template Names and Versioning

Last Updated:Sep 01, 2026

A template name identifies a runtime environment. Tags mark a specific build of a template with a stage or version, such as prod, staging, or v1, for canary rollout and rollback.

Before you begin, complete the connection setup in the Quickstart.

Template names

We recommend that you include the business scenario, language or base image, key dependency versions, and a date so names are easy to identify and group:

agent-python313-20260704
code-review-node22-20260704
data-analysis-py313-v1

Reference a template by name when creating a sandbox:

const sandbox = await Sandbox.create("agent-python313-20260704");

Python example:

sandbox = Sandbox.create(template="agent-python313-20260704")

Tags

Assign tags

The first parameter of assignTags uses the name:tag format to specify which build to tag. When :tag is omitted, it defaults to the default build.

import { Template } from "e2b";

// Omitting the source tag targets the default build
await Template.assignTags("agent-python313-20260704", ["staging", "v1"]);

Python example:

from e2b import Template

Template.assign_tags("agent-python313-20260704", ["staging", "v1"])

Query tags

You can assign and remove tags by template name. To query tags, TypeScript accepts a template name and returns all tags, while Python requires the template ID (such as build.template_id returned by Template.build).

const tags = await Template.getTags("agent-python313-20260704");
console.log(tags);
// Output: [{ tag: 'default', buildId: '...', createdAt: '...' },
//         { tag: 'staging', buildId: '...', createdAt: '...' }, ...]

Python example:

tags = Template.get_tags("<template-id>")
print(tags)
# Output: [TemplateTag(tag='default', build_id='...', created_at='...'), ...]

Remove tags

await Template.removeTags("agent-python313-20260704", "staging");

Python example:

Template.remove_tags("agent-python313-20260704", "staging")

Limitations

  • Each template supports at most 20 tags.

  • The default tag cannot be deleted (returns a 400 error).

  • Assigning the same tag repeatedly and deleting a tag that does not exist are idempotent operations.

Recommendations

For a new release, validate the new template or tag before switching application references. Keep complex rollout rules in your application or release system.