d86368a11e
Reconciles divergences found while auditing the sync and async Python SDK trees, keeping behavior equivalent across both. - **Parameter ordering:** aligned `_create` and `Commands._start` signatures to the public API and to each other, and reordered the `Commands.connect` rpc args (`headers` before `timeout`) to match the `_start` convention. - **`pause` return:** the public `pause()` / `beta_pause()` are now annotated `-> str` and actually return the sandbox ID (matching `_cls_pause` and the class-method form, which already returned it) instead of `-> None`; the `:return:` docstrings are restored. - **Exceptions:** the internal "Body of the request is None" guard in `sandbox_api` now consistently raises a bare `Exception` (matching the volume client) instead of mixing `Exception`/`SandboxException` between sync and async. - **Misc:** async `Filesystem.write` now passes keyword args; the async constructor reuses the cached `envd_api_url` property instead of recomputing the sandbox URL; async pty `resize` gains a `-> None` annotation. - **Docstrings:** aligned the deprecation marker and `get_metrics`/`write_files`/`kill` wording across sync/async, and fixed a `**seconds**s` typo. These are alignment/consistency fixes only; the deeper architectural async-vs-sync splits (streaming-vs-polling `watch_dir`, pty `on_data`, command output callbacks) are intentional and left untouched. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What is E2B?
E2B is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our JavaScript SDK or Python SDK.
Run your first Sandbox
1. Install SDK
pip install e2b
2. Get your E2B API key
E2B_API_KEY=e2b_***
3. Start a sandbox and run commands
from e2b import Sandbox
with Sandbox.create() as sandbox:
result = sandbox.commands.run('echo "Hello from E2B!"')
print(result.stdout) # Hello from E2B!
4. Code execution with Code Interpreter
If you need run_code(), install the Code Interpreter SDK:
pip install e2b-code-interpreter
from e2b_code_interpreter import Sandbox
with Sandbox.create() as sandbox:
execution = sandbox.run_code("x = 1; x += 1; x")
print(execution.text) # outputs 2
5. Check docs
Visit E2B documentation.
6. E2B cookbook
Visit our Cookbook to get inspired by examples with different LLMs and AI frameworks.
