Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Update based on logs API

Tomas Valenta5c068bc397d7
diff --git a/packages/cli/src/commands/sandbox/logs.ts b/packages/cli/src/commands/sandbox/logs.ts
index 7fd46221c..e0411a5b2 100644
--- a/packages/cli/src/commands/sandbox/logs.ts
+++ b/packages/cli/src/commands/sandbox/logs.ts
@@ -37,6 +37,6 @@ export async function listSandboxLogs({
sandboxID,
offset,
}: { apiKey: string, sandboxID: string, offset: number }): Promise<e2b.components['schemas']['SandboxLogs']> {
- const response = await getSandboxLogs(apiKey, { sandboxID, logsOffset: offset })
+ const response = await getSandboxLogs(apiKey, { sandboxID, offset })
return response.data
}
diff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.ts
index 2ba3871af..57782ea72 100644
--- a/packages/js-sdk/src/api/schema.gen.ts
+++ b/packages/js-sdk/src/api/schema.gen.ts
@@ -58,7 +58,9 @@ export interface paths {
};
query: {
/** Index of the starting log that should be returned with the sandbox */
- logsOffset?: number;
+ offset?: number;
+ /** Maximum number of logs that should be returned with the sandbox */
+ limit?: number;
};
};
responses: {
diff --git a/packages/python-sdk/e2b/api/v1/client/__init__.py b/packages/python-sdk/e2b/api/v1/client/__init__.py
index 3fc1bbe80..4597d40d0 100644
--- a/packages/python-sdk/e2b/api/v1/client/__init__.py
+++ b/packages/python-sdk/e2b/api/v1/client/__init__.py
@@ -35,6 +35,7 @@ from e2b.api.v1.client.models.error import Error
from e2b.api.v1.client.models.new_sandbox import NewSandbox
from e2b.api.v1.client.models.running_sandboxes import RunningSandboxes
from e2b.api.v1.client.models.sandbox import Sandbox
+from e2b.api.v1.client.models.sandbox_logs import SandboxLogs
from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (
SandboxesSandboxIDRefreshesPostRequest,
)
diff --git a/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.py b/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.py
index 93c74a0ca..3080b4a7c 100644
--- a/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.py
+++ b/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.py
@@ -18,13 +18,15 @@ import warnings
from pydantic import validate_arguments, ValidationError
-from pydantic import StrictStr
+from typing_extensions import Annotated
+from pydantic import Field, StrictInt, StrictStr
from typing import List, Optional
from e2b.api.v1.client.models.new_sandbox import NewSandbox
from e2b.api.v1.client.models.running_sandboxes import RunningSandboxes
from e2b.api.v1.client.models.sandbox import Sandbox
+from e2b.api.v1.client.models.sandbox_logs import SandboxLogs
from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (
SandboxesSandboxIDRefreshesPostRequest,
)
@@ -483,6 +485,197 @@ class SandboxesApi:
_request_auth=_params.get("_request_auth"),
)
+ @validate_arguments
+ def sandboxes_sandbox_id_logs_get(
+ self,
+ sandbox_id: StrictStr,
+ offset: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Index of the starting log that should be returned with the sandbox"
+ ),
+ ] = None,
+ limit: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Maximum number of logs that should be returned with the sandbox"
+ ),
+ ] = None,
+ **kwargs
+ ) -> SandboxLogs: # noqa: E501
+ """sandboxes_sandbox_id_logs_get # noqa: E501
+
+ Get sandbox logs # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.sandboxes_sandbox_id_logs_get(sandbox_id, offset, limit, async_req=True)
+ >>> result = thread.get()
+
+ :param sandbox_id: (required)
+ :type sandbox_id: str
+ :param offset: Index of the starting log that should be returned with the sandbox
+ :type offset: int
+ :param limit: Maximum number of logs that should be returned with the sandbox
+ :type limit: int
+ :param async_req: Whether to execute the request asynchronously.
+ :type async_req: bool, optional
+ :param _request_timeout: timeout setting for this request.
+ If one number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ :return: Returns the result object.
+ If the method is called asynchronously,
+ returns the request thread.
+ :rtype: SandboxLogs
+ """
+ kwargs["_return_http_data_only"] = True
+ if "_preload_content" in kwargs:
+ message = "Error! Please call the sandboxes_sandbox_id_logs_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
+ raise ValueError(message)
+ return self.sandboxes_sandbox_id_logs_get_with_http_info(
+ sandbox_id, offset, limit, **kwargs
+ ) # noqa: E501
+
+ @validate_arguments
+ def sandboxes_sandbox_id_logs_get_with_http_info(
+ self,
+ sandbox_id: StrictStr,
+ offset: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Index of the starting log that should be returned with the sandbox"
+ ),
+ ] = None,
+ limit: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Maximum number of logs that should be returned with the sandbox"
+ ),
+ ] = None,
+ **kwargs
+ ) -> ApiResponse: # noqa: E501
+ """sandboxes_sandbox_id_logs_get # noqa: E501
+
+ Get sandbox logs # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.sandboxes_sandbox_id_logs_get_with_http_info(sandbox_id, offset, limit, async_req=True)
+ >>> result = thread.get()
+
+ :param sandbox_id: (required)
+ :type sandbox_id: str
+ :param offset: Index of the starting log that should be returned with the sandbox
+ :type offset: int
+ :param limit: Maximum number of logs that should be returned with the sandbox
+ :type limit: int
+ :param async_req: Whether to execute the request asynchronously.
+ :type async_req: bool, optional
+ :param _preload_content: if False, the ApiResponse.data will
+ be set to none and raw_data will store the
+ HTTP response body without reading/decoding.
+ Default is True.
+ :type _preload_content: bool, optional
+ :param _return_http_data_only: response data instead of ApiResponse
+ object with status code, headers, etc
+ :type _return_http_data_only: bool, optional
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ :param _request_auth: set to override the auth_settings for an a single
+ request; this effectively ignores the authentication
+ in the spec for a single request.
+ :type _request_auth: dict, optional
+ :type _content_type: string, optional: force content-type for the request
+ :return: Returns the result object.
+ If the method is called asynchronously,
+ returns the request thread.
+ :rtype: tuple(SandboxLogs, status_code(int), headers(HTTPHeaderDict))
+ """
+
+ _params = locals()
+
+ _all_params = ["sandbox_id", "offset", "limit"]
+ _all_params.extend(
+ [
+ "async_req",
+ "_return_http_data_only",
+ "_preload_content",
+ "_request_timeout",
+ "_request_auth",
+ "_content_type",
+ "_headers",
+ ]
+ )
+
+ # validate the arguments
+ for _key, _val in _params["kwargs"].items():
+ if _key not in _all_params:
+ raise ApiTypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method sandboxes_sandbox_id_logs_get" % _key
+ )
+ _params[_key] = _val
+ del _params["kwargs"]
+
+ _collection_formats = {}
+
+ # process the path parameters
+ _path_params = {}
+ if _params["sandbox_id"] is not None:
+ _path_params["sandboxID"] = _params["sandbox_id"]
+
+ # process the query parameters
+ _query_params = []
+ if _params.get("offset") is not None: # noqa: E501
+ _query_params.append(("offset", _params["offset"]))
+
+ if _params.get("limit") is not None: # noqa: E501
+ _query_params.append(("limit", _params["limit"]))
+
+ # process the header parameters
+ _header_params = dict(_params.get("_headers", {}))
+ # process the form parameters
+ _form_params = []
+ _files = {}
+ # process the body parameter
+ _body_params = None
+ # set the HTTP header `Accept`
+ _header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # authentication setting
+ _auth_settings = ["ApiKeyAuth"] # noqa: E501
+
+ _response_types_map = {
+ "200": "SandboxLogs",
+ "404": "Error",
+ "401": "Error",
+ "500": "Error",
+ }
+
+ return self.api_client.call_api(
+ "/sandboxes/{sandboxID}/logs",
+ "GET",
+ _path_params,
+ _query_params,
+ _header_params,
+ body=_body_params,
+ post_params=_form_params,
+ files=_files,
+ response_types_map=_response_types_map,
+ auth_settings=_auth_settings,
+ async_req=_params.get("async_req"),
+ _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
+ _preload_content=_params.get("_preload_content", True),
+ _request_timeout=_params.get("_request_timeout"),
+ collection_formats=_collection_formats,
+ _request_auth=_params.get("_request_auth"),
+ )
+
@validate_arguments
def sandboxes_sandbox_id_refreshes_post(
self,
diff --git a/packages/python-sdk/e2b/api/v1/client/models/__init__.py b/packages/python-sdk/e2b/api/v1/client/models/__init__.py
index 5558c390a..8a335d051 100644
--- a/packages/python-sdk/e2b/api/v1/client/models/__init__.py
+++ b/packages/python-sdk/e2b/api/v1/client/models/__init__.py
@@ -18,6 +18,7 @@ from e2b.api.v1.client.models.error import Error
from e2b.api.v1.client.models.new_sandbox import NewSandbox
from e2b.api.v1.client.models.running_sandboxes import RunningSandboxes
from e2b.api.v1.client.models.sandbox import Sandbox
+from e2b.api.v1.client.models.sandbox_logs import SandboxLogs
from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (
SandboxesSandboxIDRefreshesPostRequest,
)
diff --git a/packages/python-sdk/e2b/api/v1/client/models/sandbox_logs.py b/packages/python-sdk/e2b/api/v1/client/models/sandbox_logs.py
new file mode 100644
index 000000000..169dcaf39
--- /dev/null
+++ b/packages/python-sdk/e2b/api/v1/client/models/sandbox_logs.py
@@ -0,0 +1,85 @@
+# coding: utf-8
+
+"""
+ E2B API
+
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+ The version of the OpenAPI document: 0.1.0
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
+
+ Do not edit the class manually.
+""" # noqa: E501
+
+
+from __future__ import annotations
+import pprint
+import re # noqa: F401
+import json
+
+
+from typing import Any, Dict, List
+from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist
+
+
+class SandboxLogs(BaseModel):
+ """
+ SandboxLogs
+ """
+
+ logs: conlist(StrictStr) = Field(..., description="Logs of the sandbox")
+ logs_offset: StrictInt = Field(
+ ..., alias="logsOffset", description="Index of the last log"
+ )
+ additional_properties: Dict[str, Any] = {}
+ __properties = ["logs", "logsOffset"]
+
+ class Config:
+ """Pydantic configuration"""
+
+ allow_population_by_field_name = True
+ validate_assignment = True
+
+ def to_str(self) -> str:
+ """Returns the string representation of the model using alias"""
+ return pprint.pformat(self.dict(by_alias=True))
+
+ def to_json(self) -> str:
+ """Returns the JSON representation of the model using alias"""
+ return json.dumps(self.to_dict())
+
+ @classmethod
+ def from_json(cls, json_str: str) -> SandboxLogs:
+ """Create an instance of SandboxLogs from a JSON string"""
+ return cls.from_dict(json.loads(json_str))
+
+ def to_dict(self):
+ """Returns the dictionary representation of the model using alias"""
+ _dict = self.dict(
+ by_alias=True, exclude={"additional_properties"}, exclude_none=True
+ )
+ # puts key-value pairs in additional_properties in the top level
+ if self.additional_properties is not None:
+ for _key, _value in self.additional_properties.items():
+ _dict[_key] = _value
+
+ return _dict
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> SandboxLogs:
+ """Create an instance of SandboxLogs from a dict"""
+ if obj is None:
+ return None
+
+ if not isinstance(obj, dict):
+ return SandboxLogs.parse_obj(obj)
+
+ _obj = SandboxLogs.parse_obj(
+ {"logs": obj.get("logs"), "logs_offset": obj.get("logsOffset")}
+ )
+ # store additional fields in additional_properties
+ for _key in obj.keys():
+ if _key not in cls.__properties:
+ _obj.additional_properties[_key] = obj.get(_key)
+
+ return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client_README.md b/packages/python-sdk/e2b/api/v1/client_README.md
index e4e2048b7..b8a9f8d53 100644
--- a/packages/python-sdk/e2b/api/v1/client_README.md
+++ b/packages/python-sdk/e2b/api/v1/client_README.md
@@ -75,6 +75,7 @@ Class | Method | HTTP request | Description
*SandboxesApi* | [**sandboxes_get**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_get) | **GET** /sandboxes |
*SandboxesApi* | [**sandboxes_post**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_post) | **POST** /sandboxes |
*SandboxesApi* | [**sandboxes_sandbox_id_delete**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_sandbox_id_delete) | **DELETE** /sandboxes/{sandboxID} |
+*SandboxesApi* | [**sandboxes_sandbox_id_logs_get**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_sandbox_id_logs_get) | **GET** /sandboxes/{sandboxID}/logs |
*SandboxesApi* | [**sandboxes_sandbox_id_refreshes_post**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_sandbox_id_refreshes_post) | **POST** /sandboxes/{sandboxID}/refreshes |
@@ -84,6 +85,7 @@ Class | Method | HTTP request | Description
- [NewSandbox](e2b/api/v1/client/docs/NewSandbox.md)
- [RunningSandboxes](e2b/api/v1/client/docs/RunningSandboxes.md)
- [Sandbox](e2b/api/v1/client/docs/Sandbox.md)
+ - [SandboxLogs](e2b/api/v1/client/docs/SandboxLogs.md)
- [SandboxesSandboxIDRefreshesPostRequest](e2b/api/v1/client/docs/SandboxesSandboxIDRefreshesPostRequest.md)
- [Template](e2b/api/v1/client/docs/Template.md)
- [TemplateBuild](e2b/api/v1/client/docs/TemplateBuild.md)
diff --git a/packages/python-sdk/e2b/api/v2/client/__init__.py b/packages/python-sdk/e2b/api/v2/client/__init__.py
index 88f895f0c..3b95dec39 100644
--- a/packages/python-sdk/e2b/api/v2/client/__init__.py
+++ b/packages/python-sdk/e2b/api/v2/client/__init__.py
@@ -35,6 +35,7 @@ from e2b.api.v2.client.models.error import Error
from e2b.api.v2.client.models.new_sandbox import NewSandbox
from e2b.api.v2.client.models.running_sandboxes import RunningSandboxes
from e2b.api.v2.client.models.sandbox import Sandbox
+from e2b.api.v2.client.models.sandbox_logs import SandboxLogs
from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (
SandboxesSandboxIDRefreshesPostRequest,
)
diff --git a/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.py b/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.py
index 2b2599faa..5e16e6782 100644
--- a/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.py
+++ b/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.py
@@ -23,13 +23,16 @@ try:
except ImportError:
from typing_extensions import Annotated
-from pydantic import StrictStr
+from pydantic import Field
+from typing_extensions import Annotated
+from pydantic import StrictInt, StrictStr
from typing import List, Optional
from e2b.api.v2.client.models.new_sandbox import NewSandbox
from e2b.api.v2.client.models.running_sandboxes import RunningSandboxes
from e2b.api.v2.client.models.sandbox import Sandbox
+from e2b.api.v2.client.models.sandbox_logs import SandboxLogs
from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (
SandboxesSandboxIDRefreshesPostRequest,
)
@@ -772,6 +775,315 @@ class SandboxesApi:
_request_auth=_request_auth,
)
+ @validate_call
+ def sandboxes_sandbox_id_logs_get(
+ self,
+ sandbox_id: StrictStr,
+ offset: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Index of the starting log that should be returned with the sandbox"
+ ),
+ ] = None,
+ limit: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Maximum number of logs that should be returned with the sandbox"
+ ),
+ ] = None,
+ _request_timeout: Union[
+ None,
+ Annotated[StrictFloat, Field(gt=0)],
+ Tuple[
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
+ ],
+ ] = None,
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
+ _content_type: Optional[StrictStr] = None,
+ _headers: Optional[Dict[StrictStr, Any]] = None,
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
+ ) -> SandboxLogs:
+ """sandboxes_sandbox_id_logs_get
+
+ Get sandbox logs
+
+ :param sandbox_id: (required)
+ :type sandbox_id: str
+ :param offset: Index of the starting log that should be returned with the sandbox
+ :type offset: int
+ :param limit: Maximum number of logs that should be returned with the sandbox
+ :type limit: int
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ :type _request_timeout: int, tuple(int, int), optional
+ :param _request_auth: set to override the auth_settings for an a single
+ request; this effectively ignores the
+ authentication in the spec for a single request.
+ :type _request_auth: dict, optional
+ :param _content_type: force content-type for the request.
+ :type _content_type: str, Optional
+ :param _headers: set to override the headers for a single
+ request; this effectively ignores the headers
+ in the spec for a single request.
+ :type _headers: dict, optional
+ :param _host_index: set to override the host_index for a single
+ request; this effectively ignores the host_index
+ in the spec for a single request.
+ :type _host_index: int, optional
+ :return: Returns the result object.
+ """ # noqa: E501
+
+ _param = self._sandboxes_sandbox_id_logs_get_serialize(
+ sandbox_id=sandbox_id,
+ offset=offset,
+ limit=limit,
+ _request_auth=_request_auth,
+ _content_type=_content_type,
+ _headers=_headers,
+ _host_index=_host_index,
+ )
+
+ _response_types_map: Dict[str, Optional[str]] = {
+ "200": "SandboxLogs",
+ "404": "Error",
+ "401": "Error",
+ "500": "Error",
+ }
+ response_data = self.api_client.call_api(
+ *_param, _request_timeout=_request_timeout
+ )
+ response_data.read()
+ return self.api_client.response_deserialize(
+ response_data=response_data,
+ response_types_map=_response_types_map,
+ ).data
+
+ @validate_call
+ def sandboxes_sandbox_id_logs_get_with_http_info(
+ self,
+ sandbox_id: StrictStr,
+ offset: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Index of the starting log that should be returned with the sandbox"
+ ),
+ ] = None,
+ limit: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Maximum number of logs that should be returned with the sandbox"
+ ),
+ ] = None,
+ _request_timeout: Union[
+ None,
+ Annotated[StrictFloat, Field(gt=0)],
+ Tuple[
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
+ ],
+ ] = None,
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
+ _content_type: Optional[StrictStr] = None,
+ _headers: Optional[Dict[StrictStr, Any]] = None,
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
+ ) -> ApiResponse[SandboxLogs]:
+ """sandboxes_sandbox_id_logs_get
+
+ Get sandbox logs
+
+ :param sandbox_id: (required)
+ :type sandbox_id: str
+ :param offset: Index of the starting log that should be returned with the sandbox
+ :type offset: int
+ :param limit: Maximum number of logs that should be returned with the sandbox
+ :type limit: int
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ :type _request_timeout: int, tuple(int, int), optional
+ :param _request_auth: set to override the auth_settings for an a single
+ request; this effectively ignores the
+ authentication in the spec for a single request.
+ :type _request_auth: dict, optional
+ :param _content_type: force content-type for the request.
+ :type _content_type: str, Optional
+ :param _headers: set to override the headers for a single
+ request; this effectively ignores the headers
+ in the spec for a single request.
+ :type _headers: dict, optional
+ :param _host_index: set to override the host_index for a single
+ request; this effectively ignores the host_index
+ in the spec for a single request.
+ :type _host_index: int, optional
+ :return: Returns the result object.
+ """ # noqa: E501
+
+ _param = self._sandboxes_sandbox_id_logs_get_serialize(
+ sandbox_id=sandbox_id,
+ offset=offset,
+ limit=limit,
+ _request_auth=_request_auth,
+ _content_type=_content_type,
+ _headers=_headers,
+ _host_index=_host_index,
+ )
+
+ _response_types_map: Dict[str, Optional[str]] = {
+ "200": "SandboxLogs",
+ "404": "Error",
+ "401": "Error",
+ "500": "Error",
+ }
+ response_data = self.api_client.call_api(
+ *_param, _request_timeout=_request_timeout
+ )
+ response_data.read()
+ return self.api_client.response_deserialize(
+ response_data=response_data,
+ response_types_map=_response_types_map,
+ )
+
+ @validate_call
+ def sandboxes_sandbox_id_logs_get_without_preload_content(
+ self,
+ sandbox_id: StrictStr,
+ offset: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Index of the starting log that should be returned with the sandbox"
+ ),
+ ] = None,
+ limit: Annotated[
+ Optional[StrictInt],
+ Field(
+ description="Maximum number of logs that should be returned with the sandbox"
+ ),
+ ] = None,
+ _request_timeout: Union[
+ None,
+ Annotated[StrictFloat, Field(gt=0)],
+ Tuple[
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
+ ],
+ ] = None,
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
+ _content_type: Optional[StrictStr] = None,
+ _headers: Optional[Dict[StrictStr, Any]] = None,
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
+ ) -> RESTResponseType:
+ """sandboxes_sandbox_id_logs_get
+
+ Get sandbox logs
+
+ :param sandbox_id: (required)
+ :type sandbox_id: str
+ :param offset: Index of the starting log that should be returned with the sandbox
+ :type offset: int
+ :param limit: Maximum number of logs that should be returned with the sandbox
+ :type limit: int
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ :type _request_timeout: int, tuple(int, int), optional
+ :param _request_auth: set to override the auth_settings for an a single
+ request; this effectively ignores the
+ authentication in the spec for a single request.
+ :type _request_auth: dict, optional
+ :param _content_type: force content-type for the request.
+ :type _content_type: str, Optional
+ :param _headers: set to override the headers for a single
+ request; this effectively ignores the headers
+ in the spec for a single request.
+ :type _headers: dict, optional
+ :param _host_index: set to override the host_index for a single
+ request; this effectively ignores the host_index
+ in the spec for a single request.
+ :type _host_index: int, optional
+ :return: Returns the result object.
+ """ # noqa: E501
+
+ _param = self._sandboxes_sandbox_id_logs_get_serialize(
+ sandbox_id=sandbox_id,
+ offset=offset,
+ limit=limit,
+ _request_auth=_request_auth,
+ _content_type=_content_type,
+ _headers=_headers,
+ _host_index=_host_index,
+ )
+
+ _response_types_map: Dict[str, Optional[str]] = {
+ "200": "SandboxLogs",
+ "404": "Error",
+ "401": "Error",
+ "500": "Error",
+ }
+ response_data = self.api_client.call_api(
+ *_param, _request_timeout=_request_timeout
+ )
+ return response_data.response
+
+ def _sandboxes_sandbox_id_logs_get_serialize(
+ self,
+ sandbox_id,
+ offset,
+ limit,
+ _request_auth,
+ _content_type,
+ _headers,
+ _host_index,
+ ) -> Tuple:
+ _host = None
+
+ _collection_formats: Dict[str, str] = {}
+
+ _path_params: Dict[str, str] = {}
+ _query_params: List[Tuple[str, str]] = []
+ _header_params: Dict[str, Optional[str]] = _headers or {}
+ _form_params: List[Tuple[str, str]] = []
+ _files: Dict[str, str] = {}
+ _body_params: Optional[bytes] = None
+
+ # process the path parameters
+ if sandbox_id is not None:
+ _path_params["sandboxID"] = sandbox_id
+ # process the query parameters
+ if offset is not None:
+ _query_params.append(("offset", offset))
+
+ if limit is not None:
+ _query_params.append(("limit", limit))
+
+ # process the header parameters
+ # process the form parameters
+ # process the body parameter
+
+ # set the HTTP header `Accept`
+ _header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ )
+
+ # authentication setting
+ _auth_settings: List[str] = ["ApiKeyAuth"]
+
+ return self.api_client.param_serialize(
+ method="GET",
+ resource_path="/sandboxes/{sandboxID}/logs",
+ path_params=_path_params,
+ query_params=_query_params,
+ header_params=_header_params,
+ body=_body_params,
+ post_params=_form_params,
+ files=_files,
+ auth_settings=_auth_settings,
+ collection_formats=_collection_formats,
+ _host=_host,
+ _request_auth=_request_auth,
+ )
+
@validate_call
def sandboxes_sandbox_id_refreshes_post(
self,
diff --git a/packages/python-sdk/e2b/api/v2/client/models/__init__.py b/packages/python-sdk/e2b/api/v2/client/models/__init__.py
index c4c737a46..40dfeb47a 100644
--- a/packages/python-sdk/e2b/api/v2/client/models/__init__.py
+++ b/packages/python-sdk/e2b/api/v2/client/models/__init__.py
@@ -18,6 +18,7 @@ from e2b.api.v2.client.models.error import Error
from e2b.api.v2.client.models.new_sandbox import NewSandbox
from e2b.api.v2.client.models.running_sandboxes import RunningSandboxes
from e2b.api.v2.client.models.sandbox import Sandbox
+from e2b.api.v2.client.models.sandbox_logs import SandboxLogs
from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (
SandboxesSandboxIDRefreshesPostRequest,
)
diff --git a/packages/python-sdk/e2b/api/v2/client/models/sandbox_logs.py b/packages/python-sdk/e2b/api/v2/client/models/sandbox_logs.py
new file mode 100644
index 000000000..14b979e42
--- /dev/null
+++ b/packages/python-sdk/e2b/api/v2/client/models/sandbox_logs.py
@@ -0,0 +1,101 @@
+# coding: utf-8
+
+"""
+ E2B API
+
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+ The version of the OpenAPI document: 0.1.0
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
+
+ Do not edit the class manually.
+""" # noqa: E501
+
+
+from __future__ import annotations
+import pprint
+import re # noqa: F401
+import json
+
+
+from typing import Any, ClassVar, Dict, List
+from pydantic import BaseModel, StrictInt, StrictStr
+from pydantic import Field
+
+try:
+ from typing import Self
+except ImportError:
+ from typing_extensions import Self
+
+
+class SandboxLogs(BaseModel):
+ """
+ SandboxLogs
+ """ # noqa: E501
+
+ logs: List[StrictStr] = Field(description="Logs of the sandbox")
+ logs_offset: StrictInt = Field(
+ description="Index of the last log", alias="logsOffset"
+ )
+ additional_properties: Dict[str, Any] = {}
+ __properties: ClassVar[List[str]] = ["logs", "logsOffset"]
+
+ model_config = {"populate_by_name": True, "validate_assignment": True}
+
+ def to_str(self) -> str:
+ """Returns the string representation of the model using alias"""
+ return pprint.pformat(self.model_dump(by_alias=True))
+
+ def to_json(self) -> str:
+ """Returns the JSON representation of the model using alias"""
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
+ return json.dumps(self.to_dict())
+
+ @classmethod
+ def from_json(cls, json_str: str) -> Self:
+ """Create an instance of SandboxLogs from a JSON string"""
+ return cls.from_dict(json.loads(json_str))
+
+ def to_dict(self) -> Dict[str, Any]:
+ """Return the dictionary representation of the model using alias.
+
+ This has the following differences from calling pydantic's
+ `self.model_dump(by_alias=True)`:
+
+ * `None` is only added to the output dict for nullable fields that
+ were set at model initialization. Other fields with value `None`
+ are ignored.
+ * Fields in `self.additional_properties` are added to the output dict.
+ """
+ _dict = self.model_dump(
+ by_alias=True,
+ exclude={
+ "additional_properties",
+ },
+ exclude_none=True,
+ )
+ # puts key-value pairs in additional_properties in the top level
+ if self.additional_properties is not None:
+ for _key, _value in self.additional_properties.items():
+ _dict[_key] = _value
+
+ return _dict
+
+ @classmethod
+ def from_dict(cls, obj: Dict) -> Self:
+ """Create an instance of SandboxLogs from a dict"""
+ if obj is None:
+ return None
+
+ if not isinstance(obj, dict):
+ return cls.model_validate(obj)
+
+ _obj = cls.model_validate(
+ {"logs": obj.get("logs"), "logsOffset": obj.get("logsOffset")}
+ )
+ # store additional fields in additional_properties
+ for _key in obj.keys():
+ if _key not in cls.__properties:
+ _obj.additional_properties[_key] = obj.get(_key)
+
+ return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client_README.md b/packages/python-sdk/e2b/api/v2/client_README.md
index 36efbadd9..ab78566a6 100644
--- a/packages/python-sdk/e2b/api/v2/client_README.md
+++ b/packages/python-sdk/e2b/api/v2/client_README.md
@@ -74,6 +74,7 @@ Class | Method | HTTP request | Description
*SandboxesApi* | [**sandboxes_get**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_get) | **GET** /sandboxes |
*SandboxesApi* | [**sandboxes_post**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_post) | **POST** /sandboxes |
*SandboxesApi* | [**sandboxes_sandbox_id_delete**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_sandbox_id_delete) | **DELETE** /sandboxes/{sandboxID} |
+*SandboxesApi* | [**sandboxes_sandbox_id_logs_get**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_sandbox_id_logs_get) | **GET** /sandboxes/{sandboxID}/logs |
*SandboxesApi* | [**sandboxes_sandbox_id_refreshes_post**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_sandbox_id_refreshes_post) | **POST** /sandboxes/{sandboxID}/refreshes |
@@ -83,6 +84,7 @@ Class | Method | HTTP request | Description
- [NewSandbox](e2b/api/v2/client/docs/NewSandbox.md)
- [RunningSandboxes](e2b/api/v2/client/docs/RunningSandboxes.md)
- [Sandbox](e2b/api/v2/client/docs/Sandbox.md)
+ - [SandboxLogs](e2b/api/v2/client/docs/SandboxLogs.md)
- [SandboxesSandboxIDRefreshesPostRequest](e2b/api/v2/client/docs/SandboxesSandboxIDRefreshesPostRequest.md)
- [Template](e2b/api/v2/client/docs/Template.md)
- [TemplateBuild](e2b/api/v2/client/docs/TemplateBuild.md)