Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2fe412b
Regenerate spec with custom client
jakubno Aug 8, 2025
61c1a58
Beta submodule in Python SDK
jakubno Aug 10, 2025
52eba58
Beta submodule in JS SDK
jakubno Aug 10, 2025
7aa8f05
Update CLI
jakubno Aug 10, 2025
7d84107
Add changeset
jakubno Aug 10, 2025
80b51a1
Use the cache
jakubno Aug 10, 2025
c4dc29f
Add docs strings
jakubno Aug 10, 2025
cf952b5
Refactor beta module in JS SDK
jakubno Aug 11, 2025
e27f7ae
Rename sandboxType to sandboxTestId
jakubno Aug 11, 2025
c82f134
Improve tests
jakubno Aug 11, 2025
bf42cca
Export types
jakubno Aug 11, 2025
1ef6b5f
Improve docstring
jakubno Aug 11, 2025
af77619
Update docs
jakubno Aug 11, 2025
70f58ff
Fix test
jakubno Aug 11, 2025
b30934c
Fix docs
jakubno Aug 12, 2025
b860480
Add missing `.beta`
jakubno Aug 12, 2025
3a0ff1a
Change Sync Python Sandbox() to Sandbox.create()
jakubno Aug 14, 2025
3fb1918
Add create to Python SDK
jakubno Aug 15, 2025
94a415a
Update docs
jakubno Aug 15, 2025
3d432b2
Add create to JS SDk
jakubno Aug 15, 2025
ed04892
Add comments
jakubno Aug 15, 2025
6c92d9f
Small refactor JS SDK
jakubno Aug 15, 2025
51996ea
Increase the number of tries
jakubno Aug 15, 2025
9bed9e8
Lint
jakubno Aug 15, 2025
dcb3d2c
Refactor method to use `beta` prefix
jakubno Aug 15, 2025
098d778
Set version
jakubno Aug 15, 2025
2197e1e
Add beta create
jakubno Aug 15, 2025
7abf7c5
Bump version
jakubno Aug 15, 2025
7498b28
Add auto pause to beta create
jakubno Aug 15, 2025
d940f89
Add docstrings
jakubno Aug 18, 2025
e018c02
Docs
jakubno Aug 18, 2025
84c23fa
Lint
jakubno Aug 18, 2025
1734e13
Refactor connect
jakubno Aug 18, 2025
c3fbc73
Rename spawn to create
jakubno Aug 18, 2025
154e628
Lint
jakubno Aug 18, 2025
e996d92
Lint
jakubno Aug 18, 2025
ec65310
Simplify create
jakubno Aug 18, 2025
e1a8a72
Update docs
jakubno Aug 18, 2025
5fedaa2
Unify
jakubno Aug 18, 2025
f20fd68
Unify
jakubno Aug 18, 2025
d9e483f
Revert
jakubno Aug 18, 2025
d7f25dc
Improve docstrings
ValentaTomas Aug 18, 2025
d7a63a8
Remove changeset
jakubno Aug 19, 2025
130a3f4
Revert docs
jakubno Aug 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/angry-ties-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@e2b/python-sdk': major
'e2b': major
'@e2b/cli': major
---

- Add beta module (pause and resume)
- Update list method to allow list paused sandboxes
2 changes: 1 addition & 1 deletion .github/workflows/generated_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
cache-to: type=gha,mode=max

- name: Run codegen
run: make codegen
run: CODEGEN_IMAGE=codegen-env:latest make codegen

- name: Check for uncommitted changes
run: |
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.PHONY: codegen
codegen:
@echo "Generating SDK code from openapi and envd spec"
@docker run -v "$$(pwd):/workspace" $$(docker build -q -t codegen-env . -f codegen.Dockerfile)
@CODEGEN_IMAGE=$${CODEGEN_IMAGE:-$$(docker build -q -t codegen-env . -f codegen.Dockerfile)} ; \
echo "Using codegen image: $$CODEGEN_IMAGE" \
&& docker run -v $$PWD:/workspace $$CODEGEN_IMAGE make generate

generate: generate-js generate-python

generate-js:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Python
```py
from e2b_code_interpreter import Sandbox

with Sandbox() as sandbox:
with Sandbox.create() as sandbox:
sandbox.run_code("x = 1")
execution = sandbox.run_code("x+=1; x")
print(execution.text) # outputs 2
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(docs)/docs/api-key/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const sandbox = await Sandbox.create({ apiKey: 'YOUR_API_KEY' })
```python {{ language: 'python' }}
from e2b_code_interpreter import Sandbox

