Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Update id to template in docs

Tomas Valentac85412e0fb37
diff --git a/apps/docs/src/app/guide/custom-sandbox/page.mdx b/apps/docs/src/app/guide/custom-sandbox/page.mdx
index fc3f4d820..10f7958fd 100644
--- a/apps/docs/src/app/guide/custom-sandbox/page.mdx
+++ b/apps/docs/src/app/guide/custom-sandbox/page.mdx
@@ -161,7 +161,7 @@ This way, we'll be able to spawn our custom sandbox and control it with the SDK.
import { Sandbox } from '@e2b/sdk'
// Spawn your custom sandbox
-const sandbox = await Sandbox.create({ id: 'my-agent-sandbox' }) // $HighlightLine
+const sandbox = await Sandbox.create({ template: 'my-agent-sandbox' }) // $HighlightLine
// Interact with sandbox. Learn more here:
// https://e2b.dev/docs/sandbox/overview
@@ -174,7 +174,7 @@ await sandbox.close()
from e2b import Sandbox
# Spawn your custom sandbox
-sandbox = Sandbox(id="my-agent-sandbox") # $HighlightLine
+sandbox = Sandbox(template="my-agent-sandbox") # $HighlightLine
# Interact with sandbox. Learn more here:
# https://e2b.dev/docs/sandbox/overview
diff --git a/apps/docs/src/app/sandbox/custom/page.mdx b/apps/docs/src/app/sandbox/custom/page.mdx
index d9de2928e..42d53ce4f 100644
--- a/apps/docs/src/app/sandbox/custom/page.mdx
+++ b/apps/docs/src/app/sandbox/custom/page.mdx
@@ -20,7 +20,7 @@ Once you build your custom sandbox template, you can spawn multiple isolated san
// Create new sandbox
const sandbox = await Sandbox.create({
- id: '<sandbox-template-id>', // You get sandbox ID from the CLI after you run `$ e2b build`
+ template: '<sandbox-template-id>', // You get sandbox template ID from the CLI after you run `$ e2b build`
})
// Close sandbox once done
@@ -32,7 +32,7 @@ Once you build your custom sandbox template, you can spawn multiple isolated san
# Create new sandbox
sandbox = Sandbox(
- id="<sandbox-template-id>", # You get sandbox ID from the CLI after you run `$ e2b build`
+ template="<sandbox-template-id>", # You get sandbox ID from the CLI after you run `$ e2b build`
)
# Close sandbox once done
diff --git a/apps/docs/src/app/sandbox/templates/overview/page.mdx b/apps/docs/src/app/sandbox/templates/overview/page.mdx
index 2efb58307..469705afd 100644
--- a/apps/docs/src/app/sandbox/templates/overview/page.mdx
+++ b/apps/docs/src/app/sandbox/templates/overview/page.mdx
@@ -33,7 +33,7 @@ Follow our [guide](/guide/custom-sandbox) on how to create a custom sandbox.
// Create new sandbox
const sandbox = await Sandbox.create({
// You get sandbox ID from the CLI after you run `$ e2b build`
- id: '<sandbox-template-id>', // $HighlightLine
+ template: '<sandbox-template-id>', // $HighlightLine
})
// Close sandbox once done
@@ -46,7 +46,7 @@ Follow our [guide](/guide/custom-sandbox) on how to create a custom sandbox.
# Create new sandbox
sandbox = Sandbox(
# You get sandbox ID from the CLI after you run `$ e2b build`
- id="<sandbox-template-id>", # $HighlightLine
+ template="<sandbox-template-id>", # $HighlightLine
)
# Close sandbox once done
diff --git a/apps/docs/src/code/js/agents/clone_repo.js b/apps/docs/src/code/js/agents/clone_repo.js
index e7c37fe26..0df219261 100644
--- a/apps/docs/src/code/js/agents/clone_repo.js
+++ b/apps/docs/src/code/js/agents/clone_repo.js
@@ -3,7 +3,7 @@ import { Sandbox } from '@e2b/sdk'
// 1. Start the playground sandbox
const sandbox = await Sandbox.create({
// You can pass your own sandbox template id
- id: 'base',
+ template: 'base',
apiKey: process.env.E2B_API_KEY,
})
diff --git a/apps/docs/src/code/js/agents/code_exec.js b/apps/docs/src/code/js/agents/code_exec.js
index 5a2ab5363..01ea81c3c 100644
--- a/apps/docs/src/code/js/agents/code_exec.js
+++ b/apps/docs/src/code/js/agents/code_exec.js
@@ -3,7 +3,7 @@ import { Sandbox } from '@e2b/sdk'
// 1. Start the playground sandbox
const sandbox = await Sandbox.create({
// You can pass your own sandbox template id
- id: 'base',
+ template: 'base',
})
// 2. Save the JavaScript code to a file inside the playground
diff --git a/apps/docs/src/code/js/agents/install_deps_npm.js b/apps/docs/src/code/js/agents/install_deps_npm.js
index e7750712f..1f11877ac 100644
--- a/apps/docs/src/code/js/agents/install_deps_npm.js
+++ b/apps/docs/src/code/js/agents/install_deps_npm.js
@@ -2,7 +2,7 @@ import { Sandbox } from '@e2b/sdk'
// 1. Start the playground sandbox
const sandbox = await Sandbox.create({
- id: 'base', // $HighlightLine
+ template: 'base', // $HighlightLine
apiKey: process.env.E2B_API_KEY,
})
diff --git a/apps/docs/src/code/js/agents/start_process.js b/apps/docs/src/code/js/agents/start_process.js
index 1f80e7dfa..7cc89eef4 100644
--- a/apps/docs/src/code/js/agents/start_process.js
+++ b/apps/docs/src/code/js/agents/start_process.js
@@ -3,7 +3,7 @@ import { Sandbox } from '@e2b/sdk'
// 1. Start the playground sandbox
const sandbox = await Sandbox.create({
// You can pass your own sandbox template id
- id: 'base',
+ template: 'base',
apiKey: process.env.E2B_API_KEY,
})
diff --git a/apps/docs/src/code/js/basics/download_file.js b/apps/docs/src/code/js/basics/download_file.js
index 9f0dffa19..807f49708 100644
--- a/apps/docs/src/code/js/basics/download_file.js
+++ b/apps/docs/src/code/js/basics/download_file.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
import fs from 'node:fs'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
const buffer = await sandbox.downloadFile('path/to/remote/file/inside/sandbox') // $HighlightLine
// Save file to local filesystem
diff --git a/apps/docs/src/code/js/basics/fs_ls.js b/apps/docs/src/code/js/basics/fs_ls.js
index 25d0280ab..6f4bfc880 100644
--- a/apps/docs/src/code/js/basics/fs_ls.js
+++ b/apps/docs/src/code/js/basics/fs_ls.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
})
const dirContent = await sandbox.filesystem.list('/') // $HighlightLine
diff --git a/apps/docs/src/code/js/basics/fs_mkdir.js b/apps/docs/src/code/js/basics/fs_mkdir.js
index 0b22e8028..2817d9606 100644
--- a/apps/docs/src/code/js/basics/fs_mkdir.js
+++ b/apps/docs/src/code/js/basics/fs_mkdir.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({ id: 'base' })
+const sandbox = await Sandbox.create({ template: 'base' })
// Create a new directory '/dir'
await sandbox.filesystem.makeDir('/dir') // $HighlightLine
diff --git a/apps/docs/src/code/js/basics/fs_read.js b/apps/docs/src/code/js/basics/fs_read.js
index ddb869910..ac04b4ff3 100644
--- a/apps/docs/src/code/js/basics/fs_read.js
+++ b/apps/docs/src/code/js/basics/fs_read.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
const fileContent = await sandbox.filesystem.read('/etc/hosts') // $HighlightLine
console.log(fileContent)
diff --git a/apps/docs/src/code/js/basics/fs_read_bytes.js b/apps/docs/src/code/js/basics/fs_read_bytes.js
index ab0091ef4..b0f301340 100644
--- a/apps/docs/src/code/js/basics/fs_read_bytes.js
+++ b/apps/docs/src/code/js/basics/fs_read_bytes.js
@@ -1,7 +1,7 @@
import fs from 'fs'
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// File bytes will read file's content as bytes
// `fileBytes` as a Uint8Array
diff --git a/apps/docs/src/code/js/basics/fs_watch.js b/apps/docs/src/code/js/basics/fs_watch.js
index e89486129..c620e6bc0 100644
--- a/apps/docs/src/code/js/basics/fs_watch.js
+++ b/apps/docs/src/code/js/basics/fs_watch.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// Start filesystem watcher for the /home directory
const watcher = sandbox.filesystem.watchDir('/home') // $HighlightLine
diff --git a/apps/docs/src/code/js/basics/fs_write.js b/apps/docs/src/code/js/basics/fs_write.js
index 55652af73..774a36788 100644
--- a/apps/docs/src/code/js/basics/fs_write.js
+++ b/apps/docs/src/code/js/basics/fs_write.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// `filesystem.write()` will:
// - create the file if it doesn't exist
diff --git a/apps/docs/src/code/js/basics/fs_write_bytes.js b/apps/docs/src/code/js/basics/fs_write_bytes.js
index 5aac0ee62..72b61dbac 100644
--- a/apps/docs/src/code/js/basics/fs_write_bytes.js
+++ b/apps/docs/src/code/js/basics/fs_write_bytes.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// Let's convert string to bytes for testing purposes
const encoder = new TextEncoder('utf-8')
diff --git a/apps/docs/src/code/js/basics/get_url.js b/apps/docs/src/code/js/basics/get_url.js
index 820c0b01f..0372f3b6a 100644
--- a/apps/docs/src/code/js/basics/get_url.js
+++ b/apps/docs/src/code/js/basics/get_url.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
const url = sandbox.getHostname() // $HighlightLine
console.log('https://' + url)
diff --git a/apps/docs/src/code/js/basics/get_url_port.js b/apps/docs/src/code/js/basics/get_url_port.js
index e6ed2f234..007e6b2f5 100644
--- a/apps/docs/src/code/js/basics/get_url_port.js
+++ b/apps/docs/src/code/js/basics/get_url_port.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
const openPort = 3000
const url = sandbox.getHostname(openPort) // $HighlightLine
diff --git a/apps/docs/src/code/js/basics/process_env_vars.js b/apps/docs/src/code/js/basics/process_env_vars.js
index 12f822cd2..177df9696 100644
--- a/apps/docs/src/code/js/basics/process_env_vars.js
+++ b/apps/docs/src/code/js/basics/process_env_vars.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
envVars: {FOO: 'Hello'},
})
diff --git a/apps/docs/src/code/js/basics/process_exit.js b/apps/docs/src/code/js/basics/process_exit.js
index 7aba32b03..0839482f2 100644
--- a/apps/docs/src/code/js/basics/process_exit.js
+++ b/apps/docs/src/code/js/basics/process_exit.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
onExit: () => console.log('[sandbox]', 'process ended'), // $HighlightLine
})
diff --git a/apps/docs/src/code/js/basics/process_start.js b/apps/docs/src/code/js/basics/process_start.js
index 8e0e0af35..754b814a4 100644
--- a/apps/docs/src/code/js/basics/process_start.js
+++ b/apps/docs/src/code/js/basics/process_start.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
const npmInit = await sandbox.process.start({
cmd: 'npm init -y', // $HighlightLine
diff --git a/apps/docs/src/code/js/basics/process_stop.js b/apps/docs/src/code/js/basics/process_stop.js
index 01e3c4b8e..745a23538 100644
--- a/apps/docs/src/code/js/basics/process_stop.js
+++ b/apps/docs/src/code/js/basics/process_stop.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
})
const npmInit = await sandbox.process.start({
diff --git a/apps/docs/src/code/js/basics/process_stream_stderr.js b/apps/docs/src/code/js/basics/process_stream_stderr.js
index 5295820fc..47b58957a 100644
--- a/apps/docs/src/code/js/basics/process_stream_stderr.js
+++ b/apps/docs/src/code/js/basics/process_stream_stderr.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
})
// This command will fail and output to stderr because Golang isn't installed in the cloud playground
diff --git a/apps/docs/src/code/js/basics/process_stream_stdout.js b/apps/docs/src/code/js/basics/process_stream_stdout.js
index f8a17caf9..92a00c504 100644
--- a/apps/docs/src/code/js/basics/process_stream_stdout.js
+++ b/apps/docs/src/code/js/basics/process_stream_stdout.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
onStdout: (output) => console.log('sandbox', output.line), // $HighlightLine
})
diff --git a/apps/docs/src/code/js/basics/process_write_stdin.js b/apps/docs/src/code/js/basics/process_write_stdin.js
index 87059f1f1..8e7f0cc88 100644
--- a/apps/docs/src/code/js/basics/process_write_stdin.js
+++ b/apps/docs/src/code/js/basics/process_write_stdin.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// This example will print back the string we send to the process using `sendStdin()`
diff --git a/apps/docs/src/code/js/basics/scan_ports.js b/apps/docs/src/code/js/basics/scan_ports.js
index 4e479de1f..c004dc937 100644
--- a/apps/docs/src/code/js/basics/scan_ports.js
+++ b/apps/docs/src/code/js/basics/scan_ports.js
@@ -21,7 +21,7 @@ function printNewPortAndURL(openPorts, sandbox) {
}
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
onScanPorts: (openPorts) => printNewPortAndURL(openPorts, sandbox), // $HighlightLine
})
diff --git a/apps/docs/src/code/js/basics/set_env_vars.js b/apps/docs/src/code/js/basics/set_env_vars.js
index a51fbd55e..24e17db41 100644
--- a/apps/docs/src/code/js/basics/set_env_vars.js
+++ b/apps/docs/src/code/js/basics/set_env_vars.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
envVars: {FOO: 'Hello'}, // $HighlightLine
})
diff --git a/apps/docs/src/code/js/basics/upload_file.js b/apps/docs/src/code/js/basics/upload_file.js
index a736a2e68..65d63f015 100644
--- a/apps/docs/src/code/js/basics/upload_file.js
+++ b/apps/docs/src/code/js/basics/upload_file.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
import fs from 'node:fs'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// If you're in the server environment
const filename = 'data.csv' // $HighlightLine
diff --git a/apps/docs/src/code/js/code_exec/process.js b/apps/docs/src/code/js/code_exec/process.js
index c7fff41ea..a295d2135 100644
--- a/apps/docs/src/code/js/code_exec/process.js
+++ b/apps/docs/src/code/js/code_exec/process.js
@@ -3,7 +3,7 @@ import { Sandbox } from '@e2b/sdk'
// 1. Start the playground sandbox
const sandbox = await Sandbox.create({
// You can pass your own sandbox template id
- id: 'base',
+ template: 'base',
apiKey: process.env.E2B_API_KEY,
})
diff --git a/apps/docs/src/code/js/cwd/filesystem.js b/apps/docs/src/code/js/cwd/filesystem.js
index dac0b420c..9f8cf3be4 100644
--- a/apps/docs/src/code/js/cwd/filesystem.js
+++ b/apps/docs/src/code/js/cwd/filesystem.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
cwd: '/home/user/code', // $HighlightLine
})
diff --git a/apps/docs/src/code/js/cwd/process.js b/apps/docs/src/code/js/cwd/process.js
index 98eeed2bd..fc7289e4b 100644
--- a/apps/docs/src/code/js/cwd/process.js
+++ b/apps/docs/src/code/js/cwd/process.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
cwd: '/code', // $HighlightLine
})
diff --git a/apps/docs/src/code/js/cwd/sandbox.js b/apps/docs/src/code/js/cwd/sandbox.js
index 1e9a0da73..7141641fc 100644
--- a/apps/docs/src/code/js/cwd/sandbox.js
+++ b/apps/docs/src/code/js/cwd/sandbox.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
cwd: '/code', // $HighlightLine
})
diff --git a/apps/docs/src/code/js/logging/e2b_logging.js b/apps/docs/src/code/js/logging/e2b_logging.js
index 87ec6ecea..1a308a3d4 100644
--- a/apps/docs/src/code/js/logging/e2b_logging.js
+++ b/apps/docs/src/code/js/logging/e2b_logging.js
@@ -9,7 +9,7 @@ const logger = {
}
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
apiKey: process.env.E2B_API_KEY,
logger, // $HighlightLine
})
diff --git a/apps/docs/src/code/js/processes/background_processes.js b/apps/docs/src/code/js/processes/background_processes.js
index ece37170b..0ef9d4f75 100644
--- a/apps/docs/src/code/js/processes/background_processes.js
+++ b/apps/docs/src/code/js/processes/background_processes.js
@@ -1,7 +1,7 @@
import { Sandbox } from '@e2b/sdk'
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
apiKey: process.env.E2B_API_KEY,
})
diff --git a/apps/docs/src/code/js/quickstart.js b/apps/docs/src/code/js/quickstart.js
index cbe6bbe33..4d8083918 100644
--- a/apps/docs/src/code/js/quickstart.js
+++ b/apps/docs/src/code/js/quickstart.js
@@ -3,7 +3,7 @@ import { Sandbox } from '@e2b/sdk'
// 1. Start cloud playground
const sandbox = await Sandbox.create({
// $HighlightLine
- id: 'base', // or you can pass your own sandbox template id
+ template: 'base', // or you can pass your own sandbox template id
apiKey: process.env.E2B_API_KEY,
})
diff --git a/apps/docs/src/code/js/reconnect/reconnect.js b/apps/docs/src/code/js/reconnect/reconnect.js
index 22fff2dcb..53134b221 100644
--- a/apps/docs/src/code/js/reconnect/reconnect.js
+++ b/apps/docs/src/code/js/reconnect/reconnect.js
@@ -4,7 +4,7 @@ async function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// Do something in the sandbox
await sandbox.filesystem.write('hello.txt', 'Hello World!')
diff --git a/apps/docs/src/code/js/reconnect/reconnect_1.js b/apps/docs/src/code/js/reconnect/reconnect_1.js
index bf8d68406..213722dec 100644
--- a/apps/docs/src/code/js/reconnect/reconnect_1.js
+++ b/apps/docs/src/code/js/reconnect/reconnect_1.js
@@ -4,4 +4,4 @@ async function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
-const sandbox = await Sandbox.create({id: 'base'})
\ No newline at end of file
+const sandbox = await Sandbox.create({ template: 'base' })
\ No newline at end of file
diff --git a/apps/docs/src/code/js/timeout/timeout_filesystem.js b/apps/docs/src/code/js/timeout/timeout_filesystem.js
index 6cbe4b130..99ccdd21e 100644
--- a/apps/docs/src/code/js/timeout/timeout_filesystem.js
+++ b/apps/docs/src/code/js/timeout/timeout_filesystem.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// Timeout 3s for the write operation
await sandbox.filesystem.write('hello.txt', 'Hello World!', {timeout: 3000}) // $HighlightLine
diff --git a/apps/docs/src/code/js/timeout/timeout_process.js b/apps/docs/src/code/js/timeout/timeout_process.js
index 81ce58eb7..bfe3633aa 100644
--- a/apps/docs/src/code/js/timeout/timeout_process.js
+++ b/apps/docs/src/code/js/timeout/timeout_process.js
@@ -1,6 +1,6 @@
import { Sandbox } from '@e2b/sdk'
-const sandbox = await Sandbox.create({id: 'base'})
+const sandbox = await Sandbox.create({ template: 'base' })
// Timeout 3s for the process to start
const npmInit = await sandbox.process.start({
diff --git a/apps/docs/src/code/js/timeout/timeout_sandbox.js b/apps/docs/src/code/js/timeout/timeout_sandbox.js
index d2bc2464e..e9e379470 100644
--- a/apps/docs/src/code/js/timeout/timeout_sandbox.js
+++ b/apps/docs/src/code/js/timeout/timeout_sandbox.js
@@ -2,7 +2,7 @@ import { Sandbox } from '@e2b/sdk'
// Timeout 3s for the sandbox to open
const sandbox = await Sandbox.create({
- id: 'base',
+ template: 'base',
timeout: 3000, // $HighlightLine
})
diff --git a/apps/docs/src/code/python/agents/clone_repo.py b/apps/docs/src/code/python/agents/clone_repo.py
index 8af9823f7..835f2e29a 100644
--- a/apps/docs/src/code/python/agents/clone_repo.py
+++ b/apps/docs/src/code/python/agents/clone_repo.py
@@ -13,7 +13,7 @@ def main():
# 1. Start the playground sandbox
sandbox = Sandbox(
# Select the right runtime
- id="base",
+ template="base",
api_key=E2B_API_KEY,
)
diff --git a/apps/docs/src/code/python/agents/code_exec.py b/apps/docs/src/code/python/agents/code_exec.py
index 56b0eee4d..60a20d85b 100644
--- a/apps/docs/src/code/python/agents/code_exec.py
+++ b/apps/docs/src/code/python/agents/code_exec.py
@@ -8,7 +8,7 @@ def print_out(output):
# 1. Start the playground sandbox
sandbox = Sandbox(
# You can pass your own sandbox template id
- id="base",
+ template="base",
)
# 2. Save the JavaScript code to a file inside the playground
diff --git a/apps/docs/src/code/python/agents/start_process.py b/apps/docs/src/code/python/agents/start_process.py
index 4e5ba1028..6d4838ffd 100644
--- a/apps/docs/src/code/python/agents/start_process.py
+++ b/apps/docs/src/code/python/agents/start_process.py
@@ -13,7 +13,7 @@ def main():
# 1. Start the playground sandbox
sandbox = Sandbox(
# Select the right runtime
- id="base",
+ template="base",
api_key=E2B_API_KEY,
)
diff --git a/apps/docs/src/code/python/basics/download_file.py b/apps/docs/src/code/python/basics/download_file.py
index a645132cc..2984ab0fb 100644
--- a/apps/docs/src/code/python/basics/download_file.py
+++ b/apps/docs/src/code/python/basics/download_file.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
file_in_bytes = sandbox.download_file("path/to/remote/file/inside/sandbox") # $HighlightLine
# Save file to local filesystem
diff --git a/apps/docs/src/code/python/basics/fs_ls.py b/apps/docs/src/code/python/basics/fs_ls.py
index b9dcd11dc..c27daba4e 100644
--- a/apps/docs/src/code/python/basics/fs_ls.py
+++ b/apps/docs/src/code/python/basics/fs_ls.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
# List the root directory
content = sandbox.filesystem.list("/") # $HighlightLine
diff --git a/apps/docs/src/code/python/basics/fs_mkdir.py b/apps/docs/src/code/python/basics/fs_mkdir.py
index dd6469b36..8657f9c2d 100644
--- a/apps/docs/src/code/python/basics/fs_mkdir.py
+++ b/apps/docs/src/code/python/basics/fs_mkdir.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
# Create a new directory '/dir'
sandbox.filesystem.make_dir("/dir") # $HighlightLine
diff --git a/apps/docs/src/code/python/basics/fs_read.py b/apps/docs/src/code/python/basics/fs_read.py
index 3a025204d..ea38ab74c 100644
--- a/apps/docs/src/code/python/basics/fs_read.py
+++ b/apps/docs/src/code/python/basics/fs_read.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
# Read the '/etc/hosts' file
file_content = sandbox.filesystem.read("/etc/hosts") # $HighlightLine
diff --git a/apps/docs/src/code/python/basics/fs_read_bytes.py b/apps/docs/src/code/python/basics/fs_read_bytes.py
index e40387ade..ff5a50a11 100644
--- a/apps/docs/src/code/python/basics/fs_read_bytes.py
+++ b/apps/docs/src/code/python/basics/fs_read_bytes.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
# File bytes will read file's content as bytes
# `file_bytes` as a bytearray
diff --git a/apps/docs/src/code/python/basics/fs_watch.py b/apps/docs/src/code/python/basics/fs_watch.py
index d7bb474f1..09c267b4f 100644
--- a/apps/docs/src/code/python/basics/fs_watch.py
+++ b/apps/docs/src/code/python/basics/fs_watch.py
@@ -12,7 +12,7 @@ def create_watcher(sandbox): # $HighlightLine
watcher.start() # $HighlightLine
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
create_watcher(sandbox) # $HighlightLine
diff --git a/apps/docs/src/code/python/basics/fs_write.py b/apps/docs/src/code/python/basics/fs_write.py
index 48ffac64c..df1b869dc 100644
--- a/apps/docs/src/code/python/basics/fs_write.py
+++ b/apps/docs/src/code/python/basics/fs_write.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
# `filesystem.write()` will:
# - create the file if it doesn't exist
diff --git a/apps/docs/src/code/python/basics/fs_write_bytes.py b/apps/docs/src/code/python/basics/fs_write_bytes.py
index 6f38b9ed0..762b9dc72 100644
--- a/apps/docs/src/code/python/basics/fs_write_bytes.py
+++ b/apps/docs/src/code/python/basics/fs_write_bytes.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
content_in_bytes = bytearray(b"Hello world")
diff --git a/apps/docs/src/code/python/basics/get_url.py b/apps/docs/src/code/python/basics/get_url.py
index b425b2613..afab231d0 100644
--- a/apps/docs/src/code/python/basics/get_url.py
+++ b/apps/docs/src/code/python/basics/get_url.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
url = sandbox.get_hostname() # $HighlightLine
print("https://" + url)
diff --git a/apps/docs/src/code/python/basics/get_url_port.py b/apps/docs/src/code/python/basics/get_url_port.py
index a005e8e35..3e273eace 100644
--- a/apps/docs/src/code/python/basics/get_url_port.py
+++ b/apps/docs/src/code/python/basics/get_url_port.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
open_port = 3000
url = sandbox.get_hostname(open_port) # $HighlightLine
diff --git a/apps/docs/src/code/python/basics/process_env_vars.py b/apps/docs/src/code/python/basics/process_env_vars.py
index b707567ee..4ae94e2b6 100644
--- a/apps/docs/src/code/python/basics/process_env_vars.py
+++ b/apps/docs/src/code/python/basics/process_env_vars.py
@@ -1,7 +1,7 @@
from e2b import Sandbox
sandbox = Sandbox(
- id="base",
+ template="base",
env_vars={"FOO": "Hello"}
)
diff --git a/apps/docs/src/code/python/basics/process_exit.py b/apps/docs/src/code/python/basics/process_exit.py
index ce6e1f11c..4e1a80361 100644
--- a/apps/docs/src/code/python/basics/process_exit.py
+++ b/apps/docs/src/code/python/basics/process_exit.py
@@ -1,7 +1,7 @@
from e2b import Sandbox
sandbox = Sandbox(
- id="base",
+ template="base",
on_exit=lambda: print("[sandbox]", "process ended"), # $HighlightLine
)
diff --git a/apps/docs/src/code/python/basics/process_start.py b/apps/docs/src/code/python/basics/process_start.py
index 7a38d9383..af1aae136 100644
--- a/apps/docs/src/code/python/basics/process_start.py
+++ b/apps/docs/src/code/python/basics/process_start.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
npm_init = sandbox.process.start("npm init -y") # $HighlightLine
npm_init.wait()
diff --git a/apps/docs/src/code/python/basics/process_stop.py b/apps/docs/src/code/python/basics/process_stop.py
index 072c1808f..57bcf997a 100644
--- a/apps/docs/src/code/python/basics/process_stop.py
+++ b/apps/docs/src/code/python/basics/process_stop.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
npm_init = sandbox.process.start("npm init -y")
npm_init.kill() # $HighlightLine
diff --git a/apps/docs/src/code/python/basics/process_stream_stderr.py b/apps/docs/src/code/python/basics/process_stream_stderr.py
index c40d4e445..ce25ccf00 100644
--- a/apps/docs/src/code/python/basics/process_stream_stderr.py
+++ b/apps/docs/src/code/python/basics/process_stream_stderr.py
@@ -1,7 +1,7 @@
from e2b import Sandbox
sandbox = Sandbox(
- id="base",
+ template="base",
on_stderr=lambda output: print("[sandbox]", output.line), # $HighlightLine
)
diff --git a/apps/docs/src/code/python/basics/process_stream_stdout.py b/apps/docs/src/code/python/basics/process_stream_stdout.py
index 4838cafc8..07b2a6b51 100644
--- a/apps/docs/src/code/python/basics/process_stream_stdout.py
+++ b/apps/docs/src/code/python/basics/process_stream_stdout.py
@@ -1,7 +1,7 @@
from e2b import Sandbox
sandbox = Sandbox(
- id="base",
+ template="base",
on_stdout=lambda output: print("sandbox", output.line), # $HighlightLine
)
diff --git a/apps/docs/src/code/python/basics/process_write_stdin.py b/apps/docs/src/code/python/basics/process_write_stdin.py
index 50c7c53b9..7786d2a7f 100644
--- a/apps/docs/src/code/python/basics/process_write_stdin.py
+++ b/apps/docs/src/code/python/basics/process_write_stdin.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
# This example will print back the string we send to the process using `send_stdin()`
diff --git a/apps/docs/src/code/python/basics/scan_ports.py b/apps/docs/src/code/python/basics/scan_ports.py
index 24433424d..023c2ba6d 100644
--- a/apps/docs/src/code/python/basics/scan_ports.py
+++ b/apps/docs/src/code/python/basics/scan_ports.py
@@ -23,7 +23,7 @@ def print_new_port_and_url(open_ports, sandbox):
sandbox = Sandbox(
- id="base",
+ template="base",
on_scan_ports=lambda open_ports: print_new_port_and_url(open_ports, sandbox) # $HighlightLine
)
diff --git a/apps/docs/src/code/python/basics/set_env_vars.py b/apps/docs/src/code/python/basics/set_env_vars.py
index be3a3e004..30234e9d4 100644
--- a/apps/docs/src/code/python/basics/set_env_vars.py
+++ b/apps/docs/src/code/python/basics/set_env_vars.py
@@ -1,7 +1,7 @@
from e2b import Sandbox
sandbox = Sandbox(
- id="base",
+ template="base",
env_vars={"FOO": "Hello"}, # $HighlightLine
)
diff --git a/apps/docs/src/code/python/basics/upload_file.py b/apps/docs/src/code/python/basics/upload_file.py
index c8eb0199d..4d9b3fea4 100644
--- a/apps/docs/src/code/python/basics/upload_file.py
+++ b/apps/docs/src/code/python/basics/upload_file.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
with open("path/to/local/file", "rb") as f:
remote_path = sandbox.upload_file(f) # $HighlightLine
diff --git a/apps/docs/src/code/python/code_exec/process.py b/apps/docs/src/code/python/code_exec/process.py
index bf52a6d81..840e8f56e 100644
--- a/apps/docs/src/code/python/code_exec/process.py
+++ b/apps/docs/src/code/python/code_exec/process.py
@@ -13,7 +13,7 @@ def main():
# 1. Start the playground sandbox
sandbox = Sandbox(
# You can pass your own sandbox template id
- id="base",
+ template="base",
api_key=E2B_API_KEY,
)
diff --git a/apps/docs/src/code/python/cwd/filesystem.py b/apps/docs/src/code/python/cwd/filesystem.py
index a80c01331..6aa0f439d 100644
--- a/apps/docs/src/code/python/cwd/filesystem.py
+++ b/apps/docs/src/code/python/cwd/filesystem.py
@@ -1,7 +1,7 @@
from e2b import Sandbox
sandbox = Sandbox(
- id="base",
+ template="base",
cwd="/home/user/code" # $HighlightLine
)
sandbox.filesystem.write("hello.txt", "Welcome to E2B!") # $HighlightLine
diff --git a/apps/docs/src/code/python/cwd/process.py b/apps/docs/src/code/python/cwd/process.py
index 5a512f380..ef8882107 100644
--- a/apps/docs/src/code/python/cwd/process.py
+++ b/apps/docs/src/code/python/cwd/process.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base", cwd="/code") # $HighlightLine
+sandbox = Sandbox(template="base", cwd="/code") # $HighlightLine
sandbox_cwd = sandbox.process.start("pwd") # $HighlightLine
sandbox_cwd.wait()
print(sandbox_cwd.output.stdout)
diff --git a/apps/docs/src/code/python/cwd/sandbox.py b/apps/docs/src/code/python/cwd/sandbox.py
index 4fb8836cc..89f0f7fd5 100644
--- a/apps/docs/src/code/python/cwd/sandbox.py
+++ b/apps/docs/src/code/python/cwd/sandbox.py
@@ -1,7 +1,7 @@
from e2b import Sandbox
sandbox = Sandbox(
- id="base",
+ template="base",
cwd="/code", # $HighlightLine
)
diff --git a/apps/docs/src/code/python/logging/e2b_logging.py b/apps/docs/src/code/python/logging/e2b_logging.py
index eaa36809b..6e161e597 100644
--- a/apps/docs/src/code/python/logging/e2b_logging.py
+++ b/apps/docs/src/code/python/logging/e2b_logging.py
@@ -30,7 +30,7 @@ e2b_logger.addHandler(handler) # $HighlightLine
def main():
- sandbox = Sandbox(id="base", api_key=E2B_API_KEY)
+ sandbox = Sandbox(template="base", api_key=E2B_API_KEY)
sandbox.filesystem.write("test.txt", "Hello World")
sandbox.close()
diff --git a/apps/docs/src/code/python/processes/background_processes.py b/apps/docs/src/code/python/processes/background_processes.py
index 1d78c03ff..9f95de844 100644
--- a/apps/docs/src/code/python/processes/background_processes.py
+++ b/apps/docs/src/code/python/processes/background_processes.py
@@ -11,7 +11,7 @@ def print_stdout(output):
def main():
- sandbox = Sandbox(id="base", api_key=E2B_API_KEY)
+ sandbox = Sandbox(template="base", api_key=E2B_API_KEY)
# Start a server process in the background
# We are not using `background_server.wait()` - that would wait for the process to finish running
diff --git a/apps/docs/src/code/python/timeout/timeout_filesystem.py b/apps/docs/src/code/python/timeout/timeout_filesystem.py
index 85dfd28e3..943e4ff65 100644
--- a/apps/docs/src/code/python/timeout/timeout_filesystem.py
+++ b/apps/docs/src/code/python/timeout/timeout_filesystem.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
# Timeout 3s for the write operation
sandbox.filesystem.write("test.txt", "Hello World", timeout=3) # $HighlightLine
diff --git a/apps/docs/src/code/python/timeout/timeout_process.py b/apps/docs/src/code/python/timeout/timeout_process.py
index 657f2c1b3..f3ff68e81 100644
--- a/apps/docs/src/code/python/timeout/timeout_process.py
+++ b/apps/docs/src/code/python/timeout/timeout_process.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
-sandbox = Sandbox(id="base")
+sandbox = Sandbox(template="base")
# Timeout 3s for the process to start
npm_init = sandbox.process.start("npm init -y", timeout=3) # $HighlightLine
diff --git a/apps/docs/src/code/python/timeout/timeout_sandbox.py b/apps/docs/src/code/python/timeout/timeout_sandbox.py
index 8d3b1a2df..acd0cab5d 100644
--- a/apps/docs/src/code/python/timeout/timeout_sandbox.py
+++ b/apps/docs/src/code/python/timeout/timeout_sandbox.py
@@ -1,6 +1,6 @@
from e2b import Sandbox
# Timeout 3s for the sandbox to open
-sandbox = Sandbox(id="base", timeout=3) # $HighlightLine
+sandbox = Sandbox(template="base", timeout=3) # $HighlightLine
sandbox.close()