← Back to articles
E2B Sandbox Poc
Evidence notes document the bounded local or source-based checks behind an Effloow article. They are not product endorsements, legal advice, or benchmark claims.
Date: 2026-05-06
Track: sandbox-poc
Slug: e2b-sandbox-secure-code-execution-ai-agents-guide-2026
Environment: macOS Darwin 24.6.0, Python 3.12
Commands Run
1. Installation
pip install e2b-code-interpreter
Output (relevant):
Downloading e2b_code_interpreter-2.6.2-py3-none-any.whl (13 kB)
Downloading e2b-2.20.3-py3-none-any.whl (297 kB)
Installing collected packages: dockerfile-parse, bracex, wcmatch, e2b, e2b-code-interpreter
Successfully installed bracex-2.6 dockerfile-parse-2.0.1 e2b-2.20.3 e2b-code-interpreter-2.6.2 wcmatch-10.1
✅ Install successful.
2. Version Verification
import importlib.metadata
print('e2b-code-interpreter version:', importlib.metadata.version('e2b-code-interpreter'))
print('e2b version:', importlib.metadata.version('e2b'))
Output:
e2b-code-interpreter version: 2.6.2
e2b version: 2.20.3
3. SDK Surface Inspection
import e2b_code_interpreter as e2b
print([x for x in dir(e2b) if not x.startswith('_')])
Key exports confirmed:
Sandbox— primary class for creating and managing sandboxesAsyncSandbox— async variant for production async appsExecution— result container with.text,.error,.chartsResult— per-cell result object (mirrors Jupyter output)ExecutionError— structured error from sandbox executionMcpServer,GitHubMcpServer— MCP server integration classesOutputMessage,Stdout,Stderr— streaming output typesRunCodeLanguage— language selector enumConnectionConfig— authentication config
4. Sandbox Class API
import inspect
sig = inspect.signature(e2b.Sandbox.run_code)
run_code signature:
(self, code: str, language: Optional[str] = None,
context: Optional[Context] = None,
on_stdout: Optional[Callable[[OutputMessage], Any]] = None,
on_stderr: Optional[Callable[[OutputMessage], Any]] = None,
on_result: Optional[Callable[[Result], Any]] = None,
on_error: Optional[Callable[[ExecutionError], Any]] = None,
envs: Optional[Dict[str, str]] = None,
timeout: Optional[float] = None,
request_timeout: Optional[float] = None) -> Execution
Sandbox public methods (non-underscore):
create— class method, creates a new sandboxconnect— reconnects to an existing sandbox by IDrun_code— executes code in a Jupyter cellcreate_code_context— creates an isolated execution contextlist_code_contexts— lists active contextsremove_code_context— removes a contextrestart_code_context— resets a contextcreate_snapshot— saves current state as snapshotlist_snapshots,delete_snapshot— manage snapshotspause,beta_pause— pause the sandboxkill— terminate the sandboxis_running,get_info,get_metrics— status checksget_mcp_url,get_mcp_token— MCP server accessset_timeout— update sandbox timeoutupload_url,download_url— file I/O helperslist— list all running sandboxes
5. Authentication Behavior
import os
os.environ.pop('E2B_API_KEY', None)
e2b.Sandbox.create()
Error output:
AuthenticationException: API key is required, please visit the Team tab at
https://e2b.dev/dashboard to get your API key. You can either set the
environment variable `E2B_API_KEY` or you can pass it directly to the
method like api_key="e2b_..."
Limitation: Live sandbox execution requires a valid E2B_API_KEY. The free Hobby tier provides a $100 usage credit with no credit card required (sufficient for approximately 595,000 seconds of 1 vCPU sandbox time at $0.000168/sec).
What Worked
- ✅ Package installs cleanly on Python 3.12, no dependency conflicts
- ✅ SDK surface is complete: Sandbox, AsyncSandbox, Execution, McpServer
- ✅
run_codeAPI confirmed — supports streaming callbacks (on_stdout, on_stderr, on_result) - ✅ MCP server integration classes verified (
McpServer,GitHubMcpServer) - ✅ Snapshot and context management APIs confirmed
- ✅ Authentication error message is clear and actionable
What Couldn't Be Run
- ❌ Live
Sandbox.create()— requires API key, not available in this session - ❌ Code execution demo — depends on live sandbox
- ❌ Streaming output capture — depends on live sandbox
Limitations Noted
- Live sandbox execution requires E2B API key (free tier available at e2b.dev)
- SDK version 2.6.2 — check changelog for breaking changes from 1.x cookbooks
- MicroVM cold start ~150ms (Blaxel leads at 25ms, Daytona at 27-90ms)
- No free self-hosted open-source option for production-scale use
Sources Verified
- PyPI: pypi.org/project/e2b-code-interpreter/ — 2.6.2 current
- PyPI: pypi.org/project/e2b/ — 2.20.3 current
- GitHub: github.com/e2b-dev/E2B — ~8.9K stars, Apache 2.0
- GitHub: github.com/e2b-dev/code-interpreter — Python & JS/TS SDK
- GitHub: github.com/e2b-dev/e2b-cookbook — Anthropic + OpenAI examples