Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
[skip ci] Release new versions
github-actions[bot]7d776cf1d70c
diff --git a/.changeset/fair-carrots-enjoy.md b/.changeset/fair-carrots-enjoy.mddeleted file mode 100644index 17dedb247..000000000--- a/.changeset/fair-carrots-enjoy.md+++ /dev/null@@ -1,5 +0,0 @@-----'@e2b/cli': patch------Increase the timeout when refreshing spawned sandboxdiff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/auth/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/auth/page.mdxnew file mode 100644index 000000000..5e547262c--- /dev/null+++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/auth/page.mdx@@ -0,0 +1,58 @@+# e2b auth+++authentication commands++## Usage++```bash+e2b auth [options] [command]+```+# e2b auth login+++log in to CLI++## Usage++```bash+e2b auth login [options]+```+++# e2b auth logout+++log out of CLI++## Usage++```bash+e2b auth logout [options]+```+++# e2b auth info+++get information about the current user++## Usage++```bash+e2b auth info [options]+```+++# e2b auth configure+++configure user++## Usage++```bash+e2b auth configure [options]+```++diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/sandbox/page.mdxnew file mode 100644index 000000000..fc8e99343--- /dev/null+++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/sandbox/page.mdx@@ -0,0 +1,89 @@+# e2b sandbox+++work with sandboxes++## Usage++```bash+e2b sandbox [options] [command]+```+# e2b sandbox connect+++connect terminal to already running sandbox++## Usage++```bash+e2b sandbox connect [options] <sandboxID>+```+++# e2b sandbox list+++list all running sandboxes++## Usage++```bash+e2b sandbox list [options]+```+++# e2b sandbox kill+++kill sandbox++## Usage++```bash+e2b sandbox kill [options] [sandboxID]+```++## Options+++ - `-a, --all: kill all running sandboxes `+++# e2b sandbox spawn+++spawn sandbox and connect terminal to it++## Usage++```bash+e2b sandbox spawn [options] [template]+```++## Options+++ - `-p, --path <path>: change root directory where command is executed to <path> directory `+ - `--config <e2b-toml>: specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. `+++# e2b sandbox logs+++show logs for sandbox++## Usage++```bash+e2b sandbox logs [options] <sandboxID>+```++## Options+++ - `--level <level>: filter logs by level (DEBUG, INFO, WARN, ERROR). The logs with the higher levels will be also shown. [default: INFO]`+ - `-f, --follow: keep streaming logs until the sandbox is closed `+ - `--format <format>: specify format for printing logs (json, pretty) [default: pretty]`+ - `--loggers [loggers]: filter logs by loggers. Specify multiple loggers by separating them with a comma. `++diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/template/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/template/page.mdxnew file mode 100644index 000000000..48d3dcb2e--- /dev/null+++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v1.0.5/template/page.mdx@@ -0,0 +1,90 @@+# e2b template+++manage sandbox templates++## Usage++```bash+e2b template [options] [command]+```+# e2b template build+++build sandbox template defined by ./e2b.Dockerfile or ./Dockerfile in root directory. By default the root directory is the current working directory. This command also creates e2b.toml config.++## Usage++```bash+e2b template build [options] [template]+```++## Options+++ - `-p, --path <path>: change root directory where command is executed to <path> directory `+ - `-d, --dockerfile <file>: specify path to Dockerfile. By default E2B tries to find e2b.Dockerfile or Dockerfile in root directory. `+ - `-n, --name <template-name>: specify sandbox template name. You can use the template name to start the sandbox with SDK. The template name must be lowercase and contain only letters, numbers, dashes and underscores. `+ - `-c, --cmd <start-command>: specify command that will be executed when the sandbox is started. `+ - `-t, --team <team-id>: specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). `+ - `--config <e2b-toml>: specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. `+ - `--cpu-count <cpu-count>: specify the number of CPUs that will be used to run the sandbox. The default value is 2. `+ - `--memory-mb <memory-mb>: specify the amount of memory in megabytes that will be used to run the sandbox. Must be an even number. The default value is 512. `+ - `--build-arg <args...>: specify additional build arguments for the build command. The format should be <varname>=<value>. `+++# e2b template list+++list sandbox templates++## Usage++```bash+e2b template list [options]+```++## Options+++ - `-t, --team <team-id>: specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). `+++# e2b template init+++create basic E2B Dockerfile (./e2b.Dockerfile) in root directory. You can then run e2b template build to build sandbox template from this Dockerfile++## Usage++```bash+e2b template init [options]+```++## Options+++ - `-p, --path <path>: change root directory where command is executed to <path> directory `+++# e2b template delete+++delete sandbox template and e2b.toml config++## Usage++```bash+e2b template delete [options] [template]+```++## Options+++ - `-p, --path <path>: change root directory where command is executed to <path> directory `+ - `--config <e2b-toml>: specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. `+ - `-s, --select: select sandbox template from interactive list `+ - `-t, --team <team-id>: specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). `+ - `-y, --yes: skip manual delete confirmation `++diff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v1.0.1/sandbox_async/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v1.0.1/sandbox_async/page.mdxindex fef236072..2583bcc1d 100644--- a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v1.0.1/sandbox_async/page.mdx+++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v1.0.1/sandbox_async/page.mdx@@ -1,924 +1,924 @@-## SandboxApi+## Commands```python-class SandboxApi(SandboxApiBase)+class Commands()```+Module for executing commands in the sandbox.+#### list```python-@classmethod-async def list(cls,- api_key: Optional[str] = None,- domain: Optional[str] = None,- debug: Optional[bool] = None,- request_timeout: Optional[float] = None) -> List[SandboxInfo]+async def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]```-List all running sandboxes.+Lists all running commands and PTY sessions.**Arguments**:-- `api_key`: API key to use for authentication, defaults to `E2B_API_KEY` environment variable- `request_timeout`: Timeout for the request in **seconds****Returns**:-List of running sandboxes----+List of running commands and PTY sessions-## AsyncSandbox+#### kill```python-class AsyncSandbox(SandboxSetup, SandboxApi)+async def kill(pid: int, request_timeout: Optional[float] = None) -> bool```-E2B cloud sandbox is a secure and isolated cloud environment.--The sandbox allows you to:-- Access Linux OS-- Create, list, and delete files and directories-- Run commands-- Run isolated code-- Access the internet+Kill a running command specified by its process ID.-Check docs [here](https://e2b.dev/docs).+It uses `SIGKILL` signal to kill the command.-Use the `AsyncSandbox.create()` to create a new sandbox.+**Arguments**:-**Example**:+- `pid`: Process ID of the command. You can get the list of processes using `sandbox.commands.list()`+- `request_timeout`: Timeout for the request in **seconds**-```python-from e2b import AsyncSandbox+**Returns**:-sandbox = await AsyncSandbox.create()-```+`True` if the command was killed, `False` if the command was not found-#### files+#### send\_stdin```python-@property-def files() -> Filesystem+async def send_stdin(pid: int,+ data: str,+ request_timeout: Optional[float] = None) -> None```-Module for interacting with the sandbox filesystem.+Send data to command stdin.++:param pid Process ID of the command. You can get the list of processes using `sandbox.commands.list()`.+:param data: Data to send to the command+:param request_timeout: Timeout for the request in **seconds**-#### commands++#### run```python-@property-def commands() -> Commands+@overload+async def run(cmd: str,+ background: Union[Literal[False], 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) -> CommandResult```-Module for running commands in the sandbox.+Start a new command and wait until it finishes executing.+**Arguments**:-#### pty+- `cmd`: Command to execute+- `background`: **`False` if the command should be executed in the foreground**, `True` if the command should be executed in the background+- `envs`: Environment variables used for the command+- `user`: User to run the command as+- `cwd`: Working directory to run the command+- `on_stdout`: Callback for command stdout output+- `on_stderr`: Callback for command stderr output+- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `request_timeout`: Timeout for the request in **seconds**-```python-@property-def pty() -> Pty-```+**Returns**:-Module for interacting with the sandbox pseudo-terminal.+`CommandResult` result of the command execution-#### sandbox\_id+#### run```python-@property-def sandbox_id() -> str+@overload+async def run(cmd: str,+ background: Literal[True],+ 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) -> AsyncCommandHandle```-Unique identifier of the sandbox.+Start a new command and return a handle to interact with it.+**Arguments**:-#### \_\_init\_\_+- `cmd`: Command to execute+- `background`: `False` if the command should be executed in the foreground, **`True` if the command should be executed in the background**+- `envs`: Environment variables used for the command+- `user`: User to run the command as+- `cwd`: Working directory to run the command+- `on_stdout`: Callback for command stdout output+- `on_stderr`: Callback for command stderr output+- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `request_timeout`: Timeout for the request in **seconds**-```python-def __init__(**opts: Unpack[AsyncSandboxOpts])-```+**Returns**:-Use `AsyncSandbox.create()` to create a new sandbox instead.+`AsyncCommandHandle` handle to interact with the running command-#### is\_running+#### connect```python-async def is_running(request_timeout: Optional[float] = None) -> bool+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+) -> AsyncCommandHandle```-Check if the sandbox is running.+Connects to a running command.++You can use `AsyncCommandHandle.wait()` to wait for the command to finish and get execution results.**Arguments**:-- `request_timeout`: Timeout for the request in **seconds**+- `pid`: Process ID of the command to connect to. You can get the list of processes using `sandbox.commands.list()`+- `request_timeout`: Request timeout in **seconds**+- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `on_stdout`: Callback for command stdout output+- `on_stderr`: Callback for command stderr output**Returns**:-`True` if the sandbox is running, `False` otherwise-Example-```python-sandbox = await AsyncSandbox.create()-await sandbox.is_running() # Returns True+`AsyncCommandHandle` handle to interact with the running command-await sandbox.kill()-await sandbox.is_running() # Returns False-```-#### create++## AsyncCommandHandle```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)+class AsyncCommandHandle()```-Create a new sandbox.+Command execution handle.-By default, the sandbox is created from the default `base` sandbox template.+It provides methods for waiting for the command to finish, retrieving stdout/stderr, and killing the command.-**Arguments**:-- `template`: Sandbox template name or ID-- `timeout`: Timeout for the sandbox in **seconds**, default to 300 seconds. Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.-- `metadata`: Custom metadata for the sandbox-- `envs`: Custom environment variables for the sandbox-- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable-- `request_timeout`: Timeout for the request in **seconds**+#### pid-**Returns**:+```python+@property+def pid()+```-sandbox instance for the new sandbox-Use this method instead of using the constructor to create a new sandbox.+Command process ID.-#### connect+#### stdout```python-@classmethod-async def connect(cls,- sandbox_id: str,- api_key: Optional[str] = None,- domain: Optional[str] = None,- debug: Optional[bool] = None)+@property+def stdout()```-Connect to an existing sandbox.--With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).--**Arguments**:+Command stdout output.-- `sandbox_id`: Sandbox ID-- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable-**Returns**:+#### stderr-sandbox instance for the existing sandbox-@example```python-sandbox = await AsyncSandbox.create()-sandbox_id = sandbox.sandbox_id+@property+def stderr()+```-same_sandbox = await AsyncSandbox.connect(sandbox_id)+Command stderr output.-#### kill+#### error```python-@overload-async def kill(request_timeout: Optional[float] = None) -> bool+@property+def error()```-Kill the sandbox.--**Arguments**:+Command execution error message.-- `request_timeout`: Timeout for the request in **seconds**-**Returns**:+#### exit\_code-`True` if the sandbox was killed, `False` if the sandbox was not found+```python+@property+def exit_code()+```+Command execution exit code.-#### kill+`0` if the command finished successfully.-```python-@overload-@staticmethod-async def kill(sandbox_id: str,- api_key: Optional[str] = None,- domain: Optional[str] = None,- debug: Optional[bool] = None,- request_timeout: Optional[float] = None) -> bool-```+It is `None` if the command is still running.-Kill the sandbox specified by sandbox ID.-**Arguments**:+#### disconnect-- `sandbox_id`: Sandbox ID-- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable-- `request_timeout`: Timeout for the request in **seconds**+```python+async def disconnect() -> None+```-**Returns**:+Disconnects from the command.-`True` if the sandbox was killed, `False` if the sandbox was not found+The command is not killed, but SDK stops receiving events from the command.+You can reconnect to the command using `sandbox.commands.connect` method.-#### set\_timeout+#### wait```python-@overload-async def set_timeout(timeout: int,- request_timeout: Optional[float] = None) -> None+async def wait() -> CommandResult```-Set the timeout of the sandbox.--After the timeout expires the sandbox will be automatically killed.-This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.set_timeout`.+Wait for the command to finish and return the result.-Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.+If the command exits with a non-zero exit code, it throws a `CommandExitException`.-**Arguments**:+**Returns**:-- `timeout`: Timeout for the sandbox in **seconds**-- `request_timeout`: Timeout for the request in **seconds**+`CommandResult` result of command execution-#### set\_timeout+#### kill```python-@overload-@staticmethod-async def set_timeout(sandbox_id: str,- timeout: int,- api_key: Optional[str] = None,- domain: Optional[str] = None,- debug: Optional[bool] = None,- request_timeout: Optional[float] = None) -> None+async def kill() -> bool```-Set the timeout of the specified sandbox.--After the timeout expires the sandbox will be automatically killed.-This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.set_timeout`.+Kills the command.-Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.+It uses `SIGKILL` signal to kill the command-**Arguments**:+**Returns**:-- `sandbox_id`: Sandbox ID-- `timeout`: Timeout for the sandbox in **seconds**-- `request_timeout`: Timeout for the request in **seconds**+`True` if the command was killed successfully, `False` if the command was not found-## AsyncWatchHandle+## Pty```python-class AsyncWatchHandle()+class Pty()```-Handle for watching a directory in the sandbox filesystem.--Use `.stop()` to stop watching the directory.+Module for interacting with PTYs (pseudo-terminals) in the sandbox.-#### stop+#### kill```python-async def stop()+async def kill(pid: int, request_timeout: Optional[float] = None) -> bool```-Stop watching the directory.+Kill PTY.++**Arguments**:+- `pid`: Process ID of the PTY+- `request_timeout`: Timeout for the request in **seconds**+**Returns**:+`true` if the PTY was killed, `false` if the PTY was not found-## Filesystem++#### send\_stdin```python-class Filesystem()+async def send_stdin(pid: int,+ data: bytes,+ request_timeout: Optional[float] = None) -> None```-Module for interacting with the filesystem in the sandbox.+Send input to a PTY.+**Arguments**:++- `pid`: Process ID of the PTY+- `data`: Input data to send+- `request_timeout`: Timeout for the request in **seconds**-#### read++#### create```python-@overload-async def read(path: str,- format: Literal["text"] = "text",- user: Username = "user",- request_timeout: Optional[float] = None) -> str+async def create(+ size: PtySize,+ on_data: OutputHandler[PtyOutput],+ user: Username = "user",+ cwd: Optional[str] = None,+ envs: Optional[Dict[str, str]] = None,+ timeout: Optional[float] = 60,+ request_timeout: Optional[float] = None) -> AsyncCommandHandle```-Read file content as a `str`.+Start a new PTY (pseudo-terminal).**Arguments**:-- `path`: Path to the file-- `user`: Run the operation as this user-- `format`: Format of the file content—`text` by default+- `size`: Size of the PTY+- `on_data`: Callback to handle PTY data+- `user`: User to use for the PTY+- `cwd`: Working directory for the PTY+- `envs`: Environment variables for the PTY+- `timeout`: Timeout for the PTY in **seconds**- `request_timeout`: Timeout for the request in **seconds****Returns**:-File content as a `str`+Handle to interact with the PTY-#### read+#### resize```python-@overload-async def read(path: str,- format: Literal["bytes"],- user: Username = "user",- request_timeout: Optional[float] = None) -> bytearray+async def resize(pid: int,+ size: PtySize,+ request_timeout: Optional[float] = None)```-Read file content as a `bytearray`.+Resize PTY.++Call this when the terminal window is resized and the number of columns and rows has changed.**Arguments**:-- `path`: Path to the file-- `user`: Run the operation as this user-- `format`: Format of the file content—`bytes`+- `pid`: Process ID of the PTY+- `size`: New size of the PTY- `request_timeout`: Timeout for the request in **seconds**-**Returns**:-File content as a `bytearray`-#### read+++## SandboxApi```python-@overload-async def read(- path: str,- format: Literal["stream"],- user: Username = "user",- request_timeout: Optional[float] = None) -> AsyncIterator[bytes]+class SandboxApi(SandboxApiBase)```-Read file content as a `AsyncIterator[bytes]`.++#### list++```python+@classmethod+async def list(cls,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None,+ request_timeout: Optional[float] = None) -> List[SandboxInfo]+```++List all running sandboxes.**Arguments**:-- `path`: Path to the file-- `user`: Run the operation as this user-- `format`: Format of the file content—`stream`+- `api_key`: API key to use for authentication, defaults to `E2B_API_KEY` environment variable- `request_timeout`: Timeout for the request in **seconds****Returns**:-File content as an `AsyncIterator[bytes]`+List of running sandboxes-#### write+++## AsyncSandbox```python-async def write(path: str,- data: Union[str, bytes, IO],- user: Username = "user",- request_timeout: Optional[float] = None) -> EntryInfo+class AsyncSandbox(SandboxSetup, SandboxApi)```-Write content to a file on the path.--Writing to a file that doesn't exist creates the file.+E2B cloud sandbox is a secure and isolated cloud environment.-Writing to a file that already exists overwrites the file.+The sandbox allows you to:+- Access Linux OS+- Create, list, and delete files and directories+- Run commands+- Run isolated code+- Access the internet-Writing to a file at path that doesn't exist creates the necessary directories.+Check docs [here](https://e2b.dev/docs).-**Arguments**:+Use the `AsyncSandbox.create()` to create a new sandbox.-- `path`: Path to the file-- `data`: Data to write to the file, can be a `str`, `bytes`, or `IO`.-- `user`: Run the operation as this user-- `request_timeout`: Timeout for the request in **seconds**+**Example**:-**Returns**:+```python+from e2b import AsyncSandbox-Information about the written file+sandbox = await AsyncSandbox.create()+```-#### list+#### files```python-async def list(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> List[EntryInfo]+@property+def files() -> Filesystem```-List entries in a directory.+Module for interacting with the sandbox filesystem.-**Arguments**:-- `path`: Path to the directory-- `user`: Run the operation as this user-- `request_timeout`: Timeout for the request in **seconds**+#### commands-**Returns**:+```python+@property+def commands() -> Commands+```-List of entries in the directory+Module for running commands in the sandbox.-#### exists+#### pty```python-async def exists(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> bool+@property+def pty() -> Pty```-Check if a file or a directory exists.+Module for interacting with the sandbox pseudo-terminal.-**Arguments**:-- `path`: Path to a file or a directory-- `user`: Run the operation as this user-- `request_timeout`: Timeout for the request in **seconds**+#### sandbox\_id-**Returns**:+```python+@property+def sandbox_id() -> str+```-`True` if the file or directory exists, `False` otherwise+Unique identifier of the sandbox.-#### remove+#### \_\_init\_\_```python-async def remove(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> None+def __init__(**opts: Unpack[AsyncSandboxOpts])```-Remove 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 in **seconds**+Use `AsyncSandbox.create()` to create a new sandbox instead.-#### rename+#### is\_running```python-async def rename(old_path: str,- new_path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> EntryInfo+async def is_running(request_timeout: Optional[float] = None) -> bool```-Rename a file or directory.+Check if the sandbox is running.**Arguments**:-- `old_path`: Path to the file or directory to rename-- `new_path`: New path to the file or directory-- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds****Returns**:-Information about the renamed file or directory+`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+```-#### make\_dir+#### create```python-async def make_dir(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> bool+@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)```-Create a new directory and all directories along the way if needed on the specified path.+Create a new sandbox.++By default, the sandbox is created from the default `base` sandbox template.**Arguments**:-- `path`: Path to a new directory. For example '/dirA/dirB' when creating 'dirB'.-- `user`: Run the operation as this user+- `template`: Sandbox template name or ID+- `timeout`: Timeout for the sandbox in **seconds**, default to 300 seconds. Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.+- `metadata`: Custom metadata for the sandbox+- `envs`: Custom environment variables for the sandbox+- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable- `request_timeout`: Timeout for the request in **seconds****Returns**:-`True` if the directory was created, `False` if the directory already exists+sandbox instance for the new sandbox+Use this method instead of using the constructor to create a new sandbox.-#### watch\_dir+#### connect```python-async def watch_dir(path: str,- on_event: OutputHandler[FilesystemEvent],- on_exit: Optional[OutputHandler[Exception]] = None,- user: Username = "user",- request_timeout: Optional[float] = None,- timeout: Optional[float] = 60) -> AsyncWatchHandle+@classmethod+async def connect(cls,+ sandbox_id: str,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None)```-Watch directory for filesystem events.+Connect to an existing sandbox.++With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).**Arguments**:-- `path`: Path to a directory to watch-- `on_event`: Callback to call on each event in the directory-- `on_exit`: Callback to call when the watching ends-- `user`: Run the operation as this user-- `request_timeout`: Timeout for the request in **seconds**-- `timeout`: Timeout for the watch operation in **seconds**. Using `0` will not limit the watch time+- `sandbox_id`: Sandbox ID+- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable**Returns**:-`AsyncWatchHandle` object for stopping watching directory-+sandbox instance for the existing sandbox+@example+```python+sandbox = await AsyncSandbox.create()+sandbox_id = sandbox.sandbox_id+same_sandbox = await AsyncSandbox.connect(sandbox_id)-## Pty+#### kill```python-class Pty()+@overload+async def kill(request_timeout: Optional[float] = None) -> bool```-Module for interacting with PTYs (pseudo-terminals) in the sandbox.+Kill the sandbox.++**Arguments**:++- `request_timeout`: Timeout for the request in **seconds**++**Returns**:++`True` if the sandbox was killed, `False` if the sandbox was not found#### kill```python-async def kill(pid: int, request_timeout: Optional[float] = None) -> bool+@overload+@staticmethod+async def kill(sandbox_id: str,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None,+ request_timeout: Optional[float] = None) -> bool```-Kill PTY.+Kill the sandbox specified by sandbox ID.**Arguments**:-- `pid`: Process ID of the PTY+- `sandbox_id`: Sandbox ID+- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable- `request_timeout`: Timeout for the request in **seconds****Returns**:-`true` if the PTY was killed, `false` if the PTY was not found+`True` if the sandbox was killed, `False` if the sandbox was not found-#### send\_stdin+#### set\_timeout```python-async def send_stdin(pid: int,- data: bytes,- request_timeout: Optional[float] = None) -> None+@overload+async def set_timeout(timeout: int,+ request_timeout: Optional[float] = None) -> None```-Send input to a PTY.+Set the timeout of the sandbox.++After the timeout expires the sandbox will be automatically killed.+This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.set_timeout`.++Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.**Arguments**:-- `pid`: Process ID of the PTY-- `data`: Input data to send+- `timeout`: Timeout for the sandbox in **seconds**- `request_timeout`: Timeout for the request in **seconds**-#### create+#### set\_timeout```python-async def create(- size: PtySize,- on_data: OutputHandler[PtyOutput],- user: Username = "user",- cwd: Optional[str] = None,- envs: Optional[Dict[str, str]] = None,- timeout: Optional[float] = 60,- request_timeout: Optional[float] = None) -> AsyncCommandHandle+@overload+@staticmethod+async def set_timeout(sandbox_id: str,+ timeout: int,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None,+ request_timeout: Optional[float] = None) -> None```-Start a new PTY (pseudo-terminal).+Set the timeout of the specified sandbox.++After the timeout expires the sandbox will be automatically killed.+This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.set_timeout`.++Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.**Arguments**:-- `size`: Size of the PTY-- `on_data`: Callback to handle PTY data-- `user`: User to use for the PTY-- `cwd`: Working directory for the PTY-- `envs`: Environment variables for the PTY-- `timeout`: Timeout for the PTY in **seconds**+- `sandbox_id`: Sandbox ID+- `timeout`: Timeout for the sandbox in **seconds**- `request_timeout`: Timeout for the request in **seconds**-**Returns**:-Handle to interact with the PTY-#### resize+## Filesystem```python-async def resize(pid: int,- size: PtySize,- request_timeout: Optional[float] = None)+class Filesystem()```-Resize PTY.--Call this when the terminal window is resized and the number of columns and rows has changed.--**Arguments**:+Module for interacting with the filesystem in the sandbox.-- `pid`: Process ID of the PTY-- `size`: New size of the PTY-- `request_timeout`: Timeout for the request in **seconds**+#### read+```python+@overload+async def read(path: str,+ format: Literal["text"] = "text",+ user: Username = "user",+ request_timeout: Optional[float] = None) -> str+```+Read file content as a `str`.-## Commands+**Arguments**:-```python-class Commands()-```+- `path`: Path to the file+- `user`: Run the operation as this user+- `format`: Format of the file content—`text` by default+- `request_timeout`: Timeout for the request in **seconds**-Module for executing commands in the sandbox.+**Returns**:++File content as a `str`-#### list+#### read```python-async def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]+@overload+async def read(path: str,+ format: Literal["bytes"],+ user: Username = "user",+ request_timeout: Optional[float] = None) -> bytearray```-Lists all running commands and PTY sessions.+Read file content as a `bytearray`.**Arguments**:+- `path`: Path to the file+- `user`: Run the operation as this user+- `format`: Format of the file content—`bytes`- `request_timeout`: Timeout for the request in **seconds****Returns**:-List of running commands and PTY sessions+File content as a `bytearray`-#### kill+#### read```python-async def kill(pid: int, request_timeout: Optional[float] = None) -> bool+@overload+async def read(+ path: str,+ format: Literal["stream"],+ user: Username = "user",+ request_timeout: Optional[float] = None) -> AsyncIterator[bytes]```-Kill a running command specified by its process ID.--It uses `SIGKILL` signal to kill the command.+Read file content as a `AsyncIterator[bytes]`.**Arguments**:-- `pid`: Process ID of the command. You can get the list of processes using `sandbox.commands.list()`+- `path`: Path to the file+- `user`: Run the operation as this user+- `format`: Format of the file content—`stream`- `request_timeout`: Timeout for the request in **seconds****Returns**:-`True` if the command was killed, `False` if the command was not found+File content as an `AsyncIterator[bytes]`-#### send\_stdin+#### write```python-async def send_stdin(pid: int,- data: str,- request_timeout: Optional[float] = None) -> None+async def write(path: str,+ data: Union[str, bytes, IO],+ user: Username = "user",+ request_timeout: Optional[float] = None) -> EntryInfo```-Send data to command stdin.--:param pid Process ID of the command. You can get the list of processes using `sandbox.commands.list()`.-:param data: Data to send to the command-:param request_timeout: Timeout for the request in **seconds**--+Write content to a file on the path.-#### run+Writing to a file that doesn't exist creates the file.-```python-@overload-async def run(cmd: str,- background: Union[Literal[False], 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) -> CommandResult-```+Writing to a file that already exists overwrites the file.-Start a new command and wait until it finishes executing.+Writing to a file at path that doesn't exist creates the necessary directories.**Arguments**:-- `cmd`: Command to execute-- `background`: **`False` if the command should be executed in the foreground**, `True` if the command should be executed in the background-- `envs`: Environment variables used for the command-- `user`: User to run the command as-- `cwd`: Working directory to run the command-- `on_stdout`: Callback for command stdout output-- `on_stderr`: Callback for command stderr output-- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `path`: Path to the file+- `data`: Data to write to the file, can be a `str`, `bytes`, or `IO`.+- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds****Returns**:-`CommandResult` result of the command execution+Information about the written file-#### run+#### list```python-@overload-async def run(cmd: str,- background: Literal[True],- 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) -> AsyncCommandHandle+async def list(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> List[EntryInfo]```-Start a new command and return a handle to interact with it.+List entries in a directory.**Arguments**:-- `cmd`: Command to execute-- `background`: `False` if the command should be executed in the foreground, **`True` if the command should be executed in the background**-- `envs`: Environment variables used for the command-- `user`: User to run the command as-- `cwd`: Working directory to run the command-- `on_stdout`: Callback for command stdout output-- `on_stderr`: Callback for command stderr output-- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `path`: Path to the directory+- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds****Returns**:-`AsyncCommandHandle` handle to interact with the running command+List of entries in the directory-#### connect+#### exists```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-) -> AsyncCommandHandle+async def exists(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> bool```-Connects to a running command.--You can use `AsyncCommandHandle.wait()` to wait for the command to finish and get execution results.+Check if a file or a directory exists.**Arguments**:-- `pid`: Process ID of the command to connect to. You can get the list of processes using `sandbox.commands.list()`-- `request_timeout`: Request timeout in **seconds**-- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time-- `on_stdout`: Callback for command stdout output-- `on_stderr`: Callback for command stderr output+- `path`: Path to a file or a directory+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request in **seconds****Returns**:-`AsyncCommandHandle` handle to interact with the running command--+`True` if the file or directory exists, `False` otherwise-## AsyncCommandHandle+#### remove```python-class AsyncCommandHandle()+async def remove(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> None```-Command execution handle.+Remove a file or a directory.-It provides methods for waiting for the command to finish, retrieving stdout/stderr, and killing the command.+**Arguments**:++- `path`: Path to a file or a directory+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request in **seconds**-#### pid+#### rename```python-@property-def pid()+async def rename(old_path: str,+ new_path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> EntryInfo```-Command process ID.+Rename a file or directory.+**Arguments**:-#### stdout+- `old_path`: Path to the file or directory to rename+- `new_path`: New path to the file or directory+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request in **seconds**-```python-@property-def stdout()-```+**Returns**:-Command stdout output.+Information about the renamed file or directory-#### stderr+#### make\_dir```python-@property-def stderr()+async def make_dir(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> bool```-Command stderr output.+Create a new directory and all directories along the way if needed on the specified path.+**Arguments**:-#### error+- `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 in **seconds**-```python-@property-def error()-```+**Returns**:-Command execution error message.+`True` if the directory was created, `False` if the directory already exists-#### exit\_code+#### watch\_dir```python-@property-def exit_code()+async def watch_dir(path: str,+ on_event: OutputHandler[FilesystemEvent],+ on_exit: Optional[OutputHandler[Exception]] = None,+ user: Username = "user",+ request_timeout: Optional[float] = None,+ timeout: Optional[float] = 60) -> AsyncWatchHandle```-Command execution exit code.--`0` if the command finished successfully.+Watch directory for filesystem events.-It is `None` if the command is still running.+**Arguments**:+- `path`: Path to a directory to watch+- `on_event`: Callback to call on each event in the directory+- `on_exit`: Callback to call when the watching ends+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request in **seconds**+- `timeout`: Timeout for the watch operation in **seconds**. Using `0` will not limit the watch time-#### disconnect+**Returns**:-```python-async def disconnect() -> None-```+`AsyncWatchHandle` object for stopping watching directory-Disconnects from the command.-The command is not killed, but SDK stops receiving events from the command.-You can reconnect to the command using `sandbox.commands.connect` method.-#### wait+## AsyncWatchHandle```python-async def wait() -> CommandResult+class AsyncWatchHandle()```-Wait for the command to finish and return the result.--If the command exits with a non-zero exit code, it throws a `CommandExitException`.--**Returns**:+Handle for watching a directory in the sandbox filesystem.-`CommandResult` result of command execution+Use `.stop()` to stop watching the directory.-#### kill+#### stop```python-async def kill() -> bool+async def stop()```-Kills the command.--It uses `SIGKILL` signal to kill the command--**Returns**:--`True` if the command was killed successfully, `False` if the command was not found+Stop watching the directory.diff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v1.0.1/sandbox_sync/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v1.0.1/sandbox_sync/page.mdxindex 12fdd0b3b..1e39bf353 100644--- a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v1.0.1/sandbox_sync/page.mdx+++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v1.0.1/sandbox_sync/page.mdx@@ -1,901 +1,901 @@-## SandboxApi+## Commands```python-class SandboxApi(SandboxApiBase)+class Commands()```+Module for executing commands in the sandbox.+#### list```python-@classmethod-def list(cls,- api_key: Optional[str] = None,- domain: Optional[str] = None,- debug: Optional[bool] = None,- request_timeout: Optional[float] = None) -> List[SandboxInfo]+def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]```-List all running sandboxes.+Lists all running commands and PTY sessions.**Arguments**:-- `api_key`: API key to use for authentication, defaults to `E2B_API_KEY` environment variable- `request_timeout`: Timeout for the request in **seconds****Returns**:-List of sandbox info--+List of running commands and PTY sessions-## Sandbox+#### kill```python-class Sandbox(SandboxSetup, SandboxApi)+def kill(pid: int, request_timeout: Optional[float] = None) -> bool```-E2B cloud sandbox is a secure and isolated cloud environment.--The sandbox allows you to:-- Access Linux OS-- Create, list, and delete files and directories-- Run commands-- Run isolated code-- Access the internet+Kills a running command specified by its process ID.-Check docs [here](https://e2b.dev/docs).+It uses `SIGKILL` signal to kill the command.-Use the `Sandbox()` to create a new sandbox.+**Arguments**:-**Example**:+- `pid`: Process ID of the command. You can get the list of processes using `sandbox.commands.list()`+- `request_timeout`: Timeout for the request in **seconds**-```python-from e2b import Sandbox+**Returns**:-sandbox = Sandbox()-```+`True` if the command was killed, `False` if the command was not found-#### files+#### send\_stdin```python-@property-def files() -> Filesystem+def send_stdin(pid: int, data: str, request_timeout: Optional[float] = None)```-Module for interacting with the sandbox filesystem.+Send data to command stdin.+:param pid Process ID of the command. You can get the list of processes using `sandbox.commands.list()`.+:param data: Data to send to the command+:param request_timeout: Timeout for the request in **seconds**-#### commands+++#### run```python-@property-def commands() -> Commands+@overload+def run(cmd: str,+ background: Union[Literal[False], 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) -> CommandResult```-Module for running commands in the sandbox.+Start a new command and wait until it finishes executing.+**Arguments**:-#### pty+- `cmd`: Command to execute+- `background`: **`False` if the command should be executed in the foreground**, `True` if the command should be executed in the background+- `envs`: Environment variables used for the command+- `user`: User to run the command as+- `cwd`: Working directory to run the command+- `on_stdout`: Callback for command stdout output+- `on_stderr`: Callback for command stderr output+- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `request_timeout`: Timeout for the request in **seconds**-```python-@property-def pty() -> Pty-```+**Returns**:-Module for interacting with the sandbox pseudo-terminal.+`CommandResult` result of the command execution-#### sandbox\_id+#### run```python-@property-def sandbox_id() -> str+@overload+def run(cmd: str,+ background: Literal[True],+ envs: Optional[Dict[str, str]] = None,+ user: Username = "user",+ cwd: Optional[str] = None,+ on_stdout: None = None,+ on_stderr: None = None,+ timeout: Optional[float] = 60,+ request_timeout: Optional[float] = None) -> CommandHandle```-Unique identifier of the sandbox+Start a new command and return a handle to interact with it.+**Arguments**:-#### \_\_init\_\_+- `cmd`: Command to execute+- `background`: `False` if the command should be executed in the foreground, **`True` if the command should be executed in the background**+- `envs`: Environment variables used for the command+- `user`: User to run the command as+- `cwd`: Working directory to run the command+- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `request_timeout`: Timeout for the request in **seconds**++**Returns**:++`CommandHandle` handle to interact with the running command+++#### connect```python-def __init__(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,- sandbox_id: Optional[str] = None,- request_timeout: Optional[float] = None)+def connect(pid: int,+ timeout: Optional[float] = 60,+ request_timeout: Optional[float] = None)```-Create a new sandbox.+Connects to a running command.-By default, the sandbox is created from the default `base` sandbox template.+You can use `CommandHandle.wait()` to wait for the command to finish and get execution results.**Arguments**:-- `template`: Sandbox template name or ID-- `timeout`: Timeout for the sandbox in **seconds**, default to 300 seconds. Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users-- `metadata`: Custom metadata for the sandbox-- `envs`: Custom environment variables for the sandbox-- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable+- `pid`: Process ID of the command to connect to. You can get the list of processes using `sandbox.commands.list()`+- `timeout`: Timeout for the connection in **seconds**. Using `0` will not limit the connection time- `request_timeout`: Timeout for the request in **seconds****Returns**:-sandbox instance for the new sandbox+`CommandHandle` handle to interact with the running command-#### is\_running+++## CommandHandle```python-def is_running(request_timeout: Optional[float] = None) -> bool+class CommandHandle()```-Check if the sandbox is running.+Command execution handle.-**Arguments**:+It provides methods for waiting for the command to finish, retrieving stdout/stderr, and killing the command.-- `request_timeout`: Timeout for the request in **seconds**-**Returns**:+#### pid-`True` if the sandbox is running, `False` otherwise-Example```python-sandbox = Sandbox()-sandbox.is_running() # Returns True--sandbox.kill()-sandbox.is_running() # Returns False+@property+def pid()```+Command process ID.+-#### connect+#### \_\_iter\_\_```python-@classmethod-def connect(cls,- sandbox_id: str,- api_key: Optional[str] = None,- domain: Optional[str] = None,- debug: Optional[bool] = None)+def __iter__()```-Connects to an existing Sandbox.+Iterate over the command output.-With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).+**Returns**:-**Arguments**:+Generator of command outputs-- `sandbox_id`: Sandbox ID-- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable-**Returns**:+#### disconnect-sandbox instance for the existing sandbox-@example```python-sandbox = Sandbox()-sandbox_id = sandbox.sandbox_id+def disconnect() -> None+```-same_sandbox = Sandbox.connect(sandbox_id)+Disconnect from the command.+The command is not killed, but SDK stops receiving events from the command.+You can reconnect to the command using `sandbox.commands.connect` method.-#### kill++#### wait```python-@overload-def kill(request_timeout: Optional[float] = None) -> bool+def wait(on_pty: Optional[Callable[[PtyOutput], None]] = None,+ on_stdout: Optional[Callable[[str], None]] = None,+ on_stderr: Optional[Callable[[str], None]] = None) -> CommandResult```-Kill the sandbox.+Wait for the command to finish and returns the result.++If the command exits with a non-zero exit code, it throws a `CommandExitException`.**Arguments**:-- `request_timeout`: Timeout for the request in **seconds**+- `on_pty`: Callback for pty output+- `on_stdout`: Callback for stdout output+- `on_stderr`: Callback for stderr output**Returns**:-`True` if the sandbox was killed, `False` if the sandbox was not found+`CommandResult` result of command execution#### kill```python-@overload-@staticmethod-def kill(sandbox_id: str,- api_key: Optional[str] = None,- domain: Optional[str] = None,- debug: Optional[bool] = None,- request_timeout: Optional[float] = None) -> bool+def kill() -> bool```-Kill the sandbox specified by sandbox ID.--**Arguments**:+Kills the command.-- `sandbox_id`: Sandbox ID-- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable-- `request_timeout`: Timeout for the request in **seconds**+It uses `SIGKILL` signal to kill the command.**Returns**:-`True` if the sandbox was killed, `False` if the sandbox was not found+Whether the command was killed successfully+++++## Pty++```python+class Pty()+```++Module for interacting with PTYs (pseudo-terminals) in the sandbox.#### kill```python-@class_method_variant("_cls_kill")-def kill(request_timeout: Optional[float] = None) -> bool+def kill(pid: int, request_timeout: Optional[float] = None) -> bool```-Kill the sandbox.+Kill PTY.**Arguments**:-- `request_timeout`: Timeout for the request+- `pid`: Process ID of the PTY+- `request_timeout`: Timeout for the request in **seconds****Returns**:-`True` if the sandbox was killed, `False` if the sandbox was not found+`true` if the PTY was killed, `false` if the PTY was not found-#### set\_timeout+#### send\_stdin```python-@overload-def set_timeout(timeout: int, request_timeout: Optional[float] = None) -> None+def send_stdin(pid: int,+ data: bytes,+ request_timeout: Optional[float] = None) -> None```-Set the timeout of the sandbox.--After the timeout expires the sandbox will be automatically killed.-This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.set_timeout`.--Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.+Send input to a PTY.**Arguments**:-- `timeout`: Timeout for the sandbox in **seconds**+- `pid`: Process ID of the PTY+- `data`: Input data to send- `request_timeout`: Timeout for the request in **seconds**-#### set\_timeout+#### create```python-@overload-@staticmethod-def set_timeout(sandbox_id: str,- timeout: int,- api_key: Optional[str] = None,- domain: Optional[str] = None,- debug: Optional[bool] = None,- request_timeout: Optional[float] = None) -> None+def create(size: PtySize,+ user: Username = "user",+ cwd: Optional[str] = None,+ envs: Optional[Dict[str, str]] = None,+ timeout: Optional[float] = 60,+ request_timeout: Optional[float] = None) -> CommandHandle```-Set the timeout of the sandbox specified by sandbox ID.--After the timeout expires the sandbox will be automatically killed.-This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.set_timeout`.--Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.+Start a new PTY (pseudo-terminal).**Arguments**:-- `sandbox_id`: Sandbox ID-- `timeout`: Timeout for the sandbox in **seconds**-- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable+- `size`: Size of the PTY+- `user`: User to use for the PTY+- `cwd`: Working directory for the PTY+- `envs`: Environment variables for the PTY+- `timeout`: Timeout for the PTY in **seconds**- `request_timeout`: Timeout for the request in **seconds**+**Returns**:+Handle to interact with the PTY-## WatchHandle+#### resize```python-class WatchHandle()+def resize(pid: int,+ size: PtySize,+ request_timeout: Optional[float] = None) -> None```-Handle for watching filesystem events.-It is used to get the latest events that have occurred in the watched directory.+Resize PTY.-Use `.stop()` to stop watching the directory.+Call this when the terminal window is resized and the number of columns and rows has changed.+**Arguments**:-#### stop+- `pid`: Process ID of the PTY+- `size`: New size of the PTY+- `request_timeout`: Timeout for the request in **seconds**s-```python-def stop()-```-Stop watching the directory.-After you stop the watcher you won't be able to get the events anymore.-#### get\_new\_events+## SandboxApi```python-def get_new_events() -> List[FilesystemEvent]+class SandboxApi(SandboxApiBase)```-Get the latest events that have occurred in the watched directory since the last call, or from the beginning of the watching, up until now.-**Returns**:+#### list-List of filesystem events+```python+@classmethod+def list(cls,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None,+ request_timeout: Optional[float] = None) -> List[SandboxInfo]+```+List all running sandboxes.+**Arguments**:+- `api_key`: API key to use for authentication, defaults to `E2B_API_KEY` environment variable+- `request_timeout`: Timeout for the request in **seconds**-## Filesystem+**Returns**:-```python-class Filesystem()-```+List of sandbox info-Module for interacting with the filesystem in the sandbox.-#### read++## Sandbox```python-@overload-def read(path: str,- format: Literal["text"] = "text",- user: Username = "user",- request_timeout: Optional[float] = None) -> str+class Sandbox(SandboxSetup, SandboxApi)```-Read file content as a `str`.+E2B cloud sandbox is a secure and isolated cloud environment.-**Arguments**:+The sandbox allows you to:+- Access Linux OS+- Create, list, and delete files and directories+- Run commands+- Run isolated code+- Access the internet-- `path`: Path to the file-- `user`: Run the operation as this user-- `format`: Format of the file content—`text` by default-- `request_timeout`: Timeout for the request in **seconds**+Check docs [here](https://e2b.dev/docs).-**Returns**:+Use the `Sandbox()` to create a new sandbox.-File content as a `str`+**Example**:++```python+from e2b import Sandbox+sandbox = Sandbox()+```-#### read-```python-@overload-def read(path: str,- format: Literal["bytes"],- user: Username = "user",- request_timeout: Optional[float] = None) -> bytearray+#### files++```python+@property+def files() -> Filesystem```-Read file content as a `bytearray`.+Module for interacting with the sandbox filesystem.-**Arguments**:-- `path`: Path to the file-- `user`: Run the operation as this user-- `format`: Format of the file content—`bytes`-- `request_timeout`: Timeout for the request in **seconds**+#### commands-**Returns**:+```python+@property+def commands() -> Commands+```-File content as a `bytearray`+Module for running commands in the sandbox.-#### read+#### pty```python-@overload-def read(path: str,- format: Literal["stream"],- user: Username = "user",- request_timeout: Optional[float] = None) -> Iterator[bytes]+@property+def pty() -> Pty```-Read file content as a `Iterator[bytes]`.+Module for interacting with the sandbox pseudo-terminal.-**Arguments**:-- `path`: Path to the file-- `user`: Run the operation as this user-- `format`: Format of the file content—`stream`-- `request_timeout`: Timeout for the request in **seconds**+#### sandbox\_id-**Returns**:+```python+@property+def sandbox_id() -> str+```-File content as an `Iterator[bytes]`+Unique identifier of the sandbox-#### write+#### \_\_init\_\_```python-def write(path: str,- data: Union[str, bytes, IO],- user: Username = "user",- request_timeout: Optional[float] = None) -> EntryInfo+def __init__(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,+ sandbox_id: Optional[str] = None,+ request_timeout: Optional[float] = None)```-Write content to a file on the path.--Writing to a file that doesn't exist creates the file.--Writing to a file that already exists overwrites the file.+Create a new sandbox.-Writing to a file at path that doesn't exist creates the necessary directories.+By default, the sandbox is created from the default `base` sandbox template.**Arguments**:-- `path`: Path to the file-- `data`: Data to write to the file, can be a `str`, `bytes`, or `IO`.-- `user`: Run the operation as this user+- `template`: Sandbox template name or ID+- `timeout`: Timeout for the sandbox in **seconds**, default to 300 seconds. Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users+- `metadata`: Custom metadata for the sandbox+- `envs`: Custom environment variables for the sandbox+- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable- `request_timeout`: Timeout for the request in **seconds****Returns**:-Information about the written file+sandbox instance for the new sandbox-#### list+#### is\_running```python-def list(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> List[EntryInfo]+def is_running(request_timeout: Optional[float] = None) -> bool```-List entries in a directory.+Check if the sandbox is running.**Arguments**:-- `path`: Path to the directory-- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds****Returns**:-List of entries in the directory+`True` if the sandbox is running, `False` otherwise+Example+```python+sandbox = Sandbox()+sandbox.is_running() # Returns True++sandbox.kill()+sandbox.is_running() # Returns False+```-#### exists+#### connect```python-def exists(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> bool+@classmethod+def connect(cls,+ sandbox_id: str,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None)```-Check if a file or a directory exists.+Connects to an existing Sandbox.++With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).**Arguments**:-- `path`: Path to a file or a directory-- `user`: Run the operation as this user-- `request_timeout`: Timeout for the request in **seconds**+- `sandbox_id`: Sandbox ID+- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable**Returns**:-`True` if the file or directory exists, `False` otherwise+sandbox instance for the existing sandbox+@example+```python+sandbox = Sandbox()+sandbox_id = sandbox.sandbox_id++same_sandbox = Sandbox.connect(sandbox_id)-#### remove+#### kill```python-def remove(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> None+@overload+def kill(request_timeout: Optional[float] = None) -> bool```-Remove a file or a directory.+Kill the sandbox.**Arguments**:-- `path`: Path to a file or a directory-- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds**+**Returns**:-#### rename+`True` if the sandbox was killed, `False` if the sandbox was not found+++#### kill```python-def rename(old_path: str,- new_path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> EntryInfo+@overload+@staticmethod+def kill(sandbox_id: str,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None,+ request_timeout: Optional[float] = None) -> bool```-Rename a file or directory.+Kill the sandbox specified by sandbox ID.**Arguments**:-- `old_path`: Path to the file or directory to rename-- `new_path`: New path to the file or directory-- `user`: Run the operation as this user+- `sandbox_id`: Sandbox ID+- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable- `request_timeout`: Timeout for the request in **seconds****Returns**:-Information about the renamed file or directory+`True` if the sandbox was killed, `False` if the sandbox was not found-#### make\_dir+#### kill```python-def make_dir(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> bool+@class_method_variant("_cls_kill")+def kill(request_timeout: Optional[float] = None) -> bool```-Create a new directory and all directories along the way if needed on the specified path.+Kill the sandbox.**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 in **seconds**+- `request_timeout`: Timeout for the request**Returns**:-`True` if the directory was created, `False` if the directory already exists+`True` if the sandbox was killed, `False` if the sandbox was not found-#### watch\_dir+#### set\_timeout```python-def watch_dir(path: str,- user: Username = "user",- request_timeout: Optional[float] = None) -> WatchHandle+@overload+def set_timeout(timeout: int, request_timeout: Optional[float] = None) -> None```-Watch directory for filesystem events.--**Arguments**:--- `path`: Path to a directory to watch-- `user`: Run the operation as this user-- `request_timeout`: Timeout for the request in **seconds**+Set the timeout of the sandbox.-**Returns**:+After the timeout expires the sandbox will be automatically killed.+This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.set_timeout`.-`WatchHandle` object for stopping watching directory+Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.+**Arguments**:+- `timeout`: Timeout for the sandbox in **seconds**+- `request_timeout`: Timeout for the request in **seconds**-## Pty+#### set\_timeout```python-class Pty()+@overload+@staticmethod+def set_timeout(sandbox_id: str,+ timeout: int,+ api_key: Optional[str] = None,+ domain: Optional[str] = None,+ debug: Optional[bool] = None,+ request_timeout: Optional[float] = None) -> None```-Module for interacting with PTYs (pseudo-terminals) in the sandbox.---#### kill+Set the timeout of the sandbox specified by sandbox ID.-```python-def kill(pid: int, request_timeout: Optional[float] = None) -> bool-```+After the timeout expires the sandbox will be automatically killed.+This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.set_timeout`.-Kill PTY.+Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users.**Arguments**:-- `pid`: Process ID of the PTY+- `sandbox_id`: Sandbox ID+- `timeout`: Timeout for the sandbox in **seconds**+- `api_key`: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable- `request_timeout`: Timeout for the request in **seconds**-**Returns**:-`true` if the PTY was killed, `false` if the PTY was not found-#### send\_stdin+## Filesystem```python-def send_stdin(pid: int,- data: bytes,- request_timeout: Optional[float] = None) -> None+class Filesystem()```-Send input to a PTY.--**Arguments**:--- `pid`: Process ID of the PTY-- `data`: Input data to send-- `request_timeout`: Timeout for the request in **seconds**+Module for interacting with the filesystem in the sandbox.-#### create+#### read```python-def create(size: PtySize,- user: Username = "user",- cwd: Optional[str] = None,- envs: Optional[Dict[str, str]] = None,- timeout: Optional[float] = 60,- request_timeout: Optional[float] = None) -> CommandHandle+@overload+def read(path: str,+ format: Literal["text"] = "text",+ user: Username = "user",+ request_timeout: Optional[float] = None) -> str```-Start a new PTY (pseudo-terminal).+Read file content as a `str`.**Arguments**:-- `size`: Size of the PTY-- `user`: User to use for the PTY-- `cwd`: Working directory for the PTY-- `envs`: Environment variables for the PTY-- `timeout`: Timeout for the PTY in **seconds**+- `path`: Path to the file+- `user`: Run the operation as this user+- `format`: Format of the file content—`text` by default- `request_timeout`: Timeout for the request in **seconds****Returns**:-Handle to interact with the PTY+File content as a `str`-#### resize+#### read```python-def resize(pid: int,- size: PtySize,- request_timeout: Optional[float] = None) -> None+@overload+def read(path: str,+ format: Literal["bytes"],+ user: Username = "user",+ request_timeout: Optional[float] = None) -> bytearray```-Resize PTY.--Call this when the terminal window is resized and the number of columns and rows has changed.+Read file content as a `bytearray`.**Arguments**:-- `pid`: Process ID of the PTY-- `size`: New size of the PTY-- `request_timeout`: Timeout for the request in **seconds**s-----## Commands+- `path`: Path to the file+- `user`: Run the operation as this user+- `format`: Format of the file content—`bytes`+- `request_timeout`: Timeout for the request in **seconds**-```python-class Commands()-```+**Returns**:-Module for executing commands in the sandbox.+File content as a `bytearray`-#### list+#### read```python-def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]+@overload+def read(path: str,+ format: Literal["stream"],+ user: Username = "user",+ request_timeout: Optional[float] = None) -> Iterator[bytes]```-Lists all running commands and PTY sessions.+Read file content as a `Iterator[bytes]`.**Arguments**:+- `path`: Path to the file+- `user`: Run the operation as this user+- `format`: Format of the file content—`stream`- `request_timeout`: Timeout for the request in **seconds****Returns**:-List of running commands and PTY sessions+File content as an `Iterator[bytes]`-#### kill+#### write```python-def kill(pid: int, request_timeout: Optional[float] = None) -> bool+def write(path: str,+ data: Union[str, bytes, IO],+ user: Username = "user",+ request_timeout: Optional[float] = None) -> EntryInfo```-Kills a running command specified by its process ID.+Write content to a file on the path.-It uses `SIGKILL` signal to kill the command.+Writing to a file that doesn't exist creates the file.++Writing to a file that already exists overwrites the file.++Writing to a file at path that doesn't exist creates the necessary directories.**Arguments**:-- `pid`: Process ID of the command. You can get the list of processes using `sandbox.commands.list()`+- `path`: Path to the file+- `data`: Data to write to the file, can be a `str`, `bytes`, or `IO`.+- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds****Returns**:-`True` if the command was killed, `False` if the command was not found+Information about the written file-#### send\_stdin+#### list```python-def send_stdin(pid: int, data: str, request_timeout: Optional[float] = None)+def list(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> List[EntryInfo]```-Send data to command stdin.+List entries in a directory.-:param pid Process ID of the command. You can get the list of processes using `sandbox.commands.list()`.-:param data: Data to send to the command-:param request_timeout: Timeout for the request in **seconds**+**Arguments**:+- `path`: Path to the directory+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request in **seconds**+**Returns**:-#### run+List of entries in the directory+++#### exists```python-@overload-def run(cmd: str,- background: Union[Literal[False], 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) -> CommandResult+def exists(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> bool```-Start a new command and wait until it finishes executing.+Check if a file or a directory exists.**Arguments**:-- `cmd`: Command to execute-- `background`: **`False` if the command should be executed in the foreground**, `True` if the command should be executed in the background-- `envs`: Environment variables used for the command-- `user`: User to run the command as-- `cwd`: Working directory to run the command-- `on_stdout`: Callback for command stdout output-- `on_stderr`: Callback for command stderr output-- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `path`: Path to a file or a directory+- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds****Returns**:-`CommandResult` result of the command execution+`True` if the file or directory exists, `False` otherwise-#### run+#### remove```python-@overload-def run(cmd: str,- background: Literal[True],- envs: Optional[Dict[str, str]] = None,- user: Username = "user",- cwd: Optional[str] = None,- on_stdout: None = None,- on_stderr: None = None,- timeout: Optional[float] = 60,- request_timeout: Optional[float] = None) -> CommandHandle+def remove(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> None```-Start a new command and return a handle to interact with it.+Remove a file or a directory.**Arguments**:-- `cmd`: Command to execute-- `background`: `False` if the command should be executed in the foreground, **`True` if the command should be executed in the background**-- `envs`: Environment variables used for the command-- `user`: User to run the command as-- `cwd`: Working directory to run the command-- `timeout`: Timeout for the command connection in **seconds**. Using `0` will not limit the command connection time+- `path`: Path to a file or a directory+- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds**-**Returns**:--`CommandHandle` handle to interact with the running command--#### connect+#### rename```python-def connect(pid: int,- timeout: Optional[float] = 60,- request_timeout: Optional[float] = None)+def rename(old_path: str,+ new_path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> EntryInfo```-Connects to a running command.--You can use `CommandHandle.wait()` to wait for the command to finish and get execution results.+Rename a file or directory.**Arguments**:-- `pid`: Process ID of the command to connect to. You can get the list of processes using `sandbox.commands.list()`-- `timeout`: Timeout for the connection in **seconds**. Using `0` will not limit the connection time+- `old_path`: Path to the file or directory to rename+- `new_path`: New path to the file or directory+- `user`: Run the operation as this user- `request_timeout`: Timeout for the request in **seconds****Returns**:-`CommandHandle` handle to interact with the running command--+Information about the renamed file or directory-## CommandHandle+#### make\_dir```python-class CommandHandle()+def make_dir(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> bool```-Command execution handle.--It provides methods for waiting for the command to finish, retrieving stdout/stderr, and killing the command.+Create a new directory and all directories along the way if needed on the specified path.+**Arguments**:-#### pid+- `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 in **seconds**-```python-@property-def pid()-```+**Returns**:-Command process ID.+`True` if the directory was created, `False` if the directory already exists-#### \_\_iter\_\_+#### watch\_dir```python-def __iter__()+def watch_dir(path: str,+ user: Username = "user",+ request_timeout: Optional[float] = None) -> WatchHandle```-Iterate over the command output.--**Returns**:+Watch directory for filesystem events.-Generator of command outputs+**Arguments**:+- `path`: Path to a directory to watch+- `user`: Run the operation as this user+- `request_timeout`: Timeout for the request in **seconds**-#### disconnect+**Returns**:-```python-def disconnect() -> None-```+`WatchHandle` object for stopping watching directory-Disconnect from the command.-The command is not killed, but SDK stops receiving events from the command.-You can reconnect to the command using `sandbox.commands.connect` method.-#### wait+## WatchHandle```python-def wait(on_pty: Optional[Callable[[PtyOutput], None]] = None,- on_stdout: Optional[Callable[[str], None]] = None,- on_stderr: Optional[Callable[[str], None]] = None) -> CommandResult+class WatchHandle()```-Wait for the command to finish and returns the result.+Handle for watching filesystem events.+It is used to get the latest events that have occurred in the watched directory.-If the command exits with a non-zero exit code, it throws a `CommandExitException`.+Use `.stop()` to stop watching the directory.-**Arguments**:-- `on_pty`: Callback for pty output-- `on_stdout`: Callback for stdout output-- `on_stderr`: Callback for stderr output+#### stop-**Returns**:+```python+def stop()+```-`CommandResult` result of command execution+Stop watching the directory.+After you stop the watcher you won't be able to get the events anymore.-#### kill+#### get\_new\_events```python-def kill() -> bool+def get_new_events() -> List[FilesystemEvent]```-Kills the command.--It uses `SIGKILL` signal to kill the command.+Get the latest events that have occurred in the watched directory since the last call, or from the beginning of the watching, up until now.**Returns**:-Whether the command was killed successfully+List of filesystem eventsdiff --git a/packages/cli/package.json b/packages/cli/package.jsonindex 1f468f5b7..8a4f73993 100644--- a/packages/cli/package.json+++ b/packages/cli/package.json@@ -1,6 +1,6 @@{"name": "@e2b/cli",- "version": "1.0.4",+ "version": "1.0.5","description": "CLI for managing e2b sandbox templates","homepage": "https://e2b.dev","license": "MIT",