Table of contents
SDK v2 introduces several important changes:- New creation pattern in Python Synchronous SDK
- Secure by default
- Updated file operations in Python SDK
- Updated list method
Breaking changes
1. Sandbox creation in synchronous Python SDK
In v2, the synchronous Python SDK uses a class methodcreate() instead of the constructor Sandbox().
2. Secure communication by default
Sandboxes are now secure by default. This means you can’t access the sandbox controller directly through its URL without an authentication header. The SDK automatically handles the authentication header for you. For custom templates created before envdv0.2.0, you need to rebuild them to enable secure communication.
Otherwise, you will receive error messages when creating sandboxes. You can check the template envd version using the e2b template list command or view the templates list in the dashboard.
You can temporarily disable secure communication by setting secure to false during sandbox creation, but this is not recommended for production environments.
3. File writing in Python SDK
The file writing API in Python has been made more consistent. In v2, usesandbox.files.write() for single files and sandbox.files.write_files() for multiple files:
write() method was overloaded for both single and multiple files: