diff --git a/apps/web/src/app/(docs)/docs/legacy/guide/beta-migration/page.mdx b/apps/web/src/app/(docs)/docs/legacy/guide/beta-migration/page.mdx
index c5f71b909..ce32eb652 100644
--- a/apps/web/src/app/(docs)/docs/legacy/guide/beta-migration/page.mdx
+++ b/apps/web/src/app/(docs)/docs/legacy/guide/beta-migration/page.mdx
@@ -14,8 +14,10 @@ The latest beta versions you should install can be found in NPM/PyPi release his
- [Creating sandbox](#creating-sandbox)
- [Modifying sandbox timeout](#modifying-sandbox-timeout)
- [Reconnecting](#reconnecting)
- - [Uploading data and creating files in sandbox](#uploading-data-and-creating-files-in-sandbox)
- - [Downloading files and reading files in sandbox](#downloading-files-and-reading-files-in-sandbox)
+ - [Writing files to sandbox](#writing-files-to-sandbox)
+ - [Reading files from sandbox](#reading-files-from-sandbox)
+ - [Uploading data to sandbox](#uploading-data-to-sandbox)
+ - [Downloading files from sandbox](#downloading-files-from-sandbox)
- [Running processes](#running-processes)
- [Watching for files' changes](#watching-for-files-changes)
- [Accessing sandbox ID](#accessing-sandbox-id)
@@ -24,10 +26,10 @@ The latest beta versions you should install can be found in NPM/PyPi release his
- [Timeouts](#timeouts)
- [Listing sandboxes](#listing-sandboxes)
- [Getting sandbox url](#getting-sandbox-url)
-- [Code Interpreter SDK changes](#code-interpreter-sdk-changes)
+ - [Code Interpreter SDK changes](#code-interpreter-sdk-changes)
- [Executing code](#executing-code)
- [Custom template](#custom-template)
-- [Python Async](#python-async)
+ - [Python Async](#python-async)
- [Watching for files' changes in async Python SDK](#watching-for-files-changes-in-async-python-sdk)
- [Running background commands in async Python SDK](#running-background-commands-in-async-python-sdk)
@@ -164,7 +166,59 @@ existing_sandbox = Sandbox.connect(sandbox.sandbox_id)
```
-## Uploading data and creating files in sandbox
+## Writing files to sandbox
+Use `.files.write()` method to write files to the sandbox.
+
+The method accepts `path` in the sandbox as the first argument and the `data` as the second argument.
+
+
+```js
+import Sandbox from 'e2b'
+
+// Before
+// await sandbox.filesystem.write('/hello.txt', 'Hello World!')
+
+// Now
+await sandbox.files.write('/path/in/sandbox', 'Hello World!')
+```
+```python
+from e2b import Sandbox
+
+# Before
+# sandbox.filesystem.write("/hello.txt", "Hello World!")
+
+# Now
+sandbox.files.write("/path/in/sandbox", "Hello World!")
+```
+
+
+## Reading files from sandbox
+Use `.files.read()` method to read files from the sandbox.
+
+The method accepts `path` in the sandbox as the first argument and optional `format` as the second argument.
+
+
+```js
+import Sandbox from 'e2b'
+
+// Before
+//const content = await sandbox.downloadFile('/path/in/sandbox')
+
+// Now
+const content = await sandbox.files.read('/path/in/sandbox')
+```
+```python
+from e2b import Sandbox
+
+# Before
+# content = sandbox.download_file("/path/in/sandbox")
+
+# Now
+content = sandbox.files.read("/path/in/sandbox")
+```
+
+
+## Uploading data to sandbox
Use `.files.write()` method to upload files to the sandbox.
The method accepts `path` in the sandbox as the first argument and the `data` as the second argument.
@@ -194,7 +248,7 @@ with open("path/to/local/file", "rb") as file:
```
-## Downloading files and reading files in sandbox
+## Downloading files from sandbox
Use `.files.read()` method to download files from the sandbox.
The method accepts `path` in the sandbox as the first argument and optional `format` as the second argument.
@@ -213,7 +267,7 @@ const content = await sandbox.files.read('/path/in/sandbox')
from e2b import Sandbox
# Before
-# content = sandbox.download_file('/path/in/sandbox')
+# content = sandbox.download_file("/path/in/sandbox")
# Now
content = sandbox.files.read("/path/in/sandbox")
diff --git a/apps/web/src/app/(docs)/docs/legacy/hello-world/js/page.mdx b/apps/web/src/app/(docs)/docs/legacy/hello-world/js/page.mdx
index 0e650b5ef..58ebd6929 100644
--- a/apps/web/src/app/(docs)/docs/legacy/hello-world/js/page.mdx
+++ b/apps/web/src/app/(docs)/docs/legacy/hello-world/js/page.mdx
@@ -51,7 +51,7 @@ Usually, all you need from the model is just support for tool use. If the LLM do
Create the `model.ts` file and paste the following code.
```ts
-import { Tool } from '@anthropic-ai/sdk/src/resources/beta/tools'
+import { Anthropic } from '@anthropic-ai/sdk'
export const MODEL_NAME = 'claude-3-opus-20240229'
@@ -67,7 +67,7 @@ you are a python data scientist. you are given tasks to complete and you run pyt
- you can run any python code you want, everything is running in a secure sandbox environment.
`
-export const tools: Tool[] = [
+export const tools: Anthropic.Tool[] = [
{
name: 'execute_python',
description: 'Execute python code in a Jupyter notebook cell and returns any result, stdout, stderr, display_data, and error.',
@@ -139,7 +139,7 @@ ANTHROPIC_API_KEY="anthropic-api-key"
```bash {{ language: 'python' }}
-npm i @anthropic-ai/sdk
+npm i @anthropic-ai/sdk@0.28.0
```
@@ -166,7 +166,7 @@ const anthropic = new Anthropic()
async function chat(codeInterpreter: CodeInterpreter, userMessage: string): Promise {
console.log('Waiting for Claude...')
- const msg = await anthropic.beta.tools.messages.create({
+ const msg = await anthropic.messages.create({
model: MODEL_NAME,
system: SYSTEM_PROMPT,
max_tokens: 4096,
@@ -305,4 +305,4 @@ The chart got saved in the `chart.png` file and it should look similar to this:
className="rounded w-full"
alt="Chart visualizing distribution height of men"
unoptimized
-/>
\ No newline at end of file
+/>
diff --git a/apps/web/src/app/(docs)/docs/legacy/hello-world/py/page.mdx b/apps/web/src/app/(docs)/docs/legacy/hello-world/py/page.mdx
index 40bdda1f1..fc8b6198f 100644
--- a/apps/web/src/app/(docs)/docs/legacy/hello-world/py/page.mdx
+++ b/apps/web/src/app/(docs)/docs/legacy/hello-world/py/page.mdx
@@ -130,7 +130,7 @@ ANTHROPIC_API_KEY="anthropic-api-key"
```bash {{ language: 'python' }}
-pip install anthropic
+pip install anthropic==0.35.0
```
@@ -157,7 +157,7 @@ client = Anthropic()
def chat(code_interpreter: CodeInterpreter, user_message: str) -> Tuple[List[Result], Logs]:
print(f"\n{'='*50}\nUser Message: {user_message}\n{'='*50}")
- message = client.beta.tools.messages.create(
+ message = client.messages.create(
model=MODEL_NAME,
system=SYSTEM_PROMPT,
max_tokens=4096,
@@ -250,4 +250,4 @@ The chart was saved in the `chart.png` file and it should look similar to this:
className="rounded w-full"
alt="Chart visualizing distribution height of men"
unoptimized
-/>
\ No newline at end of file
+/>
diff --git a/apps/web/src/code/python/reconnect/reconnect_2.py b/apps/web/src/code/python/reconnect/reconnect_2.py
index e3ba516a3..fd02528a3 100644
--- a/apps/web/src/code/python/reconnect/reconnect_2.py
+++ b/apps/web/src/code/python/reconnect/reconnect_2.py
@@ -5,10 +5,10 @@
sandboxID = sandbox.id
# Keep the sandbox alive for 2 minutes
-sandbox.keep_alive(60 * 60) # $HighlightLine
+sandbox.keep_alive(60 * 2) # $HighlightLine
# Close the sandbox. Even if we close the sandbox, it will stay alive, because we explicitly called keep_alive().
sandbox.close()
# Do something else...
-time.sleep(60)
\ No newline at end of file
+time.sleep(60)
diff --git a/templates/base/e2b.toml b/templates/base/e2b.toml
index 80d5456ed..85b610199 100644
--- a/templates/base/e2b.toml
+++ b/templates/base/e2b.toml
@@ -10,6 +10,7 @@
# const sandbox = await Sandbox.create({ template: 'base' })
team_id = "460355b3-4f64-48f9-9a16-4442817f79f5"
+memory_mb = 512
dockerfile = "e2b.Dockerfile"
template_name = "base"
template_id = "rki5dems9wqfm4r03t7g"