Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
[skip ci] Release new SDK API reference doc versions
github-actions[bot]c94d57605748
diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/filesystem/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/filesystem/page.mdxindex 09bd7a7ed..4c2426ec8 100644--- a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/filesystem/page.mdx+++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/filesystem/page.mdx@@ -4,6 +4,8 @@### FileType+Type of filesystem object.+#### Enumeration Members##### DIR@@ -12,7 +14,7 @@###### Defined in-sandbox/filesystem/index.ts:34+sandbox/filesystem/index.ts:40##### FILE@@ -20,12 +22,14 @@ sandbox/filesystem/index.ts:34###### Defined in-sandbox/filesystem/index.ts:33+sandbox/filesystem/index.ts:39## Classes### Filesystem+Manager for interacting with the filesystem in the sandbox.+#### Constructors##### new Filesystem()@@ -46,7 +50,7 @@ sandbox/filesystem/index.ts:33###### Defined in-sandbox/filesystem/index.ts:60+sandbox/filesystem/index.ts:76#### Methods@@ -54,55 +58,79 @@ sandbox/filesystem/index.ts:60> **exists**(`path`, `opts`?): `Promise`\<`boolean`\>+Checks if a file or a directory exists.+###### Parameters• **path**: `string`+Path to a file or a directory+• **opts?**: `FilesystemRequestOpts`+Options for the request+###### Returns`Promise`\<`boolean`\>+True if the file or directory exists, false otherwise+###### Defined in-sandbox/filesystem/index.ts:214+sandbox/filesystem/index.ts:325##### list()> **list**(`path`, `opts`?): `Promise`\<`EntryInfo`[]\>+Lists entries in a directory.+###### Parameters• **path**: `string`+Path to the directory+• **opts?**: `FilesystemRequestOpts`+Options for the request+###### Returns`Promise`\<`EntryInfo`[]\>+List of entries in the directory+###### Defined in-sandbox/filesystem/index.ts:132+sandbox/filesystem/index.ts:200##### makeDir()> **makeDir**(`path`, `opts`?): `Promise`\<`boolean`\>+Creates a new directory and all directories along the way if needed on the specified pth.+###### Parameters• **path**: `string`+Path to a new directory. For example '/dirA/dirB' when creating 'dirB'.+• **opts?**: `FilesystemRequestOpts`+Options for the request+###### Returns`Promise`\<`boolean`\>+True if the directory was created, false if it already exists+###### Defined in-sandbox/filesystem/index.ts:159+sandbox/filesystem/index.ts:237##### read()@@ -110,19 +138,27 @@ sandbox/filesystem/index.ts:159> **read**(`path`, `opts`?): `Promise`\<`string`\>+Reads a whole file content and returns it in requested format (text by default).+###### Parameters• **path**: `string`+Path to the file+• **opts?**: `FilesystemRequestOpts` & `object`+Options for the request+###### Returns`Promise`\<`string`\>+File content in requested format+###### Defined in-sandbox/filesystem/index.ts:68+sandbox/filesystem/index.ts:92###### read(path, opts)@@ -140,7 +176,7 @@ sandbox/filesystem/index.ts:68###### Defined in-sandbox/filesystem/index.ts:69+sandbox/filesystem/index.ts:96###### read(path, opts)@@ -158,7 +194,7 @@ sandbox/filesystem/index.ts:69###### Defined in-sandbox/filesystem/index.ts:70+sandbox/filesystem/index.ts:100###### read(path, opts)@@ -176,90 +212,131 @@ sandbox/filesystem/index.ts:70###### Defined in-sandbox/filesystem/index.ts:71+sandbox/filesystem/index.ts:104##### remove()> **remove**(`path`, `opts`?): `Promise`\<`void`\>+Removes a file or a directory.+###### Parameters• **path**: `string`+Path to a file or a directory+• **opts?**: `FilesystemRequestOpts`+Options for the request+###### Returns`Promise`\<`void`\>###### Defined in-sandbox/filesystem/index.ts:203+sandbox/filesystem/index.ts:304##### rename()> **rename**(`oldPath`, `newPath`, `opts`?): `Promise`\<`EntryInfo`\>+Renames a file or directory from one path to another.+###### Parameters• **oldPath**: `string`+Path to the file or directory to move+• **newPath**: `string`+Path to move the file or directory to+• **opts?**: `FilesystemRequestOpts`+Options for the request+###### Returns`Promise`\<`EntryInfo`\>+Information about the moved object+###### Defined in-sandbox/filesystem/index.ts:178+sandbox/filesystem/index.ts:267##### watch()> **watch**(`path`, `onEvent`, `opts`?): `Promise`\<`WatchHandle`\>+Watches directory for filesystem events.+###### Parameters• **path**: `string`+Path to a directory that will be watched+• **onEvent**+Callback that will be called when an event in the directory occurs+• **opts?**: `FilesystemRequestOpts` & `object`+Options for the request+###### Returns`Promise`\<`WatchHandle`\>+New watcher+###### Defined in-sandbox/filesystem/index.ts:233+sandbox/filesystem/index.ts:355##### write()> **write**(`path`, `data`, `opts`?): `Promise`\<`EntryInfo`\>+Writes content to a file on the path.+ When writing to a file that doesn't exist, the file will get created.+ When writing to a file that already exists, the file will get overwritten.+ When writing to a file that's in a directory that doesn't exist, you'll get an error.+###### Parameters• **path**: `string`+Path to a new file. For example '/dirA/dirB/newFile.txt' when creating 'newFile.txt'+• **data**: `string` \| `ArrayBuffer` \| `Blob` \| `ReadableStream`\<`any`\>+Data to write to a new file+• **opts?**: `FilesystemRequestOpts`+Options for the request+###### Returns`Promise`\<`EntryInfo`\>+Information about the written file+###### Defined in-sandbox/filesystem/index.ts:98+sandbox/filesystem/index.ts:155## Interfaces### EntryInfo+Information about a filesystem object.+#### Properties##### name@@ -268,7 +345,7 @@ sandbox/filesystem/index.ts:98###### Defined in-sandbox/filesystem/index.ts:27+sandbox/filesystem/index.ts:30##### path@@ -276,7 +353,7 @@ sandbox/filesystem/index.ts:27###### Defined in-sandbox/filesystem/index.ts:29+sandbox/filesystem/index.ts:32##### type?@@ -284,12 +361,14 @@ sandbox/filesystem/index.ts:29###### Defined in-sandbox/filesystem/index.ts:28+sandbox/filesystem/index.ts:31***### FilesystemRequestOpts+Options for sending a request to the filesystem.+#### Extended by- `WatchOpts`@@ -302,7 +381,7 @@ sandbox/filesystem/index.ts:28###### Defined in-connectionConfig.ts:14+connectionConfig.ts:17##### user?@@ -310,12 +389,14 @@ connectionConfig.ts:14###### Defined in-sandbox/filesystem/index.ts:47+sandbox/filesystem/index.ts:57***### WatchOpts+Options for watching a directory.+#### Properties##### onExit()?@@ -332,7 +413,7 @@ sandbox/filesystem/index.ts:47###### Defined in-sandbox/filesystem/index.ts:52+sandbox/filesystem/index.ts:65##### requestTimeoutMs?@@ -340,7 +421,7 @@ sandbox/filesystem/index.ts:52###### Defined in-connectionConfig.ts:14+connectionConfig.ts:17##### timeout?@@ -348,7 +429,7 @@ connectionConfig.ts:14###### Defined in-sandbox/filesystem/index.ts:51+sandbox/filesystem/index.ts:64##### user?@@ -356,4 +437,4 @@ sandbox/filesystem/index.ts:51###### Defined in-sandbox/filesystem/index.ts:47+sandbox/filesystem/index.ts:57diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/process/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/process/page.mdxindex 354462a37..2adf95f20 100644--- a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/process/page.mdx+++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/process/page.mdx@@ -21,3 +21,7 @@ Re-exports ProcessRequestOpts### ProcessStartOptsRe-exports ProcessStartOpts++### Pty++Re-exports Ptydiff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/sandbox/page.mdxindex ba54cc153..3e32d22a1 100644--- a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/sandbox/page.mdx+++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/sandbox/page.mdx@@ -4,23 +4,28 @@### Sandbox-#### Constructors+E2B cloud sandbox gives your agent a full cloud development environment that's sandboxed.-##### new Sandbox()+That means:+- Access to Linux OS+- Using filesystem (create, list, and delete files and dirs)+- Run commands+- Sandboxed - you can run any code+- Access to the internet-> **new Sandbox**(`opts`): `Sandbox`+Check usage docs - https://e2b.dev/docs/sandbox/overview-###### Parameters--• **opts**: `Omit`\<`SandboxOpts`, `"metadata"` \| `"envs"` \| `"timeoutMs"`\> & `object`+These cloud sandboxes are meant to be used for agents. Like a sandboxed playgrounds, where the agent can do whatever it wants.-###### Returns+Use the Sandbox.create method to create a new sandbox.-`Sandbox`+#### Example-###### Defined in+```ts+import { Sandbox } from '@e2b/sdk'-sandbox/index.ts:33+const sandbox = await Sandbox.create()+```#### Properties@@ -28,33 +33,41 @@ sandbox/index.ts:33> `readonly` **commands**: `Process`+Commands module for interacting with the sandbox's processes+###### Defined in-sandbox/index.ts:22+sandbox/index.ts:57##### files> `readonly` **files**: `Filesystem`+Filesystem module for interacting with the sandbox's filesystem+###### Defined in-sandbox/index.ts:21+sandbox/index.ts:53##### pty> `readonly` **pty**: `Pty`+PTY module for interacting with the sandbox's pseudo-terminal+###### Defined in-sandbox/index.ts:23+sandbox/index.ts:61##### sandboxId> `readonly` **sandboxId**: `string`+Unique identifier of the sandbox.+###### Defined in-sandbox/index.ts:25+sandbox/index.ts:66#### Methods@@ -62,38 +75,62 @@ sandbox/index.ts:25> **downloadUrl**(`path`): `string`+Get the URL to download a file from the sandbox.+###### Parameters• **path**: `string`+Path to the file+###### Returns`string`+URL to download the file+###### Defined in-sandbox/index.ts:125+sandbox/index.ts:297##### getHost()> **getHost**(`port`): `string`+Get the hostname for the specified sandbox's port.+###### Parameters• **port**: `number`+Port number of a specific port in the sandbox+###### Returns`string`+Hostname of the sandbox's port++###### Example++```ts+const sandbox = await Sandbox.create()+// Start an HTTP server+await sandbox.commands.exec('python3 -m http.server 3000')+// Get the hostname of the HTTP server+const serverURL = sandbox.getHost(3000)+``+###### Defined in-sandbox/index.ts:76+sandbox/index.ts:198##### isRunning()> **isRunning**(`opts`?): `Promise`\<`boolean`\>+Check if the sandbox is running.+###### Parameters• **opts?**: `Pick`\<`ConnectionOpts`, `"requestTimeoutMs"`\>@@ -102,64 +139,102 @@ sandbox/index.ts:76`Promise`\<`boolean`\>+`true` if the sandbox is running, `false` otherwise++###### Example++```ts+const sandbox = await Sandbox.create()+await sandbox.isRunning() // Returns true++await sandbox.kill()+await sandbox.isRunning() // Returns false+```+###### Defined in-sandbox/index.ts:84+sandbox/index.ts:219##### kill()> **kill**(`opts`?): `Promise`\<`void`\>+Kill the sandbox.+###### Parameters• **opts?**: `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\>+Connection options+###### Returns`Promise`\<`void`\>+Promise that resolves when the sandbox is killed+###### Defined in-sandbox/index.ts:112+sandbox/index.ts:270##### setTimeout()> **setTimeout**(`timeoutMs`, `opts`?): `Promise`\<`void`\>+Set the sandbox's timeout, after which the sandbox will be automatically killed.+The sandbox can be kept alive for a maximum of 24 hours from the time of creation.+If you try to set the timeout to a period, which exceeds the maximum limit, the timeout will be set to the maximum limit.+###### Parameters• **timeoutMs**: `number`+Duration in milliseconds. Must be between 0 and 86400000 milliseconds (24 hours).+• **opts?**: `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\>+Connection options+###### Returns`Promise`\<`void`\>+Promise that resolves when the sandbox is kept alive+###### Defined in-sandbox/index.ts:103+sandbox/index.ts:249##### uploadUrl()> **uploadUrl**(`path`?): `string`+Get the URL to upload a file to the sandbox.+You have to send a POST request to this URL with the file as the field in the form data.+You can find the specification for this API at https://github.com/e2b-dev/E2B/blob/main/spec/envd/envd.yaml.+###### Parameters• **path?**: `string`+Path to the directory where the file will be uploaded, defaults to user's home directory+###### Returns`string`+URL to upload the file+###### Defined in-sandbox/index.ts:121+sandbox/index.ts:287##### connect()> `static` **connect**\<`S`\>(`this`, `sandboxId`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\>+Connects to an existing Sandbox.+###### Type Parameters• **S** *extends* *typeof* `Sandbox`@@ -170,15 +245,31 @@ sandbox/index.ts:121• **sandboxId**: `string`+Sandbox ID+• **opts?**: `Omit`\<`SandboxOpts`, `"metadata"` \| `"envs"` \| `"timeoutMs"`\>+Connection options+###### Returns`Promise`\<`InstanceType`\<`S`\>\>+Existing Sandbox++###### Example++```ts+const sandbox = await Sandbox.create()+const sandboxId = sandbox.sandboxId++// Another code block+const sameSandbox = await Sandbox.connect(sandboxId)+```+###### Defined in-sandbox/index.ts:69+sandbox/index.ts:173##### create()@@ -186,6 +277,8 @@ sandbox/index.ts:69> `static` **create**\<`S`\>(`this`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\>+Creates a new Sandbox from the default `base` sandbox template.+###### Type Parameters• **S** *extends* *typeof* `Sandbox`@@ -196,13 +289,27 @@ sandbox/index.ts:69• **opts?**: `SandboxOpts`+Connection options+###### Returns`Promise`\<`InstanceType`\<`S`\>\>+New Sandbox++###### Example++```ts+const sandbox = await Sandbox.create()+```++###### Constructs++Sandbox+###### Defined in-sandbox/index.ts:52+sandbox/index.ts:125###### create(this, template, opts)@@ -226,7 +333,7 @@ sandbox/index.ts:52###### Defined in-sandbox/index.ts:53+sandbox/index.ts:129##### kill()@@ -250,7 +357,7 @@ Connection options.###### Defined in-sandbox/sandboxApi.ts:47+sandbox/sandboxApi.ts:53##### list()@@ -266,7 +373,7 @@ sandbox/sandboxApi.ts:47###### Defined in-sandbox/sandboxApi.ts:72+sandbox/sandboxApi.ts:81##### setTimeout()@@ -286,12 +393,14 @@ sandbox/sandboxApi.ts:72###### Defined in-sandbox/sandboxApi.ts:94+sandbox/sandboxApi.ts:108## Interfaces### SandboxOpts+Options for creating a new Sandbox.+#### Properties##### accessToken?@@ -300,7 +409,7 @@ sandbox/sandboxApi.ts:94###### Defined in-connectionConfig.ts:11+connectionConfig.ts:14##### apiKey?@@ -308,7 +417,7 @@ connectionConfig.ts:11###### Defined in-connectionConfig.ts:10+connectionConfig.ts:13##### debug?@@ -316,7 +425,7 @@ connectionConfig.ts:10###### Defined in-connectionConfig.ts:13+connectionConfig.ts:16##### domain?@@ -324,7 +433,7 @@ connectionConfig.ts:13###### Defined in-connectionConfig.ts:12+connectionConfig.ts:15##### envs?@@ -332,7 +441,7 @@ connectionConfig.ts:12###### Defined in-sandbox/index.ts:13+sandbox/index.ts:19##### logger?@@ -340,7 +449,7 @@ sandbox/index.ts:13###### Defined in-connectionConfig.ts:15+connectionConfig.ts:18##### metadata?@@ -348,7 +457,7 @@ connectionConfig.ts:15###### Defined in-sandbox/index.ts:12+sandbox/index.ts:18##### requestTimeoutMs?@@ -356,7 +465,7 @@ sandbox/index.ts:12###### Defined in-connectionConfig.ts:14+connectionConfig.ts:17##### timeoutMs?@@ -364,4 +473,4 @@ connectionConfig.ts:14###### Defined in-sandbox/index.ts:14+sandbox/index.ts:20diff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdxindex 9153c3ab3..fead76b16 100644--- a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx+++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx@@ -7,6 +7,8 @@class Filesystem()```+Manager for interacting with the filesystem in the sandbox.+#### read@@ -17,7 +19,14 @@ async def read(path: str,request_timeout: Optional[float] = None)```-Read from file+Reads a whole file content and returns it in requested format (text by default).++:param path: Path to the file+:param format: Format of the file content+:param user: Run the operation as this user+:param request_timeout: Timeout for the request+:return File content in requested format+#### write@@ -29,11 +38,23 @@ async def write(path: str,request_timeout: Optional[float] = None) -> EntryInfo```-Write to file+Writes content to a file on the path.+When writing to a file that doesn't exist, the file will get created.When writing to a file that already exists, the file will get overwritten.When writing to a file that's in a directory that doesn't exist, you'll get an error.+**Arguments**:++- `path`: Path to the file+- `data`: Data to write to the file+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request++**Returns**:++Information about the written file+#### list@@ -43,7 +64,17 @@ async def list(path: str,request_timeout: Optional[float] = None) -> List[EntryInfo]```-List directory+Lists entries in a directory.++**Arguments**:++- `path`: Path to the directory+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request++**Returns**:++List of entries in the directory#### exists@@ -54,7 +85,12 @@ async def exists(path: str,request_timeout: Optional[float] = None) -> bool```-Check if file exists.+Checks if a file or a directory exists.++:param path: Path to a file or a directory+:param user Run the operation as this user+:param request_timeout Timeout for the request+#### remove@@ -65,7 +101,13 @@ async def remove(path: str,request_timeout: Optional[float] = None) -> None```-Remove file+Removes a file or a directory.++**Arguments**:++- `path`: Path to a file or a directory+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request#### rename@@ -77,7 +119,15 @@ async def rename(old_path: str,request_timeout: Optional[float] = None) -> EntryInfo```-Rename file+Renames a file or directory from one path to another.++:param old_path Path to the file or directory to move+:param new_path Path to move the file or directory to+:param user Run the operation as this user+:param request_timeout Timeout for the request++:return: Information about the renamed file or directory+#### make\_dir@@ -88,7 +138,17 @@ async def make_dir(path: str,request_timeout: Optional[float] = None) -> bool```-Create directory and all parent directories+Creates a new directory and all directories along the way if needed on the specified path.++**Arguments**:++- `path`: Path to a new directory. For example '/dirA/dirB' when creating 'dirB'.+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request++**Returns**:++True if the directory was created, False if the directory already exists#### watch@@ -99,72 +159,142 @@ async def watch(path: str,on_exit: Optional[OutputHandler[Exception]] = None,user: Username = "user",request_timeout: Optional[float] = None,- timeout: Optional[float] = 60)+ timeout: Optional[float] = 60) -> AsyncWatchHandle```-Watch directory for changes+Watches directory for filesystem events.+**Arguments**:+- `path`: Path to a directory that will be watched+- `on_event`: Callback that will be called on each event+- `on_exit`: Callback that will be called when the watch is closed+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request+- `timeout`: Timeout for the watch, after which the watch will be closed+**Returns**:+Watcher handle-## Process+## AsyncWatchHandle```python-class Process()+class AsyncWatchHandle()```+Class representing the watch operation. It provides method to stop the watch operation.-#### list++#### close```python-async def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]+async def close()```-List processes+Stop watching the directory.+-#### kill++## AsyncProcessHandle```python-async def kill(pid: int, request_timeout: Optional[float] = None) -> bool+class AsyncProcessHandle()```-Kill process+Class representing a process. It provides methods for waiting and killing the process.-#### send\_stdin+#### pid```python-async def send_stdin(pid: int,- data: str,- request_timeout: Optional[float] = None)+@property+def pid()```-Send stdin+Get the process ID.-#### run+#### stdout```python-async def run(cmd: str,- background: Union[bool, None] = None,- envs: Optional[Dict[str, str]] = None,- user: Username = "user",- cwd: Optional[str] = None,- on_stdout: Optional[OutputHandler[Stdout]] = None,- on_stderr: Optional[OutputHandler[Stderr]] = None,- timeout: Optional[float] = 60,- request_timeout: Optional[float] = None)+@property+def stdout()```-Run command+Stdout of the process.+++#### stderr+```python+@property+def stderr()+```++Stderr of the process.+#### error++```python+@property+def error()+```++Error message of the process. It is `None` if the process is still running.+++#### exit\_code++```python+@property+def exit_code()+```++Exit code of the process. It is `None` if the process is still running.+++#### disconnect++```python+async def disconnect() -> None+```++Disconnects from the process. It does not kill the process. It only stops receiving events from the process.+++#### wait++```python+async def wait() -> ProcessResult+```++Waits for the process to finish and returns the result.++If the process exits with a non-zero exit code, it throws a `ProcessExitException`.++**Returns**:++Process result+++#### kill++```python+async def kill() -> bool+```++Kills the process.++**Returns**:++Whether the process was killed successfully+@@ -174,6 +304,8 @@ Run commandclass Pty()```+Manager for starting and interacting with PTY (pseudo-terminal) processes in the sandbox.+#### kill@@ -181,7 +313,16 @@ class Pty()async def kill(pid: int, request_timeout: Optional[float] = None) -> bool```-Kill process by PID+Kills a process.++**Arguments**:++- `pid`: Process ID to kill. You can get the list of processes using `sandbox.commands.list()`.+- `request_timeout`: Timeout for the request++**Returns**:++`true` if the process was killed, `false` if the process was not found#### send\_stdin@@ -189,10 +330,16 @@ Kill process by PID```pythonasync def send_stdin(pid: int,data: bytes,- request_timeout: Optional[float] = None)+ request_timeout: Optional[float] = None) -> None```-Send data to process stdin+Sends input to a PTY process.++**Arguments**:++- `pid`: Process ID of the PTY process+- `data`: Input data to send+- `request_timeout`: Timeout for the request#### create@@ -208,7 +355,21 @@ async def create(request_timeout: Optional[float] = None) -> AsyncProcessHandle```-Create new PTY process+Starts a new process with a PTY (pseudo-terminal).++**Arguments**:++- `size`: Size of the PTY+- `on_data`: Callback for handling PTY output+- `user`: User to start the process as+- `cwd`: Current working directory+- `envs`: Environment variables+- `timeout`: Timeout for the request+- `request_timeout`: Timeout for the request++**Returns**:++New process#### resize@@ -219,7 +380,131 @@ async def resize(pid: int,request_timeout: Optional[float] = None)```-Resize PTY+Resizes a PTY process (changes the number of columns and rows in the terminal).++**Arguments**:++- `pid`: Process ID of the PTY process+- `size`: New size of the PTY+- `request_timeout`: Timeout for the request+++++## Process++```python+class Process()+```++Manager for starting and interacting with processes in the sandbox.+++#### list++```python+async def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]+```++Lists all running processes.++**Arguments**:++- `request_timeout`: Request timeout++**Returns**:++List of running processes+++#### kill++```python+async def kill(pid: int, request_timeout: Optional[float] = None) -> bool+```++Kills a process.++**Arguments**:++- `pid`: Process ID to connect to. You can get the list of processes using `sandbox.commands.list()`.+- `request_timeout`: Request timeout++**Returns**:++`True` if the process was killed, `False` if the process was not found+++#### send\_stdin++```python+async def send_stdin(pid: int,+ data: str,+ request_timeout: Optional[float] = None) -> None+```++Sends data to the stdin of a process.++:param pid Process ID to send data to. You can get the list of processes using `sandbox.commands.list()`.+:param data: Data to send to the process+:param request_timeout: Request timeout++++#### run++```python+async def run(cmd: str,+ background: Union[bool, None] = None,+ envs: Optional[Dict[str, str]] = None,+ user: Username = "user",+ cwd: Optional[str] = None,+ on_stdout: Optional[OutputHandler[Stdout]] = None,+ on_stderr: Optional[OutputHandler[Stderr]] = None,+ timeout: Optional[float] = 60,+ request_timeout: Optional[float] = None)+```++Starts a new process and depending on the `background` parameter, waits for the process to finish or not.++:param cmd Command to execute+:param background:+ If `True`, the function will return a `ProcessHandle` object that can be used to interact with the process.+ If `False`, the function will wait for the process to finish and return a `ProcessResult` object.+:param envs: Environment variables+:param user: User to run the process as+:param cwd: Working directory+:param on_stdout: Callback for stdout+:param on_stderr: Callback for stderr+:param timeout: Timeout for the maximum time the process is allowed to run+:param request_timeout: Timeout for the request+:return: `ProcessHandle` if `background` is `True`, `ProcessResult` if `background` is `False`++++#### connect++```python+async def connect(+ pid: int,+ timeout: Optional[float] = 60,+ request_timeout: Optional[float] = None,+ on_stdout: Optional[OutputHandler[Stdout]] = None,+ on_stderr: Optional[OutputHandler[Stderr]] = None+) -> AsyncProcessHandle+```++Connects to an existing process.++**Arguments**:++- `pid`: Process ID to connect to. You can get the list of processes using `sandbox.commands.list()`.+- `timeout`: Timeout for the connection+- `request_timeout`: Request timeout+- `on_stdout`: Callback for stdout+- `on_stderr`: Callback for stderr++@@ -232,6 +517,27 @@ Resize PTYclass AsyncSandbox(SandboxSetup, SandboxApi)```+E2B cloud sandbox gives your agent a full cloud development environment that's sandboxed.++That means:+- Access to Linux OS+- Using filesystem (create, list, and delete files and dirs)+- Run commands+- Sandboxed - you can run any code+- Access to the internet++Check usage docs - https://e2b.dev/docs/sandbox/overview++These cloud sandboxes are meant to be used for agents. Like a sandboxed playgrounds, where the agent can do whatever it wants.++Use the `AsyncSandbox.create()` to create a new sandbox.++**Example**:++```python+sandbox = await AsyncSandbox.create()+```+#### files@@ -240,7 +546,7 @@ class AsyncSandbox(SandboxSetup, SandboxApi)def files() -> Filesystem```-Get a Filesystem Object+Filesystem module for interacting with the sandbox's filesystem#### commands@@ -250,7 +556,17 @@ Get a Filesystem Objectdef commands() -> Process```-Get a Process Object+Commands module for interacting with the sandbox's processes+++#### pty++```python+@property+def pty() -> Pty+```++PTY module for interacting with the sandbox's pseudo-terminal.#### sandbox\_id@@ -270,7 +586,7 @@ Get the sandbox IDdef envd_api_url() -> str```-Get the sanbox API URL+Get the sandbox API URL#### connection\_config@@ -280,7 +596,7 @@ Get the sanbox API URLdef connection_config() -> ConnectionConfig```-Get the ConnectionConfig Object+Get the ConnectionConfig object#### \_\_init\_\_@@ -289,7 +605,7 @@ Get the ConnectionConfig Objectdef __init__(**opts: Unpack[AsyncSandboxOpts])```-Instantiate sandbox+Use `Sandbox.create()` instead.#### is\_running@@ -298,7 +614,40 @@ Instantiate sandboxasync def is_running(request_timeout: Optional[float] = None) -> bool```-Check if sandbox is running+Check if the sandbox is running.++**Returns**:++`True` if the sandbox is running, `False` otherwise+Example+```python+sandbox = await AsyncSandbox.create()+await sandbox.is_running() # Returns True++await sandbox.kill()+await sandbox.is_running() # Returns False+```+++#### create++```python+@classmethod+async def create(cls,+ template: Optional[str] = None,+ timeout: Optional[int] = None,+ metadata: Optional[Dict[str, str]] = None,+ envs: Optional[Dict[str, str]] = None,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None,+ request_timeout: Optional[float] = None)+```++Creates a new sandbox.++This method creates a new sandbox in the async version,+you have to use this method instead of using the constructor.#### connect@@ -312,7 +661,24 @@ async def connect(cls,debug: Optional[bool] = None)```-Connect to a running sandbox+Connects to an existing Sandbox.++**Arguments**:++- `sandbox_id`: Sandbox ID+- `api_key`: E2B API Key+- `domain`: E2B Domain (use only if you self-host E2B)+- `debug`: For developing purposes, uses a local sandbox++**Returns**:++Sandbox object+@example+```python+sandbox = await AsyncSandbox.create()+sandbox_id = sandbox.sandbox_id++same_sandbox = await AsyncSandbox.connect(sandbox_id)#### kill@@ -322,7 +688,15 @@ Connect to a running sandboxasync def kill(request_timeout: Optional[float] = None) -> bool```-Kill sandbox+Kill the sandbox.++**Arguments**:++- `request_timeout`: Timeout for the request++**Returns**:++`True` if the sandbox was killed, `False` if the sandbox was not found#### set\_timeout@@ -333,5 +707,13 @@ async def set_timeout(timeout: int,request_timeout: Optional[float] = None) -> None```-Configure request timeout+Set the sandbox's timeout, after which the sandbox will be automatically killed.++The sandbox can be kept alive for a maximum of 24 hours from the time of creation.+If you try to set the timeout to a period, which exceeds the maximum limit, the timeout will be set to the maximum limit.++**Arguments**:++- `timeout`: Duration in milliseconds. Must be between 0 and 86400000 milliseconds (24 hours).+- `request_timeout`: Timeout for the requestdiff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdxindex 3013adf1a..adbd73f7a 100644--- a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx+++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx@@ -7,6 +7,8 @@class Filesystem()```+Manager for interacting with the filesystem in the sandbox.+#### read@@ -17,7 +19,14 @@ def read(path: str,request_timeout: Optional[float] = None)```-Read from file+Reads a whole file content and returns it in requested format (text by default).++:param path: Path to the file+:param format: Format of the file content+:param user: Run the operation as this user+:param request_timeout: Timeout for the request+:return File content in requested format+#### write@@ -29,11 +38,23 @@ def write(path: str,request_timeout: Optional[float] = None) -> EntryInfo```-Write to file+Writes content to a file on the path.+When writing to a file that doesn't exist, the file will get created.When writing to a file that already exists, the file will get overwritten.When writing to a file that's in a directory that doesn't exist, you'll get an error.+**Arguments**:++- `path`: Path to the file+- `data`: Data to write to the file+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request++**Returns**:++Information about the written file+#### list@@ -43,7 +64,17 @@ def list(path: str,request_timeout: Optional[float] = None) -> List[EntryInfo]```-List directory+Lists entries in a directory.++**Arguments**:++- `path`: Path to the directory+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request++**Returns**:++List of entries in the directory#### exists@@ -54,7 +85,12 @@ def exists(path: str,request_timeout: Optional[float] = None) -> bool```-Check if file exists.+Checks if a file or a directory exists.++:param path: Path to a file or a directory+:param user Run the operation as this user+:param request_timeout Timeout for the request+#### remove@@ -65,7 +101,13 @@ def remove(path: str,request_timeout: Optional[float] = None) -> None```-Remove file+Removes a file or a directory.++**Arguments**:++- `path`: Path to a file or a directory+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request#### rename@@ -77,7 +119,15 @@ def rename(old_path: str,request_timeout: Optional[float] = None) -> EntryInfo```-Rename file+Renames a file or directory from one path to another.++:param old_path Path to the file or directory to move+:param new_path Path to move the file or directory to+:param user Run the operation as this user+:param request_timeout Timeout for the request++:return: Information about the renamed file or directory+#### make\_dir@@ -88,7 +138,17 @@ def make_dir(path: str,request_timeout: Optional[float] = None) -> bool```-Create directory and all parent directories+Creates a new directory and all directories along the way if needed on the specified path.++**Arguments**:++- `path`: Path to a new directory. For example '/dirA/dirB' when creating 'dirB'.+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request++**Returns**:++True if the directory was created, False if the directory already exists#### watch@@ -97,78 +157,114 @@ Create directory and all parent directoriesdef watch(path: str,user: Username = "user",request_timeout: Optional[float] = None,- timeout: Optional[float] = 60)+ timeout: Optional[float] = 60) -> WatchHandle```-Watch directory for changes.+Watches directory for filesystem events. The watch will be closed after the timeout.+To get the events, you need to iterate over the returned WatchHandle.+**Arguments**:+- `path`: Path to a directory that will be watched+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request+- `timeout`: Timeout for the watch, after which the watch will be closed+**Returns**:+Watcher handle-## Process++## WatchHandle```python-class Process()+class WatchHandle()```+Handle for watching filesystem events. It is used to iterate over the events in the watched directory.-#### list++#### close```python-def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]+def close()```-List processes+Stop watching the directory.+**Warnings**:-#### kill+ You won't get any event if you don't iterate over the handle before closing it.+++++## ProcessHandle```python-def kill(pid: int, request_timeout: Optional[float] = None) -> bool+class ProcessHandle()```-Kill process+Class representing a process. It provides methods for waiting and killing the process.+It is also used to iterate over the process output.-#### send\_stdin+#### pid```python-def send_stdin(pid: int, data: str, request_timeout: Optional[float] = None)+@property+def pid()```-Send stdin+Get the process ID.-#### run+#### disconnect```python-def run(cmd: str,- background: Union[bool, None] = None,- envs: Optional[Dict[str, str]] = None,- user: Username = "user",- cwd: Optional[str] = None,- on_stdout: Optional[Callable[[str], None]] = None,- on_stderr: Optional[Callable[[str], None]] = None,- timeout: Optional[float] = 60,- request_timeout: Optional[float] = None)+def disconnect() -> None```-Run command+Disconnect from the process. It does not kill the process. It only stops receiving events from the process.-#### connect+#### wait```python-def connect(pid: int,- timeout: Optional[float] = 60,- request_timeout: Optional[float] = None)+def wait(on_pty: Optional[Callable[[PtyOutput], None]] = None,+ on_stdout: Optional[Callable[[str], None]] = None,+ on_stderr: Optional[Callable[[str], None]] = None) -> ProcessResult```-Connect to process+Waits for the process to finish and returns the result.++If the process exits with a non-zero exit code, it throws a `ProcessExitException`.++**Arguments**:++- `on_pty`: Callback for pty output+- `on_stdout`: Callback for stdout output+- `on_stderr`: Callback for stderr output++**Returns**:++Process result+++#### kill++```python+def kill() -> bool+```++Kills the process.++**Returns**:++Whether the process was killed successfully@@ -179,6 +275,8 @@ Connect to processclass Pty()```+Manager for starting and interacting with PTY (pseudo-terminal) processes in the sandbox.+#### kill@@ -186,7 +284,16 @@ class Pty()def kill(pid: int, request_timeout: Optional[float] = None) -> bool```-Kill process by PID+Kills a process.++**Arguments**:++- `pid`: Process ID to kill. You can get the list of processes using `sandbox.commands.list()`.+- `request_timeout`: Timeout for the request++**Returns**:++`true` if the process was killed, `false` if the process was not found#### send\_stdin@@ -197,7 +304,13 @@ def send_stdin(pid: int,request_timeout: Optional[float] = None) -> None```-Send data to process stdin+Sends input to a PTY process.++**Arguments**:++- `pid`: Process ID of the PTY process+- `data`: Input data to send+- `request_timeout`: Timeout for the request#### create@@ -211,7 +324,20 @@ def create(size: PtySize,request_timeout: Optional[float] = None) -> ProcessHandle```-Create new PTY process+Starts a new process with a PTY (pseudo-terminal).++**Arguments**:++- `size`: Size of the PTY+- `user`: User to start the process as+- `cwd`: Current working directory+- `envs`: Environment variables+- `timeout`: Timeout for the request+- `request_timeout`: Timeout for the request++**Returns**:++New process#### resize@@ -222,7 +348,119 @@ def resize(pid: int,request_timeout: Optional[float] = None) -> None```-Resize PTY+Resizes a PTY process (changes the number of columns and rows in the terminal).++**Arguments**:++- `pid`: Process ID of the PTY process+- `size`: New size of the PTY+- `request_timeout`: Timeout for the request+++++## Process++```python+class Process()+```+++#### list++```python+def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]+```++Lists all running processes.++**Arguments**:++- `request_timeout`: Request timeout++**Returns**:++List of running processes+++#### kill++```python+def kill(pid: int, request_timeout: Optional[float] = None) -> bool+```++Kills a process.++**Arguments**:++- `pid`: Process ID to connect to. You can get the list of processes using `sandbox.commands.list()`.+- `request_timeout`: Request timeout++**Returns**:++`True` if the process was killed, `False` if the process was not found+++#### send\_stdin++```python+def send_stdin(pid: int, data: str, request_timeout: Optional[float] = None)+```++Sends data to the stdin of a process.++:param pid Process ID to send data to. You can get the list of processes using `sandbox.commands.list()`.+:param data: Data to send to the process+:param request_timeout: Request timeout++++#### run++```python+def run(cmd: str,+ background: Union[bool, None] = None,+ envs: Optional[Dict[str, str]] = None,+ user: Username = "user",+ cwd: Optional[str] = None,+ on_stdout: Optional[Callable[[str], None]] = None,+ on_stderr: Optional[Callable[[str], None]] = None,+ timeout: Optional[float] = 60,+ request_timeout: Optional[float] = None)+```++Starts a new process and depending on the `background` parameter, waits for the process to finish or not.++:param cmd Command to execute+:param background:+ If `True`, the function will return a `ProcessHandle` object that can be used to interact with the process.+ If `False`, the function will wait for the process to finish and return a `ProcessResult` object.+:param envs: Environment variables+:param user: User to run the process as+:param cwd: Working directory+:param on_stdout: Callback for stdout+:param on_stderr: Callback for stderr+:param timeout: Timeout for the maximum time the process is allowed to run+:param request_timeout: Timeout for the request+:return: `ProcessHandle` if `background` is `True`, `ProcessResult` if `background` is `False`++++#### connect++```python+def connect(pid: int,+ timeout: Optional[float] = 60,+ request_timeout: Optional[float] = None)+```++Connects to an existing process.++**Arguments**:++- `pid`: Process ID to connect to. You can get the list of processes using `sandbox.commands.list()`.+- `timeout`: Timeout for the connection+- `request_timeout`: Request timeout@@ -235,6 +473,27 @@ Resize PTYclass Sandbox(SandboxSetup, SandboxApi)```+E2B cloud sandbox gives your agent a full cloud development environment that's sandboxed.++That means:+- Access to Linux OS+- Using filesystem (create, list, and delete files and dirs)+- Run commands+- Sandboxed - you can run any code+- Access to the internet++Check usage docs - https://e2b.dev/docs/sandbox/overview++These cloud sandboxes are meant to be used for agents. Like a sandboxed playgrounds, where the agent can do whatever it wants.++Use the `Sandbox()` to create a new sandbox.++**Example**:++```python+sandbox = Sandbox()+```+#### files@@ -243,7 +502,7 @@ class Sandbox(SandboxSetup, SandboxApi)def files() -> Filesystem```-Get a Filesystem Object+Filesystem module for interacting with the sandbox's filesystem#### commands@@ -253,7 +512,17 @@ Get a Filesystem Objectdef commands() -> Process```-Get a Process Object+Commands module for interacting with the sandbox's processes+++#### pty++```python+@property+def pty() -> Pty+```++PTY module for interacting with the sandbox's pseudo-terminal#### sandbox\_id@@ -263,7 +532,7 @@ Get a Process Objectdef sandbox_id() -> str```-Get the sandbox ID+Unique identifier of the sandbox#### envd\_api\_url@@ -273,7 +542,7 @@ Get the sandbox IDdef envd_api_url() -> str```-Get the sanbox API URL+Get the sandbox API URL#### connection\_config@@ -283,7 +552,7 @@ Get the sanbox API URLdef connection_config() -> ConnectionConfig```-Get the ConnectionConfig Object+Get the ConnectionConfig object#### \_\_init\_\_@@ -309,7 +578,19 @@ Instantiate sandboxdef is_running(request_timeout: Optional[float] = None) -> bool```-Check if sandbox is running+Check if the sandbox is running.++**Returns**:++`True` if the sandbox is running, `False` otherwise+Example+```python+sandbox = Sandbox()+sandbox.is_running() # Returns True++sandbox.kill()+sandbox.is_running() # Returns False+```#### connect@@ -323,7 +604,24 @@ def connect(cls,debug: Optional[bool] = None)```-Connect to a running sandbox+Connects to an existing Sandbox.++**Arguments**:++- `sandbox_id`: Sandbox ID+- `api_key`: E2B API Key+- `domain`: E2B Domain (use only if you self-host E2B)+- `debug`: For developing purposes, uses a local sandbox++**Returns**:++Sandbox object+@example+```python+sandbox = Sandbox()+sandbox_id = sandbox.sandbox_id++same_sandbox = Sandbox.connect(sandbox_id)#### kill@@ -333,7 +631,15 @@ Connect to a running sandboxdef kill(request_timeout: Optional[float] = None) -> bool```-Kill sandbox+Kill the sandbox.++**Arguments**:++- `request_timeout`: Timeout for the request++**Returns**:++`True` if the sandbox was killed, `False` if the sandbox was not found#### set\_timeout@@ -343,5 +649,13 @@ Kill sandboxdef set_timeout(timeout: int, request_timeout: Optional[float] = None) -> None```-Configure sandbox timeout+Set the sandbox's timeout, after which the sandbox will be automatically killed.++The sandbox can be kept alive for a maximum of 24 hours from the time of creation.+If you try to set the timeout to a period, which exceeds the maximum limit, the timeout will be set to the maximum limit.++**Arguments**:++- `timeout`: Duration in milliseconds. Must be between 0 and 86400000 milliseconds (24 hours).+- `request_timeout`: Timeout for the request