Skip to content

Migrating from E2B

Terminal window
pip install synapserun
from e2b_code_interpreter import Sandbox
from synapse.e2b_compat import Sandbox

That’s it. Every E2B method works identically:

from synapse.e2b_compat import Sandbox
# Your existing E2B code — zero changes needed
sbx = Sandbox()
execution = sbx.run_code("x = 42\nprint(x * 2)")
print(execution.logs.stdout) # ['84']
sbx.kill()

Every E2B Sandbox method has a Synapse equivalent:

E2B MethodSynapse MethodStatus
Sandbox() / Sandbox.create()Sandbox() / Cell()
sandbox.run_code(code)sandbox.run_code(code)
sandbox.commands.run(cmd)sandbox.commands.run(cmd)
sandbox.files.write(path, data)sandbox.files.write(path, data)
sandbox.files.read(path)sandbox.files.read(path)
sandbox.files.list(path)sandbox.files.list(path)
sandbox.files.exists(path)sandbox.files.exists(path)
sandbox.files.make_dir(path)sandbox.files.make_dir(path)
sandbox.files.remove(path)sandbox.files.remove(path)
sandbox.files.rename(old, new)sandbox.files.rename(old, new)
sandbox.files.get_info(path)sandbox.files.get_info(path)
Sandbox.connect(id)Sandbox.connect(id)
Sandbox.list()Sandbox.list()
sandbox.get_info()sandbox.get_info()
sandbox.set_timeout(s)sandbox.set_timeout(s)
sandbox.keep_alive(s)sandbox.keep_alive(s)
sandbox.pause()sandbox.pause()
sandbox.resume()sandbox.resume()
sandbox.kill()sandbox.kill()

Switching to Synapse gives you features E2B doesn’t have:

Every execution returns a SHA-256 receipt proving exactly what code ran and what it returned:

result = cell.run("print(42)")
print(result.receipt.code_hash) # sha256:...
print(result.receipt.result_hash) # sha256:...
print(result.receipt.execution_id) # exec_a1b2c3...

Synapse uses Wasm isolation instead of Docker containers. No cold starts.

MetricE2BSynapse
Cold start~200mssub-1ms
Exec latency~50ms0.24ms
IsolationDockerWasm (memory-safe)

Run on your own infrastructure. Single binary. No Kubernetes.

Terminal window
# Pull and run the gateway
docker run -p 8001:8001 ghcr.io/synapse-run/cell-gateway:latest
# Point your SDK at it
export SYNAPSE_API_URL="http://localhost:8001"

Your code and data never leave your infrastructure. EU/Canadian data residency built in.

from e2b_code_interpreter import Sandbox
from langchain_e2b import E2BCodeInterpreterTool
from synapse.langchain_tool import SynapseCellExecuteTool
tool = E2BCodeInterpreterTool(api_key="...")
tool = SynapseCellExecuteTool(api_key="...")
from e2b_code_interpreter import Sandbox
from synapse.crewai_tool import SynapseCellCrewTool
tool = E2BCodeInterpreterTool(api_key="...")
tool = SynapseCellCrewTool(api_key="...")
from e2b_code_interpreter import Sandbox
from synapse.openai_agents_tool import SynapseCellOpenAITool
tool = E2BCodeInterpreter()
tool = SynapseCellOpenAITool()
E2B VariableSynapse VariableNotes
E2B_API_KEYSYNAPSE_API_KEYYour API key
E2B_API_URLSYNAPSE_API_URLGateway URL (default: managed cloud)
SYNAPSE_VERIFY_RECEIPTSEnable receipt verification (default: true)