Migrate from E2B
Two ways, and neither rewrites your code. Both run on ordinary kosa8 sandboxes, so fork, checkpoints and the dashboard work on them too.
Option 1: keep the E2B SDK, change three variables#
kosa8 Cloud answers the E2B API at /e2b. Point the E2B SDK there with a kosa8 key:
export E2B_API_KEY=k8c_live_… # a kosa8 Cloud key export E2B_API_URL=https://api.kosa8.com/e2b export E2B_SANDBOX_URL=https://api.kosa8.com/e2b/envd
from e2b import Sandbox sbx = Sandbox.create("python", timeout=300) sbx.files.write("hello.py", "print('hello from kosa8')\n") # /workspace/hello.py print(sbx.commands.run("python3 hello.py", cwd="/workspace").stdout) sbx.kill()
Tested with the E2B Python SDK 2.64.0 on 2026-11-22. E2B plans to drop E2B_API_URL in its next
major version, so pin e2b<3.
Option 2: change one import#
The kosa8 Python SDK has an E2B-shaped Sandbox that talks to kosa8 directly:
# Before: from e2b import Sandbox from kosa8.compat.e2b import Sandbox # reads KOSA8_API_KEY sbx = Sandbox.create("python", timeout=300) # deleted after 300 s sbx.files.write("/workspace/hello.py", "print('hello from kosa8')\n") r = sbx.commands.run("python3 hello.py", cwd="/workspace") print(r.stdout.strip()) # hello from kosa8 sbx.kill()
kosa8.compat.e2b_code_interpreter does the same for e2b_code_interpreter. It mirrors
the synchronous API of e2b 2.64.0; AsyncSandbox is not mirrored.
What is different#
- The default template,
base, is Alpine with no Python. Ask for"python","node"or an image. - Relative file paths are under
/workspace, but a command starts in/unless you passcwd. timeoutbecomes the sandbox'sttl_s(60 s at least).pauseis kosa8 sleep: memory and disk kept.- Anything kosa8 cannot do raises
kosa8.compat.Unsupportedrather than silently doing something else.
The full mapping is in framework integrations.
Something wrong or missing? Edit this page, or write to contact@kosa8.com.