sbx = Sandbox(api_key="YOUR_API_KEY")
sbx = Sandbox.create(api_key="YOUR_API_KEY")
```
</CodeGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ load_dotenv()
from e2b_code_interpreter import Sandbox

# Create sandbox
sbx = Sandbox()
sbx = Sandbox.create()

# Upload the dataset to the sandbox
dataset_path_in_sandbox = ""
Expand Down Expand Up @@ -453,7 +453,7 @@ from e2b_code_interpreter import Sandbox
from anthropic import Anthropic

# Create sandbox
sbx = Sandbox()
sbx = Sandbox.create()

# Upload the dataset to the sandbox
with open("../dataset.csv", "rb") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ plt.tight_layout()
plt.show()
"""

sandbox = Sandbox()
sandbox = Sandbox.create()
execution = sandbox.run_code(code)
chart = execution.results[0].chart

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ plt.ylabel('some numbers')
plt.show()
"""

sandbox = Sandbox()
sandbox = Sandbox.create()

# Run the code inside the sandbox
execution = sandbox.run_code(code_to_run)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ code_to_run = """
print("This goes last")
"""

sandbox = Sandbox()
sandbox = Sandbox.create()
sandbox.run_code(
code_to_run,
# Use `on_error` to handle runtime code errors
Expand Down Expand Up @@ -131,7 +131,7 @@ plt.title('Values by Category')
plt.show()
"""

sandbox = Sandbox()
sandbox = Sandbox.create()
sandbox.run_code(
code_to_run,
on_result=lambda result: print('result:', result), # $HighlightLine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ console.log(execution)
```python
from e2b_code_interpreter import Sandbox

sbx = Sandbox()
sbx = Sandbox.create()
execution = sbx.run_code("echo 'Hello, world!'", language="bash")
print(execution)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ console.log(execution)
```python
from e2b_code_interpreter import Sandbox

sbx = Sandbox()
sbx = Sandbox.create()
execution = sbx.run_code('System.out.println("Hello, world!");', language="java")
print(execution)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ console.log(execution);
from e2b_code_interpreter import Sandbox

# Create a new sandbox
sbx = Sandbox()
sbx = Sandbox.create()

# Install the axios package
sbx.commands.run("npm install axios")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ console.log(execution)
```python
from e2b_code_interpreter import Sandbox

sbx = Sandbox()
sbx = Sandbox.create()
execution = sbx.run_code('print("Hello, world!")')
print(execution)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ console.log(execution)
```python
from e2b_code_interpreter import Sandbox

sbx = Sandbox()
sbx = Sandbox.create()
execution = sbx.run_code('print("Hello, world!")', language="r")
print(execution)
```
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(docs)/docs/commands/background/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ await command.kill()
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

# Start the command in the background
command = sandbox.commands.run('echo hello; sleep 10; echo world', background=True)
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(docs)/docs/commands/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ console.log(result)
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

result = sandbox.commands.run('ls -l')
print(result)
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(docs)/docs/commands/streaming/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ console.log(result)
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

result = sandbox.commands.run('echo hello; sleep 1; echo world', on_stdout=lambda data: print(data), on_stderr=lambda data: print(data))
print(result)
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/(docs)/docs/filesystem/download/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fs.writeFileSync('/local/path', content)
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

# Read file from sandbox
content = sandbox.files.read('/path/in/sandbox')
Expand Down Expand Up @@ -58,7 +58,7 @@ const content = await res.text()
from e2b import Sandbox

# Start a secured sandbox (all operations must be authorized by default)
sandbox = Sandbox(timeout=12_000, secure=True)
sandbox = Sandbox.create(timeout=12_000, secure=True)

# Create a pre-signed URL for file download with a 10 second expiration
# The user only has to visit the URL to download the file, this also works in a browser.
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/(docs)/docs/filesystem/info/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ console.log(info)
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

# Create a new file
sandbox.files.write('test_file', 'Hello, world!')
Expand Down Expand Up @@ -88,7 +88,7 @@ console.log(info)
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

# Create a new directory
sandbox.files.make_dir('test_dir')
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/app/(docs)/docs/filesystem/read-write/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const fileContent = await sandbox.files.read('/path/to/file')
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()
file_content = sandbox.files.read('/path/to/file')
```
</CodeGroup>
Expand All @@ -32,7 +32,7 @@ await sandbox.files.write('/path/to/file', 'file content')
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

await sandbox.files.write('/path/to/file', 'file content')
```
Expand All @@ -55,7 +55,7 @@ await sandbox.files.write([
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

await sandbox.files.write([
{ "path": "/path/to/a", "data": "file content" },
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/app/(docs)/docs/filesystem/upload/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ await sandbox.files.write('/path/in/sandbox', content)
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

# Read file from local filesystem
with open("path/to/local/file", "rb") as file:
Expand Down Expand Up @@ -64,7 +64,7 @@ from e2b import Sandbox
import requests

# Start a secured sandbox (all operations must be authorized by default)
sandbox = Sandbox(timeout=12_000, secure=True)
sandbox = Sandbox.create(timeout=12_000, secure=True)

# Create a pre-signed URL for file upload with a 10 second expiration
signed_url = sbx.upload_url(path="demo.txt", user="user", use_signature_expiration=10_000)
Expand Down Expand Up @@ -125,7 +125,7 @@ await sandbox.files.write(files)
import os
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()

def read_directory_files(directory_path):
files = []
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/(docs)/docs/filesystem/watch/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ await sandbox.files.write(`${dirname}/my-file`, 'hello')
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()
dirname = '/home/user'

# Watch directory for changes
Expand Down Expand Up @@ -77,7 +77,7 @@ await sandbox.files.write(`${dirname}/my-folder/my-file`, 'hello') // $Highlight
```python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()
sandbox = Sandbox.create()
dirname = '/home/user'

# Watch directory for changes
Expand Down
Loading
Loading