Overview

Migrating to V2

V1 builds stopped working on August 1, 2026

V1 builds authenticated with E2B_ACCESS_TOKEN, and access tokens were disabled on that date. e2b template build is now a stub that exits immediately. Build with e2b template create, which authenticates with E2B_API_KEY.

Move a template to the V2 build system#

Move code to SDK v2#

Python: create sandboxes with Sandbox.create()

The synchronous Python SDK uses a class method instead of the constructor.

from e2b_code_interpreter import Sandbox
 
sandbox = Sandbox.create()                  # v2
sandbox = Sandbox.create(template="base")   # v2
# v1: Sandbox() / Sandbox(template="base")
Secure by default

The sandbox controller cannot be reached through its URL without an auth header; the SDK adds it for you. Custom templates built before envd v0.2.0 must be rebuilt, or sandbox creation fails — check the version with e2b template list. secure: false / secure=False disables this temporarily and is not recommended for production.

Python: write() for one file, write_files() for many
info = sandbox.files.write("/tmp/file.txt", "content")
infos = sandbox.files.write_files([
    {"path": "/tmp/file1.txt", "data": "content1"},
    {"path": "/tmp/file2.txt", "data": "content2"},
])
Listing sandboxes is paginated
const paginator = Sandbox.list({ query: { metadata: { key: 'value' } } })
while (paginator.hasNext) {
  const items = await paginator.nextItems()
}
paginator = Sandbox.list(query=SandboxQuery(metadata={"key": "value"}))
while paginator.has_next:
    sandboxes = paginator.next_items()

Next#

Updated

Was this page helpful?