Skip to main content
You are currently viewing documentation for version 2.37.1 of the E2B SDK (Python).View the latest version of this page.

AsyncTemplate

Asynchronous template builder for E2B sandboxes.

build

Build and deploy a template to E2B infrastructure. Arguments:
  • template: The template to build
  • name: Template name in ‘name’ or ‘name:tag’ format
  • alias: (Deprecated) Alias name for the template. Use name instead.
  • tags: Optional additional tags to assign to the template
  • cpu_count: Number of CPUs allocated to the sandbox
  • memory_mb: Amount of memory in MB allocated to the sandbox
  • skip_cache: If True, forces a complete rebuild ignoring cache
  • on_build_logs: Callback function to receive build logs during the build process Example

build_in_background

Build and deploy a template to E2B infrastructure without waiting for completion. Arguments:
  • template: The template to build
  • name: Template name in ‘name’ or ‘name:tag’ format
  • alias: (Deprecated) Alias name for the template. Use name instead.
  • tags: Optional additional tags to assign to the template
  • cpu_count: Number of CPUs allocated to the sandbox
  • memory_mb: Amount of memory in MB allocated to the sandbox
  • skip_cache: If True, forces a complete rebuild ignoring cache
Returns: BuildInfo containing the template ID and build ID Example

get_build_status

Get the status of a build. Arguments:
  • build_info: Build identifiers returned from build_in_background
  • logs_offset: Offset for fetching logs
Returns: TemplateBuild containing the build status and logs Example

exists

Check if a template with the given name exists. Arguments:
  • name: Template name to check
Returns: True if the name exists, False otherwise Example

alias_exists

Check if a template with the given alias exists. Deprecated Use exists instead. Arguments:
  • alias: Template alias to check
Returns: True if the alias exists, False otherwise Example

assign_tags

Assign tag(s) to an existing template build. Arguments:
  • target_name: Template name in ‘name:tag’ format (the source build to tag from)
  • tags: Tag or tags to assign
Returns: TemplateTagInfo with build_id and assigned tags Example

remove_tags

Remove tag(s) from a template. Arguments:
  • name: Template name
  • tags: Tag or tags to remove Example

get_tags

Get all tags for a template. Arguments:
  • template_id: Template ID or name
Returns: List of TemplateTag with tag name, build_id, and created_at Example

check_alias_exists

Check if a template with the given alias exists. Arguments:
  • client - Authenticated API client
  • alias - Template alias to check
Returns: True if the alias exists, False otherwise

assign_tags

Assign tag(s) to an existing template build. Arguments:
  • client - Authenticated API client
  • target_name - Template name in ‘name:tag’ format (the source build to tag from)
  • tags - Tags to assign
Returns: TemplateTagInfo with build_id and assigned tags

remove_tags

Remove tag(s) from a template. Arguments:
  • client - Authenticated API client
  • name - Template name
  • tags - List of tags to remove

get_template_tags

Get all tags for a template. Arguments:
  • client - Authenticated API client
  • template_id - Template ID or name