Skip to content

armgit / E2B

Public Imported from GitHub
0

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

[skip ci] Release new versions

github-actions[bot]f561fc463c42
diff --git a/.changeset/fluffy-shrimps-play.md b/.changeset/fluffy-shrimps-play.md
deleted file mode 100644
index e0c5d997d..000000000
--- a/.changeset/fluffy-shrimps-play.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@e2b/python-sdk': patch
----
-
-fixed cmd parser in from_dockerfile
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/exceptions/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/exceptions/page.mdx
new file mode 100644
index 000000000..28991790d
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/exceptions/page.mdx
@@ -0,0 +1,102 @@
+
+
+
+## SandboxException
+
+```python
+class SandboxException(Exception)
+```
+
+Base class for all sandbox errors.
+
+Raised when a general sandbox exception occurs.
+
+
+## TimeoutException
+
+```python
+class TimeoutException(SandboxException)
+```
+
+Raised when a timeout occurs.
+
+The `unavailable` exception type is caused by sandbox timeout.
+
+The `canceled` exception type is caused by exceeding request timeout.
+
+The `deadline_exceeded` exception type is caused by exceeding the timeout for process, watch, etc.
+
+The `unknown` exception type is sometimes caused by the sandbox timeout when the request is not processed correctly.
+
+
+## InvalidArgumentException
+
+```python
+class InvalidArgumentException(SandboxException)
+```
+
+Raised when an invalid argument is provided.
+
+
+## NotEnoughSpaceException
+
+```python
+class NotEnoughSpaceException(SandboxException)
+```
+
+Raised when there is not enough disk space.
+
+
+## NotFoundException
+
+```python
+class NotFoundException(SandboxException)
+```
+
+Raised when a resource is not found.
+
+
+## AuthenticationException
+
+```python
+class AuthenticationException(Exception)
+```
+
+Raised when authentication fails.
+
+
+## TemplateException
+
+```python
+class TemplateException(SandboxException)
+```
+
+Exception raised when the template uses old envd version. It isn't compatible with the new SDK.
+
+
+## RateLimitException
+
+```python
+class RateLimitException(SandboxException)
+```
+
+Raised when the API rate limit is exceeded.
+
+
+## BuildException
+
+```python
+class BuildException(Exception)
+```
+
+Raised when the build fails.
+
+
+## FileUploadException
+
+```python
+class FileUploadException(BuildException)
+```
+
+Raised when the file upload fails.
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/sandbox_async/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/sandbox_async/page.mdx
new file mode 100644
index 000000000..52a4dce41
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/sandbox_async/page.mdx
@@ -0,0 +1,1307 @@
+
+
+
+## Filesystem
+
+```python
+class Filesystem()
+```
+
+Module for interacting with the filesystem in the sandbox.
+
+
+### read
+
+```python
+@overload
+async def read(path: str,
+ format: Literal["text"] = "text",
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> str
+```
+
+Read file content as a `str`.
+
+**Arguments**:
+
+- `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**:
+
+File content as a `str`
+
+
+### read
+
+```python
+@overload
+async def read(path: str,
+ format: Literal["bytes"],
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> bytearray
+```
+
+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**:
+
+File content as a `bytearray`
+
+
+### read
+
+```python
+@overload
+async def read(
+ path: str,
+ format: Literal["stream"],
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> AsyncIterator[bytes]
+```
+
+Read file content as a `AsyncIterator[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**:
+
+File content as an `AsyncIterator[bytes]`
+
+
+### write
+
+```python
+async def write(path: str,
+ data: Union[str, bytes, IO],
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> WriteInfo
+```
+
+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.
+Writing to a file at path that doesn't exist creates the necessary directories.
+
+**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
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+Information about the written file
+
+
+### write\_files
+
+```python
+async def write_files(
+ files: List[WriteEntry],
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> List[WriteInfo]
+```
+
+Writes multiple files.
+
+Writes a list of files to the filesystem.
+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**:
+
+- `files`: list of files to write as `WriteEntry` objects, each containing `path` and `data`
+- `user`: Run the operation as this user
+- `request_timeout`: Timeout for the request
+
+**Returns**:
+
+Information about the written files
+
+
+### list
+
+```python
+async def list(path: str,
+ depth: Optional[int] = 1,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> List[EntryInfo]
+```
+
+List entries in a directory.
+
+**Arguments**:
+
+- `path`: Path to the directory
+- `depth`: Depth of the directory to list
+- `user`: Run the operation as this user
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+List of entries in the directory
+
+
+### exists
+
+```python
+async def exists(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> bool
+```
+
+Check if a file or a directory exists.
+
+**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**:
+
+`True` if the file or directory exists, `False` otherwise
+
+
+### get\_info
+
+```python
+async def get_info(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> EntryInfo
+```
+
+Get information about a file or 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**
+
+**Returns**:
+
+Information about the file or directory like name, type, and path
+
+
+### remove
+
+```python
+async def remove(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> None
+```
+
+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**
+
+
+### rename
+
+```python
+async def rename(old_path: str,
+ new_path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> EntryInfo
+```
+
+Rename a file or directory.
+
+**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
+
+
+### make\_dir
+
+```python
+async def make_dir(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> bool
+```
+
+Create 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 in **seconds**
+
+**Returns**:
+
+`True` if the directory was created, `False` if the directory already exists
+
+
+### watch\_dir
+
+```python
+async def watch_dir(path: str,
+ on_event: OutputHandler[FilesystemEvent],
+ on_exit: Optional[OutputHandler[Exception]] = None,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None,
+ timeout: Optional[float] = 60,
+ recursive: bool = False) -> AsyncWatchHandle
+```
+
+Watch directory for filesystem events.
+
+**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
+- `recursive`: Watch directory recursively
+
+**Returns**:
+
+`AsyncWatchHandle` object for stopping watching directory
+
+
+
+
+## AsyncWatchHandle
+
+```python
+class AsyncWatchHandle()
+```
+
+Handle for watching a directory in the sandbox filesystem.
+
+Use `.stop()` to stop watching the directory.
+
+
+### stop
+
+```python
+async def stop()
+```
+
+Stop watching the directory.
+
+
+
+
+## AsyncSandbox
+
+```python
+class AsyncSandbox(SandboxApi)
+```
+
+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
+
+Check docs [here](https://e2b.dev/docs).
+
+Use the `AsyncSandbox.create()` to create a new sandbox.
+
+**Example**:
+
+```python
+from e2b import AsyncSandbox
+
+sandbox = await AsyncSandbox.create()
+```
+
+
+### files
+
+```python
+@property
+def files() -> Filesystem
+```
+
+Module for interacting with the sandbox filesystem.
+
+
+### commands
+
+```python
+@property
+def commands() -> Commands
+```
+
+Module for running commands in the sandbox.
+
+
+### pty
+
+```python
+@property
+def pty() -> Pty
+```
+
+Module for interacting with the sandbox pseudo-terminal.
+
+
+### \_\_init\_\_
+
+```python
+def __init__(**opts: Unpack[SandboxOpts])
+```
+
+Use `AsyncSandbox.create()` to create a new sandbox instead.
+
+
+### is\_running
+
+```python
+async def is_running(request_timeout: Optional[float] = None) -> bool
+```
+
+Check if the sandbox is running.
+
+**Arguments**:
+
+- `request_timeout`: Timeout for the request in **seconds**
+
+**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,
+ secure: bool = True,
+ allow_internet_access: bool = True,
+ mcp: Optional[McpServer] = None,
+ network: Optional[SandboxNetworkOpts] = None,
+ **opts: Unpack[ApiParams]) -> Self
+```
+
+Create a new sandbox.
+
+By default, the sandbox is created from the default `base` sandbox template.
+
+**Arguments**:
+
+- `template`: Sandbox template name or ID
+- `timeout`: Timeout for the sandbox in **seconds**, default to 300 seconds. The 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
+- `secure`: Envd is secured with access token and cannot be used without it, defaults to `True`.
+- `allow_internet_access`: Allow sandbox to access the internet, defaults to `True`. If set to `False`, it works the same as setting network `deny_out` to `[0.0.0.0/0]`.
+- `mcp`: MCP server to enable in the sandbox
+- `network`: Sandbox network configuration
+
+**Returns**:
+
+A Sandbox instance for the new sandbox
+Use this method instead of using the constructor to create a new sandbox.
+
+
+### connect
+
+```python
+@overload
+async def connect(timeout: Optional[int] = None,
+ **opts: Unpack[ApiParams]) -> Self
+```
+
+Connect to a sandbox. If the sandbox is paused, it will be automatically resumed.
+
+Sandbox must be either running or be paused.
+
+With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).
+
+**Arguments**:
+
+- `timeout`: Timeout for the sandbox in **seconds**
+For running sandboxes, the timeout will update only if the new timeout is longer than the existing one.
+
+**Returns**:
+
+A running sandbox instance
+@example
+```python
+sandbox = await AsyncSandbox.create()
+await sandbox.beta_pause()
+
+same_sandbox = await sandbox.connect()
+```
+
+
+### connect
+
+```python
+@overload
+@classmethod
+async def connect(cls,
+ sandbox_id: str,
+ timeout: Optional[int] = None,
+ **opts: Unpack[ApiParams]) -> Self
+```
+
+Connect to a sandbox. If the sandbox is paused, it will be automatically resumed.
+
+Sandbox must be either running or be paused.
+
+With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+- `timeout`: Timeout for the sandbox in **seconds**
+For running sandboxes, the timeout will update only if the new timeout is longer than the existing one.
+
+**Returns**:
+
+A running sandbox instance
+@example
+```python
+sandbox = await AsyncSandbox.create()
+await AsyncSandbox.beta_pause(sandbox.sandbox_id)
+
+same_sandbox = await AsyncSandbox.connect(sandbox.sandbox_id))
+```
+
+
+### connect
+
+```python
+@class_method_variant("_cls_connect")
+async def connect(timeout: Optional[int] = None,
+ **opts: Unpack[ApiParams]) -> Self
+```
+
+Connect to a sandbox. If the sandbox is paused, it will be automatically resumed.
+
+Sandbox must be either running or be paused.
+
+With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).
+
+**Arguments**:
+
+- `timeout`: Timeout for the sandbox in **seconds**
+For running sandboxes, the timeout will update only if the new timeout is longer than the existing one.
+
+**Returns**:
+
+A running sandbox instance
+@example
+```python
+sandbox = await AsyncSandbox.create()
+await sandbox.beta_pause()
+
+same_sandbox = await sandbox.connect()
+```
+
+
+### kill
+
+```python
+@overload
+async def kill(**opts: Unpack[ApiParams]) -> bool
+```
+
+Kill the sandbox.
+
+**Returns**:
+
+`True` if the sandbox was killed, `False` if the sandbox was not found
+
+
+### kill
+
+```python
+@overload
+@staticmethod
+async def kill(sandbox_id: str, **opts: Unpack[ApiParams]) -> bool
+```
+
+Kill the sandbox specified by sandbox ID.
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+
+**Returns**:
+
+`True` if the sandbox was killed, `False` if the sandbox was not found
+
+
+### kill
+
+```python
+@class_method_variant("_cls_kill")
+async def kill(**opts: Unpack[ApiParams]) -> bool
+```
+
+Kill the sandbox specified by sandbox ID.
+
+**Returns**:
+
+`True` if the sandbox was killed, `False` if the sandbox was not found
+
+
+### set\_timeout
+
+```python
+@overload
+async def set_timeout(timeout: int, **opts: Unpack[ApiParams]) -> 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`.
+
+The 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**
+
+
+### set\_timeout
+
+```python
+@overload
+@staticmethod
+async def set_timeout(sandbox_id: str, timeout: int,
+ **opts: Unpack[ApiParams]) -> None
+```
+
+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`.
+
+The 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**:
+
+- `sandbox_id`: Sandbox ID
+- `timeout`: Timeout for the sandbox in **seconds**
+
+
+### set\_timeout
+
+```python
+@class_method_variant("_cls_set_timeout")
+async def set_timeout(timeout: int, **opts: Unpack[ApiParams]) -> None
+```
+
+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`.
+
+The 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**
+
+
+### get\_info
+
+```python
+@overload
+async def get_info(**opts: Unpack[ApiParams]) -> SandboxInfo
+```
+
+Get sandbox information like sandbox ID, template, metadata, started at/end at date.
+
+**Returns**:
+
+Sandbox info
+
+
+### get\_info
+
+```python
+@overload
+@staticmethod
+async def get_info(sandbox_id: str, **opts: Unpack[ApiParams]) -> SandboxInfo
+```
+
+Get sandbox information like sandbox ID, template, metadata, started at/end at date.
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+
+**Returns**:
+
+Sandbox info
+
+
+### get\_info
+
+```python
+@class_method_variant("_cls_get_info")
+async def get_info(**opts: Unpack[ApiParams]) -> SandboxInfo
+```
+
+Get sandbox information like sandbox ID, template, metadata, started at/end at date.
+
+**Returns**:
+
+Sandbox info
+
+
+### get\_metrics
+
+```python
+@overload
+async def get_metrics(start: Optional[datetime.datetime] = None,
+ end: Optional[datetime.datetime] = None,
+ **opts: Unpack[ApiParams]) -> List[SandboxMetrics]
+```
+
+Get the metrics of the current sandbox.
+
+**Arguments**:
+
+- `start`: Start time for the metrics, defaults to the start of the sandbox
+- `end`: End time for the metrics, defaults to the current time
+
+**Returns**:
+
+List of sandbox metrics containing CPU, memory and disk usage information
+
+
+### get\_metrics
+
+```python
+@overload
+@staticmethod
+async def get_metrics(sandbox_id: str,
+ start: Optional[datetime.datetime] = None,
+ end: Optional[datetime.datetime] = None,
+ **opts: Unpack[ApiParams]) -> List[SandboxMetrics]
+```
+
+Get the metrics of the sandbox specified by sandbox ID.
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+- `start`: Start time for the metrics, defaults to the start of the sandbox
+- `end`: End time for the metrics, defaults to the current time
+
+**Returns**:
+
+List of sandbox metrics containing CPU, memory and disk usage information
+
+
+### get\_metrics
+
+```python
+@class_method_variant("_cls_get_metrics")
+async def get_metrics(start: Optional[datetime.datetime] = None,
+ end: Optional[datetime.datetime] = None,
+ **opts: Unpack[ApiParams]) -> List[SandboxMetrics]
+```
+
+Get the metrics of the current sandbox.
+
+**Arguments**:
+
+- `start`: Start time for the metrics, defaults to the start of the sandbox
+- `end`: End time for the metrics, defaults to the current time
+
+**Returns**:
+
+List of sandbox metrics containing CPU, memory and disk usage information
+
+
+### beta\_create
+
+```python
+@classmethod
+async def beta_create(cls,
+ template: Optional[str] = None,
+ timeout: Optional[int] = None,
+ auto_pause: bool = False,
+ metadata: Optional[Dict[str, str]] = None,
+ envs: Optional[Dict[str, str]] = None,
+ secure: bool = True,
+ allow_internet_access: bool = True,
+ mcp: Optional[McpServer] = None,
+ **opts: Unpack[ApiParams]) -> Self
+```
+
+[BETA] This feature is in beta and may change in the future.
+
+Create a new sandbox.
+
+By default, the sandbox is created from the default `base` sandbox template.
+
+**Arguments**:
+
+- `template`: Sandbox template name or ID
+- `timeout`: Timeout for the sandbox in **seconds**, default to 300 seconds. The 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.
+- `auto_pause`: Automatically pause the sandbox after the timeout expires. Defaults to `False`.
+- `metadata`: Custom metadata for the sandbox
+- `envs`: Custom environment variables for the sandbox
+- `secure`: Envd is secured with access token and cannot be used without it, defaults to `True`.
+- `allow_internet_access`: Allow sandbox to access the internet, defaults to `True`.
+- `mcp`: MCP server to enable in the sandbox
+
+**Returns**:
+
+A Sandbox instance for the new sandbox
+Use this method instead of using the constructor to create a new sandbox.
+
+
+### beta\_pause
+
+```python
+@overload
+async def beta_pause(**opts: Unpack[ApiParams]) -> None
+```
+
+[BETA] This feature is in beta and may change in the future.
+
+Pause the sandbox.
+
+**Returns**:
+
+Sandbox ID that can be used to resume the sandbox
+
+
+### beta\_pause
+
+```python
+@overload
+@staticmethod
+async def beta_pause(sandbox_id: str, **opts: Unpack[ApiParams]) -> None
+```
+
+[BETA] This feature is in beta and may change in the future.
+
+Pause the sandbox specified by sandbox ID.
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+
+**Returns**:
+
+Sandbox ID that can be used to resume the sandbox
+
+
+### beta\_pause
+
+```python
+@class_method_variant("_cls_pause")
+async def beta_pause(**opts: Unpack[ApiParams]) -> None
+```
+
+[BETA] This feature is in beta and may change in the future.
+
+Pause the sandbox.
+
+**Returns**:
+
+Sandbox ID that can be used to resume the sandbox
+
+
+### get\_mcp\_token
+
+```python
+async def get_mcp_token() -> Optional[str]
+```
+
+Get the MCP token for the sandbox.
+
+**Returns**:
+
+MCP token for the sandbox, or None if MCP is not enabled.
+
+
+
+
+## AsyncSandboxPaginator
+
+```python
+class AsyncSandboxPaginator(SandboxPaginatorBase)
+```
+
+Paginator for listing sandboxes.
+
+**Example**:
+
+```python
+paginator = AsyncSandbox.list()
+
+while paginator.has_next:
+ sandboxes = await paginator.next_items()
+ print(sandboxes)
+```
+
+
+### next\_items
+
+```python
+async def next_items() -> List[SandboxInfo]
+```
+
+Returns the next page of sandboxes.
+
+Call this method only if `has_next` is `True`, otherwise it will raise an exception.
+
+**Returns**:
+
+List of sandboxes
+
+
+
+
+## AsyncCommandHandle
+
+```python
+class AsyncCommandHandle()
+```
+
+Command execution handle.
+
+It provides methods for waiting for the command to finish, retrieving stdout/stderr, and killing the command.
+
+
+### pid
+
+```python
+@property
+def pid()
+```
+
+Command process ID.
+
+
+### stdout
+
+```python
+@property
+def stdout()
+```
+
+Command stdout output.
+
+
+### stderr
+
+```python
+@property
+def stderr()
+```
+
+Command stderr output.
+
+
+### error
+
+```python
+@property
+def error()
+```
+
+Command execution error message.
+
+
+### exit\_code
+
+```python
+@property
+def exit_code()
+```
+
+Command execution exit code.
+
+`0` if the command finished successfully.
+
+It is `None` if the command is still running.
+
+
+### disconnect
+
+```python
+async def disconnect() -> None
+```
+
+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
+
+```python
+async def wait() -> CommandResult
+```
+
+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**:
+
+`CommandResult` result of command execution
+
+
+### kill
+
+```python
+async def kill() -> bool
+```
+
+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
+
+
+
+
+## Pty
+
+```python
+class Pty()
+```
+
+Module for interacting with PTYs (pseudo-terminals) in the sandbox.
+
+
+### kill
+
+```python
+async def kill(pid: int, request_timeout: Optional[float] = None) -> bool
+```
+
+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
+
+
+### send\_stdin
+
+```python
+async def send_stdin(pid: int,
+ data: bytes,
+ request_timeout: Optional[float] = None) -> None
+```
+
+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**
+
+
+### create
+
+```python
+async def create(
+ size: PtySize,
+ on_data: OutputHandler[PtyOutput],
+ user: Optional[Username] = None,
+ cwd: Optional[str] = None,
+ envs: Optional[Dict[str, str]] = None,
+ timeout: Optional[float] = 60,
+ request_timeout: Optional[float] = None) -> AsyncCommandHandle
+```
+
+Start a new PTY (pseudo-terminal).
+
+**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**
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+Handle to interact with the PTY
+
+
+### resize
+
+```python
+async def resize(pid: int,
+ size: PtySize,
+ request_timeout: Optional[float] = None)
+```
+
+Resize PTY.
+
+Call this when the terminal window is resized and the number of columns and rows has changed.
+
+**Arguments**:
+
+- `pid`: Process ID of the PTY
+- `size`: New size of the PTY
+- `request_timeout`: Timeout for the request in **seconds**
+
+
+
+
+## Commands
+
+```python
+class Commands()
+```
+
+Module for executing commands in the sandbox.
+
+
+### list
+
+```python
+async def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]
+```
+
+Lists all running commands and PTY sessions.
+
+**Arguments**:
+
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+List of running commands and PTY sessions
+
+
+### kill
+
+```python
+async def kill(pid: int, request_timeout: Optional[float] = None) -> bool
+```
+
+Kill a running command specified by its process ID.
+
+It uses `SIGKILL` signal to kill the command.
+
+**Arguments**:
+
+- `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**
+
+**Returns**:
+
+`True` if the command was killed, `False` if the command was not found
+
+
+### send\_stdin
+
+```python
+async def send_stdin(pid: int,
+ data: str,
+ request_timeout: Optional[float] = None) -> None
+```
+
+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**
+
+
+
+### run
+
+```python
+@overload
+async def run(cmd: str,
+ background: Union[Literal[False], None] = None,
+ envs: Optional[Dict[str, str]] = None,
+ user: Optional[Username] = None,
+ cwd: Optional[str] = None,
+ on_stdout: Optional[OutputHandler[Stdout]] = None,
+ on_stderr: Optional[OutputHandler[Stderr]] = None,
+ stdin: Optional[bool] = None,
+ timeout: Optional[float] = 60,
+ request_timeout: Optional[float] = None) -> CommandResult
+```
+
+Start a new command and wait until it finishes executing.
+
+**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
+- `stdin`: If `True`, the command will have a stdin stream that you can send data to using `sandbox.commands.send_stdin()`
+- `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**:
+
+`CommandResult` result of the command execution
+
+
+### run
+
+```python
+@overload
+async def run(cmd: str,
+ background: Literal[True],
+ envs: Optional[Dict[str, str]] = None,
+ user: Optional[Username] = None,
+ cwd: Optional[str] = None,
+ on_stdout: Optional[OutputHandler[Stdout]] = None,
+ on_stderr: Optional[OutputHandler[Stderr]] = None,
+ stdin: Optional[bool] = None,
+ timeout: Optional[float] = 60,
+ request_timeout: Optional[float] = None) -> AsyncCommandHandle
+```
+
+Start a new command and return a handle to interact with it.
+
+**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
+- `stdin`: If `True`, the command will have a stdin stream that you can send data to using `sandbox.commands.send_stdin()`
+- `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**:
+
+`AsyncCommandHandle` handle to interact with the running command
+
+
+### 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
+) -> AsyncCommandHandle
+```
+
+Connects to a running command.
+
+You can use `AsyncCommandHandle.wait()` to wait for the command to finish and get execution results.
+
+**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
+
+**Returns**:
+
+`AsyncCommandHandle` handle to interact with the running command
+
+
+
+
+## SandboxApi
+
+```python
+class SandboxApi(SandboxBase)
+```
+
+
+### list
+
+```python
+@staticmethod
+def list(query: Optional[SandboxQuery] = None,
+ limit: Optional[int] = None,
+ next_token: Optional[str] = None,
+ **opts: Unpack[ApiParams]) -> AsyncSandboxPaginator
+```
+
+List all running sandboxes.
+
+**Arguments**:
+
+- `query`: Filter the list of sandboxes by metadata or state, e.g. `SandboxListQuery(metadata={"key": "value"})` or `SandboxListQuery(state=[SandboxState.RUNNING])`
+- `limit`: Maximum number of sandboxes to return per page
+- `next_token`: Token for pagination
+
+**Returns**:
+
+List of running sandboxes
+
+
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/sandbox_sync/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/sandbox_sync/page.mdx
new file mode 100644
index 000000000..48ce6de06
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/sandbox_sync/page.mdx
@@ -0,0 +1,1266 @@
+
+
+
+## Filesystem
+
+```python
+class Filesystem()
+```
+
+Module for interacting with the filesystem in the sandbox.
+
+
+### read
+
+```python
+@overload
+def read(path: str,
+ format: Literal["text"] = "text",
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> str
+```
+
+Read file content as a `str`.
+
+**Arguments**:
+
+- `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**:
+
+File content as a `str`
+
+
+### read
+
+```python
+@overload
+def read(path: str,
+ format: Literal["bytes"],
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> bytearray
+```
+
+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**:
+
+File content as a `bytearray`
+
+
+### read
+
+```python
+@overload
+def read(path: str,
+ format: Literal["stream"],
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> Iterator[bytes]
+```
+
+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**:
+
+File content as an `Iterator[bytes]`
+
+
+### write
+
+```python
+def write(path: str,
+ data: Union[str, bytes, IO],
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> WriteInfo
+```
+
+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.
+Writing to a file at path that doesn't exist creates the necessary directories.
+
+**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
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+Information about the written file
+
+
+### write\_files
+
+```python
+def write_files(files: List[WriteEntry],
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> List[WriteInfo]
+```
+
+Writes a list of files to the filesystem.
+
+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**:
+
+- `files`: list of files to write as `WriteEntry` objects, each containing `path` and `data`
+- `user`: Run the operation as this user
+- `request_timeout`: Timeout for the request
+
+**Returns**:
+
+Information about the written files
+
+
+### list
+
+```python
+def list(path: str,
+ depth: Optional[int] = 1,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> List[EntryInfo]
+```
+
+List entries in a directory.
+
+**Arguments**:
+
+- `path`: Path to the directory
+- `depth`: Depth of the directory to list
+- `user`: Run the operation as this user
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+List of entries in the directory
+
+
+### exists
+
+```python
+def exists(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> bool
+```
+
+Check if a file or a directory exists.
+
+**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**:
+
+`True` if the file or directory exists, `False` otherwise
+
+
+### get\_info
+
+```python
+def get_info(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> EntryInfo
+```
+
+Get information about a file or 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**
+
+**Returns**:
+
+Information about the file or directory like name, type, and path
+
+
+### remove
+
+```python
+def remove(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> None
+```
+
+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**
+
+
+### rename
+
+```python
+def rename(old_path: str,
+ new_path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> EntryInfo
+```
+
+Rename a file or directory.
+
+**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
+
+
+### make\_dir
+
+```python
+def make_dir(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None) -> bool
+```
+
+Create 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 in **seconds**
+
+**Returns**:
+
+`True` if the directory was created, `False` if the directory already exists
+
+
+### watch\_dir
+
+```python
+def watch_dir(path: str,
+ user: Optional[Username] = None,
+ request_timeout: Optional[float] = None,
+ recursive: bool = False) -> WatchHandle
+```
+
+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**
+- `recursive`: Watch directory recursively
+
+**Returns**:
+
+`WatchHandle` object for stopping watching directory
+
+
+
+
+## WatchHandle
+
+```python
+class WatchHandle()
+```
+
+Handle for watching filesystem events.
+It is used to get the latest events that have occurred in the watched directory.
+
+Use `.stop()` to stop watching the directory.
+
+
+### stop
+
+```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
+
+```python
+def get_new_events() -> List[FilesystemEvent]
+```
+
+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 of filesystem events
+
+
+
+
+## Sandbox
+
+```python
+class Sandbox(SandboxApi)
+```
+
+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
+
+Check docs [here](https://e2b.dev/docs).
+
+Use the `Sandbox.create()` to create a new sandbox.
+
+**Example**:
+
+```python
+from e2b import Sandbox
+
+sandbox = Sandbox.create()
+```
+
+
+### files
+
+```python
+@property
+def files() -> Filesystem
+```
+
+Module for interacting with the sandbox filesystem.
+
+
+### commands
+
+```python
+@property
+def commands() -> Commands
+```
+
+Module for running commands in the sandbox.
+
+
+### pty
+
+```python
+@property
+def pty() -> Pty
+```
+
+Module for interacting with the sandbox pseudo-terminal.
+
+
+### \_\_init\_\_
+
+```python
+def __init__(**opts: Unpack[SandboxOpts])
+```
+
+:deprecated: This constructor is deprecated
+
+Use `Sandbox.create()` to create a new sandbox instead.
+
+
+### is\_running
+
+```python
+def is_running(request_timeout: Optional[float] = None) -> bool
+```
+
+Check if the sandbox is running.
+
+**Arguments**:
+
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+`True` if the sandbox is running, `False` otherwise
+Example
+```python
+sandbox = Sandbox.create()
+sandbox.is_running() # Returns True
+
+sandbox.kill()
+sandbox.is_running() # Returns False
+```
+
+
+### create
+
+```python
+@classmethod
+def create(cls,
+ template: Optional[str] = None,
+ timeout: Optional[int] = None,
+ metadata: Optional[Dict[str, str]] = None,
+ envs: Optional[Dict[str, str]] = None,
+ secure: bool = True,
+ allow_internet_access: bool = True,
+ mcp: Optional[McpServer] = None,
+ network: Optional[SandboxNetworkOpts] = None,
+ **opts: Unpack[ApiParams]) -> Self
+```
+
+Create a new sandbox.
+
+By default, the sandbox is created from the default `base` sandbox template.
+
+**Arguments**:
+
+- `template`: Sandbox template name or ID
+- `timeout`: Timeout for the sandbox in **seconds**, default to 300 seconds. The 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
+- `secure`: Envd is secured with access token and cannot be used without it, defaults to `True`.
+- `allow_internet_access`: Allow sandbox to access the internet, defaults to `True`. If set to `False`, it works the same as setting network `deny_out` to `[0.0.0.0/0]`.
+- `mcp`: MCP server to enable in the sandbox
+- `network`: Sandbox network configuration
+
+**Returns**:
+
+A Sandbox instance for the new sandbox
+Use this method instead of using the constructor to create a new sandbox.
+
+
+### connect
+
+```python
+@overload
+def connect(timeout: Optional[int] = None, **opts: Unpack[ApiParams]) -> Self
+```
+
+Connect to a sandbox. If the sandbox is paused, it will be automatically resumed.
+
+Sandbox must be either running or be paused.
+
+With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).
+
+**Arguments**:
+
+- `timeout`: Timeout for the sandbox in **seconds**
+For running sandboxes, the timeout will update only if the new timeout is longer than the existing one.
+
+**Returns**:
+
+A running sandbox instance
+@example
+```python
+sandbox = Sandbox.create()
+sandbox.beta_pause()
+
+same_sandbox = sandbox.connect()
+
+
+### connect
+
+```python
+@overload
+@classmethod
+def connect(cls,
+ sandbox_id: str,
+ timeout: Optional[int] = None,
+ **opts: Unpack[ApiParams]) -> Self
+```
+
+Connect to a sandbox. If the sandbox is paused, it will be automatically resumed.
+
+Sandbox must be either running or be paused.
+
+With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+- `timeout`: Timeout for the sandbox in **seconds**.
+For running sandboxes, the timeout will update only if the new timeout is longer than the existing one.
+
+**Returns**:
+
+A running sandbox instance
+@example
+```python
+sandbox = Sandbox.create()
+Sandbox.beta_pause(sandbox.sandbox_id)
+
+same_sandbox = Sandbox.connect(sandbox.sandbox_id)
+```
+
+
+### connect
+
+```python
+@class_method_variant("_cls_connect")
+def connect(timeout: Optional[int] = None, **opts: Unpack[ApiParams]) -> Self
+```
+
+Connect to a sandbox. If the sandbox is paused, it will be automatically resumed.
+
+Sandbox must be either running or be paused.
+
+With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).
+
+**Arguments**:
+
+- `timeout`: Timeout for the sandbox in **seconds**.
+For running sandboxes, the timeout will update only if the new timeout is longer than the existing one.
+
+**Returns**:
+
+A running sandbox instance
+@example
+```python
+sandbox = Sandbox.create()
+sandbox.beta_pause()
+
+same_sandbox = sandbox.connect()
+```
+
+
+### kill
+
+```python
+@overload
+def kill(**opts: Unpack[ApiParams]) -> bool
+```
+
+Kill the sandbox.
+
+**Returns**:
+
+`True` if the sandbox was killed, `False` if the sandbox was not found
+
+
+### kill
+
+```python
+@overload
+@staticmethod
+def kill(sandbox_id: str, **opts: Unpack[ApiParams]) -> bool
+```
+
+Kill the sandbox specified by sandbox ID.
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+
+**Returns**:
+
+`True` if the sandbox was killed, `False` if the sandbox was not found
+
+
+### kill
+
+```python
+@class_method_variant("_cls_kill")
+def kill(**opts: Unpack[ApiParams]) -> bool
+```
+
+Kill the sandbox specified by sandbox ID.
+
+**Returns**:
+
+`True` if the sandbox was killed, `False` if the sandbox was not found
+
+
+### set\_timeout
+
+```python
+@overload
+def set_timeout(timeout: int, **opts: Unpack[ApiParams]) -> 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`.
+
+The 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**
+
+
+### set\_timeout
+
+```python
+@overload
+@staticmethod
+def set_timeout(sandbox_id: str, timeout: int,
+ **opts: Unpack[ApiParams]) -> None
+```
+
+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`.
+
+The 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**:
+
+- `sandbox_id`: Sandbox ID
+- `timeout`: Timeout for the sandbox in **seconds**
+
+
+### set\_timeout
+
+```python
+@class_method_variant("_cls_set_timeout")
+def set_timeout(timeout: int, **opts: Unpack[ApiParams]) -> 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`.
+
+The 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**
+
+
+### get\_info
+
+```python
+@overload
+def get_info(**opts: Unpack[ApiParams]) -> SandboxInfo
+```
+
+Get sandbox information like sandbox ID, template, metadata, started at/end at date.
+
+**Returns**:
+
+Sandbox info
+
+
+### get\_info
+
+```python
+@overload
+@staticmethod
+def get_info(sandbox_id: str, **opts: Unpack[ApiParams]) -> SandboxInfo
+```
+
+Get sandbox information like sandbox ID, template, metadata, started at/end at date.
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+
+**Returns**:
+
+Sandbox info
+
+
+### get\_info
+
+```python
+@class_method_variant("_cls_get_info")
+def get_info(**opts: Unpack[ApiParams]) -> SandboxInfo
+```
+
+Get sandbox information like sandbox ID, template, metadata, started at/end at date.
+
+**Returns**:
+
+Sandbox info
+
+
+### get\_metrics
+
+```python
+@overload
+def get_metrics(start: Optional[datetime.datetime] = None,
+ end: Optional[datetime.datetime] = None,
+ **opts: Unpack[ApiParams]) -> List[SandboxMetrics]
+```
+
+Get the metrics of the current sandbox.
+
+**Arguments**:
+
+- `start`: Start time for the metrics, defaults to the start of the sandbox
+- `end`: End time for the metrics, defaults to the current time
+
+**Returns**:
+
+List of sandbox metrics containing CPU, memory and disk usage information
+
+
+### get\_metrics
+
+```python
+@overload
+@staticmethod
+def get_metrics(sandbox_id: str,
+ start: Optional[datetime.datetime] = None,
+ end: Optional[datetime.datetime] = None,
+ **opts: Unpack[ApiParams]) -> List[SandboxMetrics]
+```
+
+Get the metrics of the sandbox specified by sandbox ID.
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+- `start`: Start time for the metrics, defaults to the start of the sandbox
+- `end`: End time for the metrics, defaults to the current time
+
+**Returns**:
+
+List of sandbox metrics containing CPU, memory and disk usage information
+
+
+### get\_metrics
+
+```python
+@class_method_variant("_cls_get_metrics")
+def get_metrics(start: Optional[datetime.datetime] = None,
+ end: Optional[datetime.datetime] = None,
+ **opts: Unpack[ApiParams]) -> List[SandboxMetrics]
+```
+
+Get the metrics of the sandbox specified by sandbox ID.
+
+**Arguments**:
+
+- `start`: Start time for the metrics, defaults to the start of the sandbox
+- `end`: End time for the metrics, defaults to the current time
+
+**Returns**:
+
+List of sandbox metrics containing CPU, memory and disk usage information
+
+
+### beta\_create
+
+```python
+@classmethod
+def beta_create(cls,
+ template: Optional[str] = None,
+ timeout: Optional[int] = None,
+ auto_pause: bool = False,
+ metadata: Optional[Dict[str, str]] = None,
+ envs: Optional[Dict[str, str]] = None,
+ secure: bool = True,
+ allow_internet_access: bool = True,
+ mcp: Optional[McpServer] = None,
+ **opts: Unpack[ApiParams]) -> Self
+```
+
+[BETA] This feature is in beta and may change in the future.
+
+Create a new sandbox.
+
+By default, the sandbox is created from the default `base` sandbox template.
+
+**Arguments**:
+
+- `template`: Sandbox template name or ID
+- `timeout`: Timeout for the sandbox in **seconds**, default to 300 seconds. The 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.
+- `auto_pause`: Automatically pause the sandbox after the timeout expires. Defaults to `False`.
+- `metadata`: Custom metadata for the sandbox
+- `envs`: Custom environment variables for the sandbox
+- `secure`: Envd is secured with access token and cannot be used without it, defaults to `True`.
+- `allow_internet_access`: Allow sandbox to access the internet, defaults to `True`.
+- `mcp`: MCP server to enable in the sandbox
+
+**Returns**:
+
+A Sandbox instance for the new sandbox
+Use this method instead of using the constructor to create a new sandbox.
+
+
+### beta\_pause
+
+```python
+@overload
+def beta_pause(**opts: Unpack[ApiParams]) -> None
+```
+
+[BETA] This feature is in beta and may change in the future.
+
+Pause the sandbox.
+
+
+### beta\_pause
+
+```python
+@overload
+@classmethod
+def beta_pause(cls, sandbox_id: str, **opts: Unpack[ApiParams]) -> None
+```
+
+[BETA] This feature is in beta and may change in the future.
+
+Pause the sandbox specified by sandbox ID.
+
+**Arguments**:
+
+- `sandbox_id`: Sandbox ID
+
+
+### beta\_pause
+
+```python
+@class_method_variant("_cls_pause")
+def beta_pause(**opts: Unpack[ApiParams]) -> None
+```
+
+[BETA] This feature is in beta and may change in the future.
+
+Pause the sandbox.
+
+**Returns**:
+
+Sandbox ID that can be used to resume the sandbox
+
+
+### get\_mcp\_token
+
+```python
+def get_mcp_token() -> Optional[str]
+```
+
+Get the MCP token for the sandbox.
+
+**Returns**:
+
+MCP token for the sandbox, or None if MCP is not enabled.
+
+
+
+
+## SandboxPaginator
+
+```python
+class SandboxPaginator(SandboxPaginatorBase)
+```
+
+Paginator for listing sandboxes.
+
+**Example**:
+
+```python
+paginator = Sandbox.list()
+
+while paginator.has_next:
+ sandboxes = paginator.next_items()
+ print(sandboxes)
+```
+
+
+### next\_items
+
+```python
+def next_items() -> List[SandboxInfo]
+```
+
+Returns the next page of sandboxes.
+
+Call this method only if `has_next` is `True`, otherwise it will raise an exception.
+
+**Returns**:
+
+List of sandboxes
+
+
+
+
+## CommandHandle
+
+```python
+class CommandHandle()
+```
+
+Command execution handle.
+
+It provides methods for waiting for the command to finish, retrieving stdout/stderr, and killing the command.
+
+
+### pid
+
+```python
+@property
+def pid()
+```
+
+Command process ID.
+
+
+### \_\_iter\_\_
+
+```python
+def __iter__()
+```
+
+Iterate over the command output.
+
+**Returns**:
+
+Generator of command outputs
+
+
+### disconnect
+
+```python
+def disconnect() -> None
+```
+
+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
+
+```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
+```
+
+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**:
+
+- `on_pty`: Callback for pty output
+- `on_stdout`: Callback for stdout output
+- `on_stderr`: Callback for stderr output
+
+**Returns**:
+
+`CommandResult` result of command execution
+
+
+### kill
+
+```python
+def kill() -> bool
+```
+
+Kills the command.
+
+It uses `SIGKILL` signal to kill the command.
+
+**Returns**:
+
+Whether the command was killed successfully
+
+
+
+
+## Pty
+
+```python
+class Pty()
+```
+
+Module for interacting with PTYs (pseudo-terminals) in the sandbox.
+
+
+### kill
+
+```python
+def kill(pid: int, request_timeout: Optional[float] = None) -> bool
+```
+
+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
+
+
+### send\_stdin
+
+```python
+def send_stdin(pid: int,
+ data: bytes,
+ request_timeout: Optional[float] = None) -> None
+```
+
+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**
+
+
+### create
+
+```python
+def create(size: PtySize,
+ user: Optional[Username] = None,
+ cwd: Optional[str] = None,
+ envs: Optional[Dict[str, str]] = None,
+ timeout: Optional[float] = 60,
+ request_timeout: Optional[float] = None) -> CommandHandle
+```
+
+Start a new PTY (pseudo-terminal).
+
+**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**
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+Handle to interact with the PTY
+
+
+### resize
+
+```python
+def resize(pid: int,
+ size: PtySize,
+ request_timeout: Optional[float] = None) -> None
+```
+
+Resize PTY.
+
+Call this when the terminal window is resized and the number of columns and rows has changed.
+
+**Arguments**:
+
+- `pid`: Process ID of the PTY
+- `size`: New size of the PTY
+- `request_timeout`: Timeout for the request in **seconds**s
+
+
+
+
+## Commands
+
+```python
+class Commands()
+```
+
+Module for executing commands in the sandbox.
+
+
+### list
+
+```python
+def list(request_timeout: Optional[float] = None) -> List[ProcessInfo]
+```
+
+Lists all running commands and PTY sessions.
+
+**Arguments**:
+
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+List of running commands and PTY sessions
+
+
+### kill
+
+```python
+def kill(pid: int, request_timeout: Optional[float] = None) -> bool
+```
+
+Kills a running command specified by its process ID.
+
+It uses `SIGKILL` signal to kill the command.
+
+**Arguments**:
+
+- `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**
+
+**Returns**:
+
+`True` if the command was killed, `False` if the command was not found
+
+
+### send\_stdin
+
+```python
+def send_stdin(pid: int, data: str, request_timeout: Optional[float] = None)
+```
+
+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**
+
+
+
+### run
+
+```python
+@overload
+def run(cmd: str,
+ background: Union[Literal[False], None] = None,
+ envs: Optional[Dict[str, str]] = None,
+ user: Optional[Username] = None,
+ cwd: Optional[str] = None,
+ on_stdout: Optional[Callable[[str], None]] = None,
+ on_stderr: Optional[Callable[[str], None]] = None,
+ stdin: Optional[bool] = None,
+ timeout: Optional[float] = 60,
+ request_timeout: Optional[float] = None) -> CommandResult
+```
+
+Start a new command and wait until it finishes executing.
+
+**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
+- `stdin`: If `True`, the command will have a stdin stream that you can send data to using `sandbox.commands.send_stdin()`
+- `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**:
+
+`CommandResult` result of the command execution
+
+
+### run
+
+```python
+@overload
+def run(cmd: str,
+ background: Literal[True],
+ envs: Optional[Dict[str, str]] = None,
+ user: Optional[Username] = None,
+ cwd: Optional[str] = None,
+ on_stdout: None = None,
+ on_stderr: None = None,
+ stdin: Optional[bool] = None,
+ timeout: Optional[float] = 60,
+ request_timeout: Optional[float] = None) -> CommandHandle
+```
+
+Start a new command and return a handle to interact with it.
+
+**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
+- `stdin`: If `True`, the command will have a stdin stream that you can send data to using `sandbox.commands.send_stdin()`
+- `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 connect(pid: int,
+ timeout: Optional[float] = 60,
+ request_timeout: Optional[float] = None)
+```
+
+Connects to a running command.
+
+You can use `CommandHandle.wait()` to wait for the command to finish and get execution results.
+
+**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
+- `request_timeout`: Timeout for the request in **seconds**
+
+**Returns**:
+
+`CommandHandle` handle to interact with the running command
+
+
+
+
+## SandboxApi
+
+```python
+class SandboxApi(SandboxBase)
+```
+
+
+### list
+
+```python
+@staticmethod
+def list(query: Optional[SandboxQuery] = None,
+ limit: Optional[int] = None,
+ next_token: Optional[str] = None,
+ **opts: Unpack[ApiParams]) -> SandboxPaginator
+```
+
+List all running sandboxes.
+
+**Arguments**:
+
+- `query`: Filter the list of sandboxes by metadata or state, e.g. `SandboxListQuery(metadata={"key": "value"})` or `SandboxListQuery(state=[SandboxState.RUNNING])`
+- `limit`: Maximum number of sandboxes to return per page
+- `next_token`: Token for pagination
+
+**Returns**:
+
+List of running sandboxes
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template/page.mdx
new file mode 100644
index 000000000..af6b04f11
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template/page.mdx
@@ -0,0 +1,1609 @@
+
+
+
+## TemplateBuilder
+
+```python
+class TemplateBuilder()
+```
+
+Builder class for adding instructions to an E2B template.
+
+All methods return self to allow method chaining.
+
+
+### copy
+
+```python
+def copy(src: Union[Union[str, Path], List[Union[str, Path]]],
+ dest: Union[str, Path],
+ force_upload: Optional[Literal[True]] = None,
+ user: Optional[str] = None,
+ mode: Optional[int] = None,
+ resolve_symlinks: Optional[bool] = None) -> "TemplateBuilder"
+```
+
+Copy files or directories from the local filesystem into the template.
+
+**Arguments**:
+
+- `src`: Source file(s) or directory path(s) to copy
+- `dest`: Destination path in the template
+- `force_upload`: Force upload even if files are cached
+- `user`: User and optionally group (user:group) to own the files
+- `mode`: File permissions in octal format (e.g., 0o755)
+- `resolve_symlinks`: Whether to resolve symlinks
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.copy('requirements.txt', '/home/user/')
+template.copy(['app.py', 'config.py'], '/app/', mode=0o755)
+```
+
+
+### copy\_items
+
+```python
+def copy_items(items: List[CopyItem]) -> "TemplateBuilder"
+```
+
+Copy multiple files or directories using a list of copy items.
+
+**Arguments**:
+
+- `items`: List of CopyItem dictionaries with src, dest, and optional parameters
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.copy_items([
+ {'src': 'app.py', 'dest': '/app/'},
+ {'src': 'config.py', 'dest': '/app/', 'mode': 0o644}
+])
+```
+
+
+### remove
+
+```python
+def remove(path: Union[Union[str, Path], List[Union[str, Path]]],
+ force: bool = False,
+ recursive: bool = False,
+ user: Optional[str] = None) -> "TemplateBuilder"
+```
+
+Remove files or directories in the template.
+
+**Arguments**:
+
+- `path`: File(s) or directory path(s) to remove
+- `force`: Force removal without prompting
+- `recursive`: Remove directories recursively
+- `user`: User to run the command as
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.remove('/tmp/cache', recursive=True, force=True)
+template.remove('/tmp/cache', recursive=True, force=True, user='root')
+```
+
+
+### rename
+
+```python
+def rename(src: Union[str, Path],
+ dest: Union[str, Path],
+ force: bool = False,
+ user: Optional[str] = None) -> "TemplateBuilder"
+```
+
+Rename or move a file or directory in the template.
+
+**Arguments**:
+
+- `src`: Source path
+- `dest`: Destination path
+- `force`: Force rename without prompting
+- `user`: User to run the command as
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.rename('/tmp/old.txt', '/tmp/new.txt')
+template.rename('/tmp/old.txt', '/tmp/new.txt', user='root')
+```
+
+
+### make\_dir
+
+```python
+def make_dir(path: Union[Union[str, Path], List[Union[str, Path]]],
+ mode: Optional[int] = None,
+ user: Optional[str] = None) -> "TemplateBuilder"
+```
+
+Create directory(ies) in the template.
+
+**Arguments**:
+
+- `path`: Directory path(s) to create
+- `mode`: Directory permissions in octal format (e.g., 0o755)
+- `user`: User to run the command as
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.make_dir('/app/data', mode=0o755)
+template.make_dir(['/app/logs', '/app/cache'])
+template.make_dir('/app/data', mode=0o755, user='root')
+```
+
+
+### make\_symlink
+
+```python
+def make_symlink(src: Union[str, Path],
+ dest: Union[str, Path],
+ user: Optional[str] = None,
+ force: bool = False) -> "TemplateBuilder"
+```
+
+Create a symbolic link in the template.
+
+**Arguments**:
+
+- `src`: Source path (target of the symlink)
+- `dest`: Destination path (location of the symlink)
+- `user`: User to run the command as
+- `force`: Force symlink without prompting
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.make_symlink('/usr/bin/python3', '/usr/bin/python')
+template.make_symlink('/usr/bin/python3', '/usr/bin/python', user='root')
+template.make_symlink('/usr/bin/python3', '/usr/bin/python', force=True)
+```
+
+
+### run\_cmd
+
+```python
+def run_cmd(command: Union[str, List[str]],
+ user: Optional[str] = None) -> "TemplateBuilder"
+```
+
+Run a shell command during template build.
+
+**Arguments**:
+
+- `command`: Command string or list of commands to run (joined with &&)
+- `user`: User to run the command as
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.run_cmd('apt-get update')
+template.run_cmd(['pip install numpy', 'pip install pandas'])
+template.run_cmd('apt-get install vim', user='root')
+```
+
+
+### set\_workdir
+
+```python
+def set_workdir(workdir: Union[str, Path]) -> "TemplateBuilder"
+```
+
+Set the working directory for subsequent commands in the template.
+
+**Arguments**:
+
+- `workdir`: Path to set as the working directory
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.set_workdir('/app')
+```
+
+
+### set\_user
+
+```python
+def set_user(user: str) -> "TemplateBuilder"
+```
+
+Set the user for subsequent commands in the template.
+
+**Arguments**:
+
+- `user`: Username to set
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.set_user('root')
+```
+
+
+### pip\_install
+
+```python
+def pip_install(packages: Optional[Union[str, List[str]]] = None,
+ g: bool = True) -> "TemplateBuilder"
+```
+
+Install Python packages using pip.
+
+**Arguments**:
+
+- `packages`: Package name(s) to install. If None, runs 'pip install .' in the current directory
+- `g`: Install packages globally (default: True). If False, installs for user only
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.pip_install('numpy')
+template.pip_install(['pandas', 'scikit-learn'])
+template.pip_install('numpy', g=False) # Install for user only
+template.pip_install() # Installs from current directory
+```
+
+
+### npm\_install
+
+```python
+def npm_install(packages: Optional[Union[str, List[str]]] = None,
+ g: Optional[bool] = False,
+ dev: Optional[bool] = False) -> "TemplateBuilder"
+```
+
+Install Node.js packages using npm.
+
+**Arguments**:
+
+- `packages`: Package name(s) to install. If None, installs from package.json
+- `g`: Install packages globally
+- `dev`: Install packages as dev dependencies
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.npm_install('express')
+template.npm_install(['lodash', 'axios'])
+template.npm_install('typescript', g=True)
+template.npm_install() # Installs from package.json
+```
+
+
+### bun\_install
+
+```python
+def bun_install(packages: Optional[Union[str, List[str]]] = None,
+ g: Optional[bool] = False,
+ dev: Optional[bool] = False) -> "TemplateBuilder"
+```
+
+Install Bun packages using bun.
+
+**Arguments**:
+
+- `packages`: Package name(s) to install. If None, installs from package.json
+- `g`: Install packages globally
+- `dev`: Install packages as dev dependencies
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.bun_install('express')
+template.bun_install(['lodash', 'axios'])
+template.bun_install('tsx', g=True)
+template.bun_install('typescript', dev=True)
+template.bun_install() // Installs from package.json
+```
+
+
+### apt\_install
+
+```python
+def apt_install(packages: Union[str, List[str]],
+ no_install_recommends: bool = False) -> "TemplateBuilder"
+```
+
+Install system packages using apt-get.
+
+**Arguments**:
+
+- `packages`: Package name(s) to install
+- `no_install_recommends`: Whether to install recommended packages
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.apt_install('vim')
+template.apt_install(['git', 'curl', 'wget'])
+```
+
+
+### add\_mcp\_server
+
+```python
+def add_mcp_server(servers: Union[str, List[str]]) -> "TemplateBuilder"
+```
+
+Install MCP servers using mcp-gateway.
+
+Note: Requires a base image with mcp-gateway pre-installed (e.g., mcp-gateway).
+
+**Arguments**:
+
+- `servers`: MCP server name(s)
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.add_mcp_server('exa')
+template.add_mcp_server(['brave', 'firecrawl', 'duckduckgo'])
+```
+
+
+### git\_clone
+
+```python
+def git_clone(url: str,
+ path: Optional[Union[str, Path]] = None,
+ branch: Optional[str] = None,
+ depth: Optional[int] = None,
+ user: Optional[str] = None) -> "TemplateBuilder"
+```
+
+Clone a git repository into the template.
+
+**Arguments**:
+
+- `url`: Git repository URL
+- `path`: Destination path for the clone
+- `branch`: Branch to clone
+- `depth`: Clone depth for shallow clones
+- `user`: User to run the command as
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.git_clone('https://github.com/user/repo.git', '/app/repo')
+template.git_clone('https://github.com/user/repo.git', branch='main', depth=1)
+template.git_clone('https://github.com/user/repo.git', '/app/repo', user='root')
+```
+
+
+### beta\_dev\_container\_prebuild
+
+```python
+def beta_dev_container_prebuild(
+ devcontainer_directory: Union[str, Path]) -> "TemplateBuilder"
+```
+
+Prebuild a devcontainer from the specified directory during the build process.
+
+**Arguments**:
+
+- `devcontainer_directory`: Path to the devcontainer directory
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.git_clone('https://myrepo.com/project.git', '/my-devcontainer')
+template.beta_dev_container_prebuild('/my-devcontainer')
+```
+
+
+### beta\_set\_dev\_container\_start
+
+```python
+def beta_set_dev_container_start(
+ devcontainer_directory: Union[str, Path]) -> "TemplateFinal"
+```
+
+Start a devcontainer from the specified directory and set it as the start command.
+
+This method returns `TemplateFinal`, which means it must be the last method in the chain.
+
+**Arguments**:
+
+- `devcontainer_directory`: Path to the devcontainer directory
+
+**Returns**:
+
+`TemplateFinal` class
+Example
+```python
+template.git_clone('https://myrepo.com/project.git', '/my-devcontainer')
+template.beta_set_devcontainer_start('/my-devcontainer')
+
+template.git_clone('https://myrepo.com/project.git', '/my-devcontainer')
+template.beta_dev_container_prebuild('/my-devcontainer')
+template.beta_set_dev_container_start('/my-devcontainer')
+```
+
+
+### set\_envs
+
+```python
+def set_envs(envs: Dict[str, str]) -> "TemplateBuilder"
+```
+
+Set environment variables in the template.
+
+**Arguments**:
+
+- `envs`: Dictionary of environment variable names and values
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.set_envs({'NODE_ENV': 'production', 'PORT': '8080'})
+```
+
+
+### skip\_cache
+
+```python
+def skip_cache() -> "TemplateBuilder"
+```
+
+Skip cache for all subsequent build instructions from this point.
+
+Call this before any instruction to force it and all following layers
+to be rebuilt, ignoring any cached layers.
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+template.skip_cache().run_cmd('apt-get update')
+```
+
+
+### set\_start\_cmd
+
+```python
+def set_start_cmd(start_cmd: str,
+ ready_cmd: Union[str, ReadyCmd]) -> "TemplateFinal"
+```
+
+Set the command to start when the sandbox launches and the ready check command.
+
+**Arguments**:
+
+- `start_cmd`: Command to run when the sandbox starts
+- `ready_cmd`: Command or ReadyCmd to check if the sandbox is ready
+
+**Returns**:
+
+`TemplateFinal` class
+Example
+```python
+template.set_start_cmd(
+ 'python app.py',
+ 'curl http://localhost:8000/health'
+)
+
+from e2b import wait_for_port, wait_for_url
+
+template.set_start_cmd(
+ 'python -m http.server 8000',
+ wait_for_port(8000)
+)
+
+template.set_start_cmd(
+ 'npm start',
+ wait_for_url('http://localhost:3000/health', 200)
+)
+```
+
+
+### set\_ready\_cmd
+
+```python
+def set_ready_cmd(ready_cmd: Union[str, ReadyCmd]) -> "TemplateFinal"
+```
+
+Set the command to check if the sandbox is ready.
+
+**Arguments**:
+
+- `ready_cmd`: Command or ReadyCmd to check if the sandbox is ready
+
+**Returns**:
+
+`TemplateFinal` class
+Example
+```python
+template.set_ready_cmd('curl http://localhost:8000/health')
+
+from e2b import wait_for_port, wait_for_file, wait_for_process
+
+template.set_ready_cmd(wait_for_port(3000))
+
+template.set_ready_cmd(wait_for_file('/tmp/ready'))
+
+template.set_ready_cmd(wait_for_process('nginx'))
+```
+
+
+## TemplateFinal
+
+```python
+class TemplateFinal()
+```
+
+Final template state after start/ready commands are set.
+
+
+## TemplateBase
+
+```python
+class TemplateBase()
+```
+
+Base class for building E2B sandbox templates.
+
+
+### \_\_init\_\_
+
+```python
+def __init__(file_context_path: Optional[Union[str, Path]] = None,
+ file_ignore_patterns: Optional[List[str]] = None)
+```
+
+Create a new template builder instance.
+
+**Arguments**:
+
+- `file_context_path`: Base path for resolving relative file paths in copy operations
+- `file_ignore_patterns`: List of glob patterns to ignore when copying files
+
+
+### skip\_cache
+
+```python
+def skip_cache() -> "TemplateBase"
+```
+
+Skip cache for all subsequent build instructions from this point.
+
+**Returns**:
+
+`TemplateBase` class
+Example
+```python
+template.skip_cache().from_python_image('3.11')
+```
+
+
+### from\_debian\_image
+
+```python
+def from_debian_image(variant: str = "stable") -> TemplateBuilder
+```
+
+Start template from a Debian base image.
+
+**Arguments**:
+
+- `variant`: Debian image variant
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_debian_image('bookworm')
+```
+
+
+### from\_ubuntu\_image
+
+```python
+def from_ubuntu_image(variant: str = "latest") -> TemplateBuilder
+```
+
+Start template from an Ubuntu base image.
+
+**Arguments**:
+
+- `variant`: Ubuntu image variant (default: 'latest')
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_ubuntu_image('24.04')
+```
+
+
+### from\_python\_image
+
+```python
+def from_python_image(version: str = "3") -> TemplateBuilder
+```
+
+Start template from a Python base image.
+
+**Arguments**:
+
+- `version`: Python version (default: '3')
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_python_image('3')
+```
+
+
+### from\_node\_image
+
+```python
+def from_node_image(variant: str = "lts") -> TemplateBuilder
+```
+
+Start template from a Node.js base image.
+
+**Arguments**:
+
+- `variant`: Node.js image variant (default: 'lts')
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_node_image('24')
+```
+
+
+### from\_bun\_image
+
+```python
+def from_bun_image(variant: str = "latest") -> TemplateBuilder
+```
+
+Start template from a Bun base image.
+
+**Arguments**:
+
+- `variant`: Bun image variant (default: 'latest')
+
+**Returns**:
+
+`TemplateBuilder` class
+
+
+### from\_base\_image
+
+```python
+def from_base_image() -> TemplateBuilder
+```
+
+Start template from the E2B base image (e2bdev/base:latest).
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_base_image()
+```
+
+
+### from\_image
+
+```python
+def from_image(image: str,
+ username: Optional[str] = None,
+ password: Optional[str] = None) -> TemplateBuilder
+```
+
+Start template from a Docker image.
+
+**Arguments**:
+
+- `image`: Docker image name (e.g., 'ubuntu:24.04')
+- `username`: Username for private registry authentication
+- `password`: Password for private registry authentication
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_image('python:3')
+
+Template().from_image('myregistry.com/myimage:latest', username='user', password='pass')
+```
+
+
+### from\_template
+
+```python
+def from_template(template: str) -> TemplateBuilder
+```
+
+Start template from an existing E2B template.
+
+**Arguments**:
+
+- `template`: E2B template ID or alias
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_template('my-base-template')
+```
+
+
+### from\_dockerfile
+
+```python
+def from_dockerfile(dockerfile_content_or_path: str) -> TemplateBuilder
+```
+
+Parse a Dockerfile and convert it to Template SDK format.
+
+**Arguments**:
+
+- `dockerfile_content_or_path`: Either the Dockerfile content as a string, or a path to a Dockerfile file
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_dockerfile('Dockerfile')
+Template().from_dockerfile('FROM python:3\nRUN pip install numpy')
+```
+
+
+### from\_aws\_registry
+
+```python
+def from_aws_registry(image: str, access_key_id: str, secret_access_key: str,
+ region: str) -> TemplateBuilder
+```
+
+Start template from an AWS ECR registry image.
+
+**Arguments**:
+
+- `image`: Docker image name from AWS ECR
+- `access_key_id`: AWS access key ID
+- `secret_access_key`: AWS secret access key
+- `region`: AWS region
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_aws_registry(
+ '123456789.dkr.ecr.us-west-2.amazonaws.com/myimage:latest',
+ access_key_id='AKIA...',
+ secret_access_key='...',
+ region='us-west-2'
+)
+```
+
+
+### from\_gcp\_registry
+
+```python
+def from_gcp_registry(
+ image: str, service_account_json: Union[str, dict]) -> TemplateBuilder
+```
+
+Start template from a GCP Artifact Registry or Container Registry image.
+
+**Arguments**:
+
+- `image`: Docker image name from GCP registry
+- `service_account_json`: Service account JSON string, dict, or path to JSON file
+
+**Returns**:
+
+`TemplateBuilder` class
+Example
+```python
+Template().from_gcp_registry(
+ 'gcr.io/myproject/myimage:latest',
+ service_account_json='path/to/service-account.json'
+)
+```
+
+
+### to\_json
+
+```python
+@staticmethod
+def to_json(template: "TemplateClass") -> str
+```
+
+Convert a template to JSON representation.
+
+**Arguments**:
+
+- `template`: The template to convert (TemplateBuilder or TemplateFinal instance)
+
+**Returns**:
+
+JSON string representation of the template
+Example
+```python
+template = Template().from_python_image('3').copy('app.py', '/app/')
+json_str = TemplateBase.to_json(template)
+```
+
+
+### to\_dockerfile
+
+```python
+@staticmethod
+def to_dockerfile(template: "TemplateClass") -> str
+```
+
+Convert a template to Dockerfile format.
+
+Note: Templates based on other E2B templates cannot be converted to Dockerfile.
+
+**Arguments**:
+
+- `template`: The template to convert (TemplateBuilder or TemplateFinal instance)
+
+**Raises**:
+
+- `ValueError`: If the template is based on another E2B template or has no base image
+Example
+```python
+template = Template().from_python_image('3').copy('app.py', '/app/')
+dockerfile = TemplateBase.to_dockerfile(template)
+```
+
+**Returns**:
+
+Dockerfile string representation
+
+
+
+
+## InstructionType
+
+```python
+class InstructionType(str, Enum)
+```
+
+Types of instructions that can be used in a template.
+
+
+## CopyItem
+
+```python
+class CopyItem(TypedDict)
+```
+
+Configuration for a single file/directory copy operation.
+
+
+## Instruction
+
+```python
+class Instruction(TypedDict)
+```
+
+Represents a single instruction in the template build process.
+
+
+## GenericDockerRegistry
+
+```python
+class GenericDockerRegistry(TypedDict)
+```
+
+Configuration for a generic Docker registry with basic authentication.
+
+
+## AWSRegistry
+
+```python
+class AWSRegistry(TypedDict)
+```
+
+Configuration for AWS Elastic Container Registry (ECR).
+
+
+## GCPRegistry
+
+```python
+class GCPRegistry(TypedDict)
+```
+
+Configuration for Google Container Registry (GCR) or Artifact Registry.
+
+
+## TemplateType
+
+```python
+class TemplateType(TypedDict)
+```
+
+Internal representation of a template for the E2B build API.
+
+
+## BuildInfo
+
+```python
+@dataclass
+class BuildInfo()
+```
+
+Information about a built template.
+
+
+
+Special step name for the finalization phase of template building.
+This is the last step that runs after all user-defined instructions.
+
+
+### FINALIZE\_STEP\_NAME
+
+Special step name for the base image phase of template building.
+This is the first step that sets up the base image.
+
+
+### BASE\_STEP\_NAME
+
+Stack trace depth for capturing caller information.
+
+Depth levels:
+1. TemplateClass
+2. Caller method (e.g., copy(), from_image(), etc.)
+
+This depth is used to determine the original caller's location
+for stack traces.
+
+
+### STACK\_TRACE\_DEPTH
+
+Default setting for whether to resolve symbolic links when copying files.
+When False, symlinks are copied as symlinks rather than following them.
+
+
+
+
+## ReadyCmd
+
+```python
+class ReadyCmd()
+```
+
+Wrapper class for ready check commands.
+
+
+### wait\_for\_port
+
+```python
+def wait_for_port(port: int)
+```
+
+Wait for a port to be listening.
+
+Uses `ss` command to check if a port is open and listening.
+
+**Arguments**:
+
+- `port`: Port number to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the port
+Example
+```python
+from e2b import Template, wait_for_port
+
+template = (
+ Template()
+ .from_python_image()
+ .set_start_cmd('python -m http.server 8000', wait_for_port(8000))
+)
+```
+
+
+### wait\_for\_url
+
+```python
+def wait_for_url(url: str, status_code: int = 200)
+```
+
+Wait for a URL to return a specific HTTP status code.
+
+Uses `curl` to make HTTP requests and check the response status.
+
+**Arguments**:
+
+- `url`: URL to check (e.g., 'http://localhost:3000/health')
+- `status_code`: Expected HTTP status code (default: 200)
+
+**Returns**:
+
+ReadyCmd that checks the URL
+Example
+```python
+from e2b import Template, wait_for_url
+
+template = (
+ Template()
+ .from_node_image()
+ .set_start_cmd('npm start', wait_for_url('http://localhost:3000/health'))
+)
+```
+
+
+### wait\_for\_process
+
+```python
+def wait_for_process(process_name: str)
+```
+
+Wait for a process with a specific name to be running.
+
+Uses `pgrep` to check if a process exists.
+
+**Arguments**:
+
+- `process_name`: Name of the process to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the process
+Example
+```python
+from e2b import Template, wait_for_process
+
+template = (
+ Template()
+ .from_base_image()
+ .set_start_cmd('./my-daemon', wait_for_process('my-daemon'))
+)
+```
+
+
+### wait\_for\_file
+
+```python
+def wait_for_file(filename: str)
+```
+
+Wait for a file to exist.
+
+Uses shell test command to check file existence.
+
+**Arguments**:
+
+- `filename`: Path to the file to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the file
+Example
+```python
+from e2b import Template, wait_for_file
+
+template = (
+ Template()
+ .from_base_image()
+ .set_start_cmd('./init.sh', wait_for_file('/tmp/ready'))
+)
+```
+
+
+### wait\_for\_timeout
+
+```python
+def wait_for_timeout(timeout: int)
+```
+
+Wait for a specified timeout before considering the sandbox ready.
+
+Uses `sleep` command to wait for a fixed duration.
+
+**Arguments**:
+
+- `timeout`: Time to wait in **milliseconds** (minimum: 1000ms / 1 second)
+
+**Returns**:
+
+ReadyCmd that waits for the specified duration
+Example
+```python
+from e2b import Template, wait_for_timeout
+
+template = (
+ Template()
+ .from_node_image()
+ .set_start_cmd('npm start', wait_for_timeout(5000)) # Wait 5 seconds
+)
+```
+
+
+
+
+## DockerfFileFinalParserInterface
+
+```python
+class DockerfFileFinalParserInterface(Protocol)
+```
+
+Protocol defining the final interface for Dockerfile parsing callbacks.
+
+
+## DockerfileParserInterface
+
+```python
+class DockerfileParserInterface(Protocol)
+```
+
+Protocol defining the interface for Dockerfile parsing callbacks.
+
+
+### run\_cmd
+
+```python
+def run_cmd(command: Union[str, List[str]],
+ user: Optional[str] = None) -> "DockerfileParserInterface"
+```
+
+Handle RUN instruction.
+
+
+### copy
+
+```python
+def copy(src: Union[str, List[CopyItem]],
+ dest: Optional[str] = None,
+ force_upload: Optional[Literal[True]] = None,
+ resolve_symlinks: Optional[bool] = None,
+ user: Optional[str] = None,
+ mode: Optional[int] = None) -> "DockerfileParserInterface"
+```
+
+Handle COPY instruction.
+
+
+### set\_workdir
+
+```python
+def set_workdir(workdir: str) -> "DockerfileParserInterface"
+```
+
+Handle WORKDIR instruction.
+
+
+### set\_user
+
+```python
+def set_user(user: str) -> "DockerfileParserInterface"
+```
+
+Handle USER instruction.
+
+
+### set\_envs
+
+```python
+def set_envs(envs: Dict[str, str]) -> "DockerfileParserInterface"
+```
+
+Handle ENV instruction.
+
+
+### set\_start\_cmd
+
+```python
+def set_start_cmd(start_cmd: str,
+ ready_cmd: str) -> "DockerfFileFinalParserInterface"
+```
+
+Handle CMD/ENTRYPOINT instruction.
+
+
+### parse\_dockerfile
+
+```python
+def parse_dockerfile(dockerfile_content_or_path: str,
+ template_builder: DockerfileParserInterface) -> str
+```
+
+Parse a Dockerfile and convert it to Template SDK format.
+
+**Arguments**:
+
+- `dockerfile_content_or_path`: Either the Dockerfile content as a string, or a path to a Dockerfile file
+- `template_builder`: Interface providing template builder methods
+
+**Raises**:
+
+- `ValueError`: If the Dockerfile is invalid or unsupported
+
+**Returns**:
+
+The base image from the Dockerfile
+
+
+
+
+## LogEntry
+
+```python
+@dataclass
+class LogEntry()
+```
+
+Represents a single log entry from the template build process.
+
+
+## LogEntryStart
+
+```python
+@dataclass
+class LogEntryStart(LogEntry)
+```
+
+Special log entry indicating the start of a build process.
+
+
+## LogEntryEnd
+
+```python
+@dataclass
+class LogEntryEnd(LogEntry)
+```
+
+Special log entry indicating the end of a build process.
+
+
+### TIMER\_UPDATE\_INTERVAL\_MS
+
+Default minimum log level to display.
+
+
+### DEFAULT\_LEVEL
+
+Colored labels for each log level.
+
+
+### levels
+
+Numeric ordering of log levels for comparison (lower = less severe).
+
+
+### set\_interval
+
+```python
+def set_interval(func, interval)
+```
+
+Returns a stop function that can be called to cancel the interval.
+
+Similar to JavaScript's setInterval.
+
+**Arguments**:
+
+- `func`: Function to execute at each interval
+- `interval`: Interval duration in **seconds**
+
+**Returns**:
+
+Stop function that can be called to cancel the interval
+
+
+### default\_build\_logger
+
+```python
+def default_build_logger(
+ min_level: Optional[LogEntryLevel] = None
+) -> Callable[[LogEntry], None]
+```
+
+Create a default build logger with animated timer display.
+
+**Arguments**:
+
+- `min_level`: Minimum log level to display (default: 'info')
+
+**Returns**:
+
+Logger function that accepts LogEntry instances
+Example
+```python
+from e2b import Template, default_build_logger
+
+template = Template().from_python_image()
+
+```
+
+
+
+
+### read\_dockerignore
+
+```python
+def read_dockerignore(context_path: str) -> List[str]
+```
+
+Read and parse a .dockerignore file.
+
+**Arguments**:
+
+- `context_path`: Directory path containing the .dockerignore file
+
+**Returns**:
+
+Array of ignore patterns (empty lines and comments are filtered out)
+
+
+### normalize\_path
+
+```python
+def normalize_path(path: str) -> str
+```
+
+Normalize path separators to forward slashes for glob patterns (glob expects / even on Windows).
+
+**Arguments**:
+
+- `path`: The path to normalize
+
+**Returns**:
+
+The normalized path
+
+
+### get\_all\_files\_in\_path
+
+```python
+def get_all_files_in_path(src: str,
+ context_path: str,
+ ignore_patterns: List[str],
+ include_directories: bool = True) -> List[str]
+```
+
+Get all files for a given path and ignore patterns.
+
+**Arguments**:
+
+- `src`: Path to the source directory
+- `context_path`: Base directory for resolving relative paths
+- `ignore_patterns`: Ignore patterns
+- `include_directories`: Whether to include directories
+
+**Returns**:
+
+Array of files
+
+
+### calculate\_files\_hash
+
+```python
+def calculate_files_hash(src: str, dest: str, context_path: str,
+ ignore_patterns: List[str], resolve_symlinks: bool,
+ stack_trace: Optional[TracebackType]) -> str
+```
+
+Calculate a hash of files being copied to detect changes for cache invalidation.
+
+The hash includes file content, metadata (mode, size), and relative paths.
+Note: uid, gid, and mtime are excluded to ensure stable hashes across environments.
+
+**Arguments**:
+
+- `src`: Source path pattern for files to copy
+- `dest`: Destination path where files will be copied
+- `context_path`: Base directory for resolving relative paths
+- `ignore_patterns`: Glob patterns to ignore
+- `resolve_symlinks`: Whether to resolve symbolic links when hashing
+- `stack_trace`: Optional stack trace for error reporting
+
+**Raises**:
+
+- `ValueError`: If no files match the source pattern
+
+**Returns**:
+
+Hex string hash of all files
+
+
+### tar\_file\_stream
+
+```python
+def tar_file_stream(file_name: str, file_context_path: str,
+ ignore_patterns: List[str],
+ resolve_symlinks: bool) -> io.BytesIO
+```
+
+Create a tar stream of files matching a pattern.
+
+**Arguments**:
+
+- `file_name`: Glob pattern for files to include
+- `file_context_path`: Base directory for resolving file paths
+- `ignore_patterns`: Ignore patterns
+- `resolve_symlinks`: Whether to resolve symbolic links
+
+**Returns**:
+
+Tar stream
+
+
+### strip\_ansi\_escape\_codes
+
+```python
+def strip_ansi_escape_codes(text: str) -> str
+```
+
+Strip ANSI escape codes from a string.
+
+Source: https://github.com/chalk/ansi-regex/blob/main/index.js
+
+**Arguments**:
+
+- `text`: String with ANSI escape codes
+
+**Returns**:
+
+String without ANSI escape codes
+
+
+### get\_caller\_frame
+
+```python
+def get_caller_frame(depth: int) -> Optional[FrameType]
+```
+
+Get the caller's stack frame at a specific depth.
+
+This is used to provide better error messages and debugging information
+by tracking where template methods were called from in user code.
+
+**Arguments**:
+
+- `depth`: The depth of the stack trace to retrieve
+
+**Returns**:
+
+The caller frame, or None if not available
+
+
+### get\_caller\_directory
+
+```python
+def get_caller_directory(depth: int) -> Optional[str]
+```
+
+Get the directory of the caller at a specific stack depth.
+
+This is used to determine the file_context_path when creating a template,
+so file paths are resolved relative to the user's template file location.
+
+**Arguments**:
+
+- `depth`: The depth of the stack trace
+
+**Returns**:
+
+The caller's directory path, or None if not available
+
+
+### pad\_octal
+
+```python
+def pad_octal(mode: int) -> str
+```
+
+Convert a numeric file mode to a zero-padded octal string.
+
+**Arguments**:
+
+- `mode`: File mode as a number (e.g., 493 for 0o755)
+
+**Returns**:
+
+Zero-padded 4-digit octal string (e.g., "0755")
+Example
+```python
+pad_octal(0o755) # Returns "0755"
+pad_octal(0o644) # Returns "0644"
+```
+
+
+### get\_build\_step\_index
+
+```python
+def get_build_step_index(step: str, stack_traces_length: int) -> int
+```
+
+Get the array index for a build step based on its name.
+
+Special steps:
+- BASE_STEP_NAME: Returns 0 (first step)
+- FINALIZE_STEP_NAME: Returns the last index
+- Numeric strings: Converted to number
+
+**Arguments**:
+
+- `step`: Build step name or number as string
+- `stack_traces_length`: Total number of stack traces (used for FINALIZE_STEP_NAME)
+
+**Returns**:
+
+Index for the build step
+
+
+### read\_gcp\_service\_account\_json
+
+```python
+def read_gcp_service_account_json(context_path: str,
+ path_or_content: Union[str, dict]) -> str
+```
+
+Read GCP service account JSON from a file or object.
+
+**Arguments**:
+
+- `context_path`: Base directory for resolving relative file paths
+- `path_or_content`: Either a path to a JSON file or a service account object
+
+**Returns**:
+
+Service account JSON as a string
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/logger/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/logger/page.mdx
new file mode 100644
index 000000000..4d41b149b
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/logger/page.mdx
@@ -0,0 +1,93 @@
+
+
+
+## LogEntry
+
+```python
+@dataclass
+class LogEntry()
+```
+
+Represents a single log entry from the template build process.
+
+
+## LogEntryStart
+
+```python
+@dataclass
+class LogEntryStart(LogEntry)
+```
+
+Special log entry indicating the start of a build process.
+
+
+## LogEntryEnd
+
+```python
+@dataclass
+class LogEntryEnd(LogEntry)
+```
+
+Special log entry indicating the end of a build process.
+
+
+### TIMER\_UPDATE\_INTERVAL\_MS
+
+Default minimum log level to display.
+
+
+### DEFAULT\_LEVEL
+
+Colored labels for each log level.
+
+
+### levels
+
+Numeric ordering of log levels for comparison (lower = less severe).
+
+
+### set\_interval
+
+```python
+def set_interval(func, interval)
+```
+
+Returns a stop function that can be called to cancel the interval.
+
+Similar to JavaScript's setInterval.
+
+**Arguments**:
+
+- `func`: Function to execute at each interval
+- `interval`: Interval duration in **seconds**
+
+**Returns**:
+
+Stop function that can be called to cancel the interval
+
+
+### default\_build\_logger
+
+```python
+def default_build_logger(
+ min_level: Optional[LogEntryLevel] = None
+) -> Callable[[LogEntry], None]
+```
+
+Create a default build logger with animated timer display.
+
+**Arguments**:
+
+- `min_level`: Minimum log level to display (default: 'info')
+
+**Returns**:
+
+Logger function that accepts LogEntry instances
+Example
+```python
+from e2b import Template, default_build_logger
+
+template = Template().from_python_image()
+
+```
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/page.mdx
new file mode 100644
index 000000000..704abfa0b
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/page.mdx
@@ -0,0 +1,140 @@
+
+
+
+## AsyncTemplate
+
+```python
+class AsyncTemplate(TemplateBase)
+```
+
+Asynchronous template builder for E2B sandboxes.
+
+
+### build
+
+```python
+@staticmethod
+async def build(template: TemplateClass,
+ alias: str,
+ cpu_count: int = 2,
+ memory_mb: int = 1024,
+ skip_cache: bool = False,
+ on_build_logs: Optional[Callable[[LogEntry], None]] = None,
+ api_key: Optional[str] = None,
+ domain: Optional[str] = None) -> BuildInfo
+```
+
+Build and deploy a template to E2B infrastructure.
+
+**Arguments**:
+
+- `template`: The template to build
+- `alias`: Alias name for the template
+- `cpu_count`: Number of CPUs allocated to the sandbox
+- `memory_mb`: Amount of memory in MB allocated to the sandbox
+- `skip_cache`: If True, forces a complete rebuild ignoring cache
+- `on_build_logs`: Callback function to receive build logs during the build process
+- `api_key`: E2B API key for authentication
+- `domain`: Domain of the E2B API
+Example
+```python
+from e2b import AsyncTemplate
+
+template = (
+ AsyncTemplate()
+ .from_python_image('3')
+ .copy('requirements.txt', '/home/user/')
+ .run_cmd('pip install -r /home/user/requirements.txt')
+)
+
+await AsyncTemplate.build(
+ template,
+ alias='my-python-env',
+ cpu_count=2,
+ memory_mb=1024
+)
+```
+
+
+### build\_in\_background
+
+```python
+@staticmethod
+async def build_in_background(template: TemplateClass,
+ alias: str,
+ cpu_count: int = 2,
+ memory_mb: int = 1024,
+ skip_cache: bool = False,
+ on_build_logs: Optional[Callable[[LogEntry],
+ None]] = None,
+ api_key: Optional[str] = None,
+ domain: Optional[str] = None) -> BuildInfo
+```
+
+Build and deploy a template to E2B infrastructure without waiting for completion.
+
+**Arguments**:
+
+- `template`: The template to build
+- `alias`: Alias name for the template
+- `cpu_count`: Number of CPUs allocated to the sandbox
+- `memory_mb`: Amount of memory in MB allocated to the sandbox
+- `skip_cache`: If True, forces a complete rebuild ignoring cache
+- `api_key`: E2B API key for authentication
+- `domain`: Domain of the E2B API
+
+**Returns**:
+
+BuildInfo containing the template ID and build ID
+Example
+```python
+from e2b import AsyncTemplate
+
+template = (
+ AsyncTemplate()
+ .from_python_image('3')
+ .run_cmd('echo "test"')
+ .set_start_cmd('echo "Hello"', 'sleep 1')
+)
+
+build_info = await AsyncTemplate.build_in_background(
+ template,
+ alias='my-python-env',
+ cpu_count=2,
+ memory_mb=1024
+)
+```
+
+
+### get\_build\_status
+
+```python
+@staticmethod
+async def get_build_status(build_info: BuildInfo,
+ logs_offset: int = 0,
+ api_key: Optional[str] = None,
+ domain: Optional[str] = None)
+```
+
+Get the status of a build.
+
+**Arguments**:
+
+- `build_info`: Build identifiers returned from build_in_background
+- `logs_offset`: Offset for fetching logs
+- `api_key`: E2B API key for authentication
+- `domain`: Domain of the E2B API
+
+**Returns**:
+
+TemplateBuild containing the build status and logs
+Example
+```python
+from e2b import AsyncTemplate
+
+build_info = await AsyncTemplate.build_in_background(template, alias='my-template')
+status = await AsyncTemplate.get_build_status(build_info, logs_offset=0)
+```
+
+
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/readycmd/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/readycmd/page.mdx
new file mode 100644
index 000000000..2116be854
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_async/readycmd/page.mdx
@@ -0,0 +1,157 @@
+
+
+
+## ReadyCmd
+
+```python
+class ReadyCmd()
+```
+
+Wrapper class for ready check commands.
+
+
+### wait\_for\_port
+
+```python
+def wait_for_port(port: int)
+```
+
+Wait for a port to be listening.
+
+Uses `ss` command to check if a port is open and listening.
+
+**Arguments**:
+
+- `port`: Port number to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the port
+Example
+```python
+from e2b import Template, wait_for_port
+
+template = (
+ Template()
+ .from_python_image()
+ .set_start_cmd('python -m http.server 8000', wait_for_port(8000))
+)
+```
+
+
+### wait\_for\_url
+
+```python
+def wait_for_url(url: str, status_code: int = 200)
+```
+
+Wait for a URL to return a specific HTTP status code.
+
+Uses `curl` to make HTTP requests and check the response status.
+
+**Arguments**:
+
+- `url`: URL to check (e.g., 'http://localhost:3000/health')
+- `status_code`: Expected HTTP status code (default: 200)
+
+**Returns**:
+
+ReadyCmd that checks the URL
+Example
+```python
+from e2b import Template, wait_for_url
+
+template = (
+ Template()
+ .from_node_image()
+ .set_start_cmd('npm start', wait_for_url('http://localhost:3000/health'))
+)
+```
+
+
+### wait\_for\_process
+
+```python
+def wait_for_process(process_name: str)
+```
+
+Wait for a process with a specific name to be running.
+
+Uses `pgrep` to check if a process exists.
+
+**Arguments**:
+
+- `process_name`: Name of the process to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the process
+Example
+```python
+from e2b import Template, wait_for_process
+
+template = (
+ Template()
+ .from_base_image()
+ .set_start_cmd('./my-daemon', wait_for_process('my-daemon'))
+)
+```
+
+
+### wait\_for\_file
+
+```python
+def wait_for_file(filename: str)
+```
+
+Wait for a file to exist.
+
+Uses shell test command to check file existence.
+
+**Arguments**:
+
+- `filename`: Path to the file to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the file
+Example
+```python
+from e2b import Template, wait_for_file
+
+template = (
+ Template()
+ .from_base_image()
+ .set_start_cmd('./init.sh', wait_for_file('/tmp/ready'))
+)
+```
+
+
+### wait\_for\_timeout
+
+```python
+def wait_for_timeout(timeout: int)
+```
+
+Wait for a specified timeout before considering the sandbox ready.
+
+Uses `sleep` command to wait for a fixed duration.
+
+**Arguments**:
+
+- `timeout`: Time to wait in **milliseconds** (minimum: 1000ms / 1 second)
+
+**Returns**:
+
+ReadyCmd that waits for the specified duration
+Example
+```python
+from e2b import Template, wait_for_timeout
+
+template = (
+ Template()
+ .from_node_image()
+ .set_start_cmd('npm start', wait_for_timeout(5000)) # Wait 5 seconds
+)
+```
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/logger/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/logger/page.mdx
new file mode 100644
index 000000000..4d41b149b
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/logger/page.mdx
@@ -0,0 +1,93 @@
+
+
+
+## LogEntry
+
+```python
+@dataclass
+class LogEntry()
+```
+
+Represents a single log entry from the template build process.
+
+
+## LogEntryStart
+
+```python
+@dataclass
+class LogEntryStart(LogEntry)
+```
+
+Special log entry indicating the start of a build process.
+
+
+## LogEntryEnd
+
+```python
+@dataclass
+class LogEntryEnd(LogEntry)
+```
+
+Special log entry indicating the end of a build process.
+
+
+### TIMER\_UPDATE\_INTERVAL\_MS
+
+Default minimum log level to display.
+
+
+### DEFAULT\_LEVEL
+
+Colored labels for each log level.
+
+
+### levels
+
+Numeric ordering of log levels for comparison (lower = less severe).
+
+
+### set\_interval
+
+```python
+def set_interval(func, interval)
+```
+
+Returns a stop function that can be called to cancel the interval.
+
+Similar to JavaScript's setInterval.
+
+**Arguments**:
+
+- `func`: Function to execute at each interval
+- `interval`: Interval duration in **seconds**
+
+**Returns**:
+
+Stop function that can be called to cancel the interval
+
+
+### default\_build\_logger
+
+```python
+def default_build_logger(
+ min_level: Optional[LogEntryLevel] = None
+) -> Callable[[LogEntry], None]
+```
+
+Create a default build logger with animated timer display.
+
+**Arguments**:
+
+- `min_level`: Minimum log level to display (default: 'info')
+
+**Returns**:
+
+Logger function that accepts LogEntry instances
+Example
+```python
+from e2b import Template, default_build_logger
+
+template = Template().from_python_image()
+
+```
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/page.mdx
new file mode 100644
index 000000000..b65570618
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/page.mdx
@@ -0,0 +1,140 @@
+
+
+
+## Template
+
+```python
+class Template(TemplateBase)
+```
+
+Synchronous template builder for E2B sandboxes.
+
+
+### build
+
+```python
+@staticmethod
+def build(template: TemplateClass,
+ alias: str,
+ cpu_count: int = 2,
+ memory_mb: int = 1024,
+ skip_cache: bool = False,
+ on_build_logs: Optional[Callable[[LogEntry], None]] = None,
+ api_key: Optional[str] = None,
+ domain: Optional[str] = None) -> BuildInfo
+```
+
+Build and deploy a template to E2B infrastructure.
+
+**Arguments**:
+
+- `template`: The template to build
+- `alias`: Alias name for the template
+- `cpu_count`: Number of CPUs allocated to the sandbox
+- `memory_mb`: Amount of memory in MB allocated to the sandbox
+- `skip_cache`: If True, forces a complete rebuild ignoring cache
+- `on_build_logs`: Callback function to receive build logs during the build process
+- `api_key`: E2B API key for authentication
+- `domain`: Domain of the E2B API
+Example
+```python
+from e2b import Template
+
+template = (
+ Template()
+ .from_python_image('3')
+ .copy('requirements.txt', '/home/user/')
+ .run_cmd('pip install -r /home/user/requirements.txt')
+)
+
+Template.build(
+ template,
+ alias='my-python-env',
+ cpu_count=2,
+ memory_mb=1024
+)
+```
+
+
+### build\_in\_background
+
+```python
+@staticmethod
+def build_in_background(template: TemplateClass,
+ alias: str,
+ cpu_count: int = 2,
+ memory_mb: int = 1024,
+ skip_cache: bool = False,
+ on_build_logs: Optional[Callable[[LogEntry],
+ None]] = None,
+ api_key: Optional[str] = None,
+ domain: Optional[str] = None) -> BuildInfo
+```
+
+Build and deploy a template to E2B infrastructure without waiting for completion.
+
+**Arguments**:
+
+- `template`: The template to build
+- `alias`: Alias name for the template
+- `cpu_count`: Number of CPUs allocated to the sandbox
+- `memory_mb`: Amount of memory in MB allocated to the sandbox
+- `skip_cache`: If True, forces a complete rebuild ignoring cache
+- `api_key`: E2B API key for authentication
+- `domain`: Domain of the E2B API
+
+**Returns**:
+
+BuildInfo containing the template ID and build ID
+Example
+```python
+from e2b import Template
+
+template = (
+ Template()
+ .from_python_image('3')
+ .run_cmd('echo "test"')
+ .set_start_cmd('echo "Hello"', 'sleep 1')
+)
+
+build_info = Template.build_in_background(
+ template,
+ alias='my-python-env',
+ cpu_count=2,
+ memory_mb=1024
+)
+```
+
+
+### get\_build\_status
+
+```python
+@staticmethod
+def get_build_status(build_info: BuildInfo,
+ logs_offset: int = 0,
+ api_key: Optional[str] = None,
+ domain: Optional[str] = None)
+```
+
+Get the status of a build.
+
+**Arguments**:
+
+- `build_info`: Build identifiers returned from build_in_background
+- `logs_offset`: Offset for fetching logs
+- `api_key`: E2B API key for authentication
+- `domain`: Domain of the E2B API
+
+**Returns**:
+
+TemplateBuild containing the build status and logs
+Example
+```python
+from e2b import Template
+
+build_info = Template.build_in_background(template, alias='my-template')
+status = Template.get_build_status(build_info, logs_offset=0)
+```
+
+
+
diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/readycmd/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/readycmd/page.mdx
new file mode 100644
index 000000000..2116be854
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/sdk-reference/python-sdk/v2.8.1/template_sync/readycmd/page.mdx
@@ -0,0 +1,157 @@
+
+
+
+## ReadyCmd
+
+```python
+class ReadyCmd()
+```
+
+Wrapper class for ready check commands.
+
+
+### wait\_for\_port
+
+```python
+def wait_for_port(port: int)
+```
+
+Wait for a port to be listening.
+
+Uses `ss` command to check if a port is open and listening.
+
+**Arguments**:
+
+- `port`: Port number to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the port
+Example
+```python
+from e2b import Template, wait_for_port
+
+template = (
+ Template()
+ .from_python_image()
+ .set_start_cmd('python -m http.server 8000', wait_for_port(8000))
+)
+```
+
+
+### wait\_for\_url
+
+```python
+def wait_for_url(url: str, status_code: int = 200)
+```
+
+Wait for a URL to return a specific HTTP status code.
+
+Uses `curl` to make HTTP requests and check the response status.
+
+**Arguments**:
+
+- `url`: URL to check (e.g., 'http://localhost:3000/health')
+- `status_code`: Expected HTTP status code (default: 200)
+
+**Returns**:
+
+ReadyCmd that checks the URL
+Example
+```python
+from e2b import Template, wait_for_url
+
+template = (
+ Template()
+ .from_node_image()
+ .set_start_cmd('npm start', wait_for_url('http://localhost:3000/health'))
+)
+```
+
+
+### wait\_for\_process
+
+```python
+def wait_for_process(process_name: str)
+```
+
+Wait for a process with a specific name to be running.
+
+Uses `pgrep` to check if a process exists.
+
+**Arguments**:
+
+- `process_name`: Name of the process to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the process
+Example
+```python
+from e2b import Template, wait_for_process
+
+template = (
+ Template()
+ .from_base_image()
+ .set_start_cmd('./my-daemon', wait_for_process('my-daemon'))
+)
+```
+
+
+### wait\_for\_file
+
+```python
+def wait_for_file(filename: str)
+```
+
+Wait for a file to exist.
+
+Uses shell test command to check file existence.
+
+**Arguments**:
+
+- `filename`: Path to the file to wait for
+
+**Returns**:
+
+ReadyCmd that checks for the file
+Example
+```python
+from e2b import Template, wait_for_file
+
+template = (
+ Template()
+ .from_base_image()
+ .set_start_cmd('./init.sh', wait_for_file('/tmp/ready'))
+)
+```
+
+
+### wait\_for\_timeout
+
+```python
+def wait_for_timeout(timeout: int)
+```
+
+Wait for a specified timeout before considering the sandbox ready.
+
+Uses `sleep` command to wait for a fixed duration.
+
+**Arguments**:
+
+- `timeout`: Time to wait in **milliseconds** (minimum: 1000ms / 1 second)
+
+**Returns**:
+
+ReadyCmd that waits for the specified duration
+Example
+```python
+from e2b import Template, wait_for_timeout
+
+template = (
+ Template()
+ .from_node_image()
+ .set_start_cmd('npm start', wait_for_timeout(5000)) # Wait 5 seconds
+)
+```
+
diff --git a/packages/python-sdk/package.json b/packages/python-sdk/package.json
index d9b427111..1c18a3994 100644
--- a/packages/python-sdk/package.json
+++ b/packages/python-sdk/package.json
@@ -1,7 +1,7 @@
{
"name": "@e2b/python-sdk",
"private": true,
- "version": "2.8.0",
+ "version": "2.8.1",
"scripts": {
"example": "poetry run python example.py",
"test": "poetry run pytest -n 4 --verbose -x",
diff --git a/packages/python-sdk/pyproject.toml b/packages/python-sdk/pyproject.toml
index c3c543517..8e1449cbf 100644
--- a/packages/python-sdk/pyproject.toml
+++ b/packages/python-sdk/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "e2b"
-version = "2.8.0"
+version = "2.8.1"
description = "E2B SDK that give agents cloud environments"
authors = ["e2b <[email protected]>"]
license = "MIT"