Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Support sandbox domain in sdk and cli (#821)
Jiri Sveceny10e9a28a821f
diff --git a/.changeset/purple-kangaroos-tease.md b/.changeset/purple-kangaroos-tease.mdnew file mode 100644index 000000000..18a9fe2d3--- /dev/null+++ b/.changeset/purple-kangaroos-tease.md@@ -0,0 +1,7 @@+---+'@e2b/python-sdk': minor+'e2b': minor+'@e2b/cli': minor+---++Support for dynamic sandbox traffic domaindiff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.tsindex 82954ee37..25747aedb 100644--- a/packages/js-sdk/src/api/schema.gen.ts+++ b/packages/js-sdk/src/api/schema.gen.ts@@ -193,7 +193,11 @@ export interface paths {/** @description Get sandbox metrics */get: {parameters: {- query?: never;+ query?: {+ end?: number;+ /** @description Starting timestamp of the metrics that should be returned in milliseconds */+ start?: number;+ };header?: never;path: {sandboxID: components["parameters"]["sandboxID"];@@ -211,6 +215,7 @@ export interface paths {"application/json": components["schemas"]["SandboxMetric"][];};};+ 400: components["responses"]["400"];401: components["responses"]["401"];404: components["responses"]["404"];500: components["responses"]["500"];@@ -411,12 +416,12 @@ export interface paths {path?: never;cookie?: never;};- /** @description List all running sandboxes with metrics */+ /** @description List metrics for given sandboxes */get: {parameters: {- query?: {- /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */- metadata?: string;+ query: {+ /** @description Comma-separated list of sandbox IDs to get metrics for */+ sandbox_ids: string[];};header?: never;path?: never;@@ -430,7 +435,7 @@ export interface paths {[name: string]: unknown;};content: {- "application/json": components["schemas"]["RunningSandboxWithMetrics"][];+ "application/json": components["schemas"]["SandboxesWithMetrics"];};};400: components["responses"]["400"];@@ -796,12 +801,11 @@ export interface components {* @description Identifier of the access token*/id: string;+ mask: components["schemas"]["IdentifierMaskingDetails"];/** @description Name of the access token */name: string;- /** @description Raw value of the access token */+ /** @description The fully created access token */token: string;- /** @description Mask of the access token */- tokenMask: string;};CreatedTeamAPIKey: {/**@@ -809,7 +813,7 @@ export interface components {* @description Timestamp of API key creation*/createdAt: string;- createdBy: components["schemas"]["TeamUser"] | null;+ createdBy?: components["schemas"]["TeamUser"] | null;/*** Format: uuid* @description Identifier of the API key@@ -817,13 +821,12 @@ export interface components {id: string;/** @description Raw value of the API key */key: string;- /** @description Mask of the API key */- keyMask: string;/*** Format: date-time* @description Last time this API key was used*/- lastUsed: string | null;+ lastUsed?: string | null;+ mask: components["schemas"]["IdentifierMaskingDetails"];/** @description Name of the API key */name: string;};@@ -839,10 +842,23 @@ export interface components {/** @description Error */message: string;};+ IdentifierMaskingDetails: {+ /** @description Prefix used in masked version of the token or key */+ maskedValuePrefix: string;+ /** @description Suffix used in masked version of the token or key */+ maskedValueSuffix: string;+ /** @description Prefix that identifies the token or key type */+ prefix: string;+ /** @description Length of the token or key */+ valueLength: number;+ };ListedSandbox: {/** @description Alias of the template */alias?: string;- /** @description Identifier of the client */+ /**+ * @deprecated+ * @description Identifier of the client+ */clientID: string;cpuCount: components["schemas"]["CPUCount"];/**@@ -906,11 +922,20 @@ export interface components {* @description Amount of allocated memory in MiB*/allocatedMemoryMiB: number;+ /** @description Identifier of the cluster */+ clusterID?: string | null;+ /** @description Commit of the orchestrator */+ commit: string;/*** Format: uint64* @description Number of sandbox create fails*/createFails: number;+ /**+ * Format: uint64+ * @description Number of sandbox create successes+ */+ createSuccesses: number;/** @description Identifier of the node */nodeID: string;/**@@ -930,11 +955,20 @@ export interface components {NodeDetail: {/** @description List of cached builds id on the node */cachedBuilds: string[];+ /** @description Identifier of the cluster */+ clusterID?: string | null;+ /** @description Commit of the orchestrator */+ commit: string;/*** Format: uint64* @description Number of sandbox create fails*/createFails: number;+ /**+ * Format: uint64+ * @description Number of sandbox create successes+ */+ createSuccesses: number;/** @description Identifier of the node */nodeID: string;/** @description List of sandboxes running on the node */@@ -964,35 +998,16 @@ export interface components {*/timeout: number;};- RunningSandboxWithMetrics: {+ Sandbox: {/** @description Alias of the template */alias?: string;- /** @description Identifier of the client */- clientID: string;- cpuCount: components["schemas"]["CPUCount"];- /**- * Format: date-time- * @description Time when the sandbox will expire- */- endAt: string;- memoryMB: components["schemas"]["MemoryMB"];- metadata?: components["schemas"]["SandboxMetadata"];- metrics?: components["schemas"]["SandboxMetric"][];- /** @description Identifier of the sandbox */- sandboxID: string;/**- * Format: date-time- * @description Time when the sandbox was started+ * @deprecated+ * @description Identifier of the client*/- startedAt: string;- /** @description Identifier of the template from which is the sandbox created */- templateID: string;- };- Sandbox: {- /** @description Alias of the template */- alias?: string;- /** @description Identifier of the client */clientID: string;+ /** @description Base domain where the sandbox traffic is accessible */+ domain?: string | null;/** @description Access token used for envd communication */envdAccessToken?: string;/** @description Version of the envd running in the sandbox */@@ -1005,9 +1020,14 @@ export interface components {SandboxDetail: {/** @description Alias of the template */alias?: string;- /** @description Identifier of the client */+ /**+ * @deprecated+ * @description Identifier of the client+ */clientID: string;cpuCount: components["schemas"]["CPUCount"];+ /** @description Base domain where the sandbox traffic is accessible */+ domain?: string | null;/*** Format: date-time* @description Time when the sandbox will expire@@ -1030,6 +1050,11 @@ export interface components {/** @description Identifier of the template from which is the sandbox created */templateID: string;};+ SandboxesWithMetrics: {+ sandboxes: {+ [key: string]: components["schemas"]["SandboxMetric"];+ };+ };/** @description Log entry with timestamp and line */SandboxLog: {/** @description Log line content */@@ -1061,14 +1086,14 @@ export interface components {cpuUsedPct: number;/*** Format: int64- * @description Total memory in MiB+ * @description Total memory in bytes*/- memTotalMiB: number;+ memTotal: number;/*** Format: int64- * @description Memory used in MiB+ * @description Memory used in bytes*/- memUsedMiB: number;+ memUsed: number;/*** Format: date-time* @description Timestamp of the metric entry@@ -1096,19 +1121,18 @@ export interface components {* @description Timestamp of API key creation*/createdAt: string;- createdBy: components["schemas"]["TeamUser"] | null;+ createdBy?: components["schemas"]["TeamUser"] | null;/*** Format: uuid* @description Identifier of the API key*/id: string;- /** @description Mask of the API key */- keyMask: string;/*** Format: date-time* @description Last time this API key was used*/- lastUsed: string | null;+ lastUsed?: string | null;+ mask: components["schemas"]["IdentifierMaskingDetails"];/** @description Name of the API key */name: string;};@@ -1167,6 +1191,8 @@ export interface components {* @default []*/logs: string[];+ /** @description Message with the status reason, currently reporting only for error status */+ reason?: string;/*** @description Status of the template* @enum {string}@@ -1182,6 +1208,8 @@ export interface components {/** @description Dockerfile for the template */dockerfile: string;memoryMB?: components["schemas"]["MemoryMB"];+ /** @description Ready check command to execute in the template after the build */+ readyCmd?: string;/** @description Start command to execute in the template after the build */startCmd?: string;/** @description Identifier of the team */diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.tsindex 3bad2634d..8dca72484 100644--- a/packages/js-sdk/src/sandbox/index.ts+++ b/packages/js-sdk/src/sandbox/index.ts@@ -117,6 +117,11 @@ export class Sandbox extends SandboxApi {*/readonly sandboxId: string+ /**+ * Domain where the sandbox is hosted.+ */+ readonly sandboxDomain: string+protected readonly envdPort = 49983protected readonly connectionConfig: ConnectionConfig@@ -135,15 +140,18 @@ export class Sandbox extends SandboxApi {constructor(opts: Omit<SandboxOpts, 'timeoutMs' | 'envs' | 'metadata'> & {sandboxId: string+ sandboxDomain?: stringenvdVersion?: stringenvdAccessToken?: string}) {super()- this.sandboxId = opts.sandboxIdthis.connectionConfig = new ConnectionConfig(opts)+ this.sandboxId = opts.sandboxId+ this.sandboxDomain = opts.sandboxDomain ?? this.connectionConfig.domain+this.envdAccessToken = opts.envdAccessTokenthis.envdApiUrl = `${this.connectionConfig.debug ? 'http' : 'https'@@ -287,6 +295,7 @@ export class Sandbox extends SandboxApi {return new this({sandboxId,+ sandboxDomain: info.sandboxDomain,envdAccessToken: info.envdAccessToken,envdVersion: info.envdVersion,...config,@@ -315,7 +324,7 @@ export class Sandbox extends SandboxApi {return `localhost:${port}`}- return `${port}-${this.sandboxId}.${this.connectionConfig.domain}`+ return `${port}-${this.sandboxId}.${this.sandboxDomain}`}/**diff --git a/packages/js-sdk/src/sandbox/sandboxApi.ts b/packages/js-sdk/src/sandbox/sandboxApi.tsindex 0194167e1..2e75cdbec 100644--- a/packages/js-sdk/src/sandbox/sandboxApi.ts+++ b/packages/js-sdk/src/sandbox/sandboxApi.ts@@ -30,6 +30,11 @@ export interface SandboxInfo {*/sandboxId: string+ /**+ * Domain where the sandbox is hosted.+ */+ sandboxDomain?: string+/*** Template ID.*/@@ -246,6 +251,7 @@ export class SandboxApi {return {sandboxId: res.data.sandboxID,+ sandboxDomain: res.data!.domain || undefined,templateId: res.data.templateID,...(res.data.alias && { name: res.data.alias }),metadata: res.data.metadata ?? {},@@ -304,6 +310,7 @@ export class SandboxApi {}): Promise<{sandboxId: string+ sandboxDomain?: stringenvdVersion: stringenvdAccessToken?: string}> {@@ -337,6 +344,7 @@ export class SandboxApi {return {sandboxId: res.data!.sandboxID,+ sandboxDomain: res.data!.domain || undefined,envdVersion: res.data!.envdVersion,envdAccessToken: res.data!.envdAccessToken}diff --git a/packages/python-sdk/e2b/api/__init__.py b/packages/python-sdk/e2b/api/__init__.pyindex 614ff25e1..93953fa6a 100644--- a/packages/python-sdk/e2b/api/__init__.py+++ b/packages/python-sdk/e2b/api/__init__.py@@ -21,6 +21,7 @@ logger = logging.getLogger(__name__)@dataclassclass SandboxCreateResponse:sandbox_id: str+ sandbox_domain: Optional[str]envd_version: strenvd_access_token: strdiff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.pyindex b26bbcfb3..e7a2d4145 100644--- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py+++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py@@ -6,17 +6,19 @@ import httpxfrom ... import errorsfrom ...client import AuthenticatedClient, Clientfrom ...models.error import Error-from ...models.running_sandbox_with_metrics import RunningSandboxWithMetrics-from ...types import UNSET, Response, Unset+from ...models.sandboxes_with_metrics import SandboxesWithMetrics+from ...types import UNSET, Responsedef _get_kwargs(*,- metadata: Union[Unset, str] = UNSET,+ sandbox_ids: list[str],) -> dict[str, Any]:params: dict[str, Any] = {}- params["metadata"] = metadata+ json_sandbox_ids = sandbox_ids++ params["sandbox_ids"] = json_sandbox_idsparams = {k: v for k, v in params.items() if v is not UNSET and v is not None}@@ -31,16 +33,9 @@ def _get_kwargs(def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response-) -> Optional[Union[Error, list["RunningSandboxWithMetrics"]]]:+) -> Optional[Union[Error, SandboxesWithMetrics]]:if response.status_code == 200:- response_200 = []- _response_200 = response.json()- for response_200_item_data in _response_200:- response_200_item = RunningSandboxWithMetrics.from_dict(- response_200_item_data- )-- response_200.append(response_200_item)+ response_200 = SandboxesWithMetrics.from_dict(response.json())return response_200if response.status_code == 400:@@ -63,7 +58,7 @@ def _parse_response(def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response-) -> Response[Union[Error, list["RunningSandboxWithMetrics"]]]:+) -> Response[Union[Error, SandboxesWithMetrics]]:return Response(status_code=HTTPStatus(response.status_code),content=response.content,@@ -75,23 +70,23 @@ def _build_response(def sync_detailed(*,client: AuthenticatedClient,- metadata: Union[Unset, str] = UNSET,-) -> Response[Union[Error, list["RunningSandboxWithMetrics"]]]:- """List all running sandboxes with metrics+ sandbox_ids: list[str],+) -> Response[Union[Error, SandboxesWithMetrics]]:+ """List metrics for given sandboxesArgs:- metadata (Union[Unset, str]):+ sandbox_ids (list[str]):Raises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.Returns:- Response[Union[Error, list['RunningSandboxWithMetrics']]]+ Response[Union[Error, SandboxesWithMetrics]]"""kwargs = _get_kwargs(- metadata=metadata,+ sandbox_ids=sandbox_ids,)response = client.get_httpx_client().request(@@ -104,47 +99,47 @@ def sync_detailed(def sync(*,client: AuthenticatedClient,- metadata: Union[Unset, str] = UNSET,-) -> Optional[Union[Error, list["RunningSandboxWithMetrics"]]]:- """List all running sandboxes with metrics+ sandbox_ids: list[str],+) -> Optional[Union[Error, SandboxesWithMetrics]]:+ """List metrics for given sandboxesArgs:- metadata (Union[Unset, str]):+ sandbox_ids (list[str]):Raises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.Returns:- Union[Error, list['RunningSandboxWithMetrics']]+ Union[Error, SandboxesWithMetrics]"""return sync_detailed(client=client,- metadata=metadata,+ sandbox_ids=sandbox_ids,).parsedasync def asyncio_detailed(*,client: AuthenticatedClient,- metadata: Union[Unset, str] = UNSET,-) -> Response[Union[Error, list["RunningSandboxWithMetrics"]]]:- """List all running sandboxes with metrics+ sandbox_ids: list[str],+) -> Response[Union[Error, SandboxesWithMetrics]]:+ """List metrics for given sandboxesArgs:- metadata (Union[Unset, str]):+ sandbox_ids (list[str]):Raises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.Returns:- Response[Union[Error, list['RunningSandboxWithMetrics']]]+ Response[Union[Error, SandboxesWithMetrics]]"""kwargs = _get_kwargs(- metadata=metadata,+ sandbox_ids=sandbox_ids,)response = await client.get_async_httpx_client().request(**kwargs)@@ -155,24 +150,24 @@ async def asyncio_detailed(async def asyncio(*,client: AuthenticatedClient,- metadata: Union[Unset, str] = UNSET,-) -> Optional[Union[Error, list["RunningSandboxWithMetrics"]]]:- """List all running sandboxes with metrics+ sandbox_ids: list[str],+) -> Optional[Union[Error, SandboxesWithMetrics]]:+ """List metrics for given sandboxesArgs:- metadata (Union[Unset, str]):+ sandbox_ids (list[str]):Raises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.Returns:- Union[Error, list['RunningSandboxWithMetrics']]+ Union[Error, SandboxesWithMetrics]"""return (await asyncio_detailed(client=client,- metadata=metadata,+ sandbox_ids=sandbox_ids,)).parseddiff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.pyindex 0ce53aa30..c3f4c0037 100644--- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py+++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py@@ -7,15 +7,27 @@ from ... import errorsfrom ...client import AuthenticatedClient, Clientfrom ...models.error import Errorfrom ...models.sandbox_metric import SandboxMetric-from ...types import Response+from ...types import UNSET, Response, Unsetdef _get_kwargs(sandbox_id: str,+ *,+ start: Union[Unset, int] = UNSET,+ end: Union[Unset, int] = UNSET,) -> dict[str, Any]:+ params: dict[str, Any] = {}++ params["start"] = start++ params["end"] = end++ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}+_kwargs: dict[str, Any] = {"method": "get","url": f"/sandboxes/{sandbox_id}/metrics",+ "params": params,}return _kwargs@@ -33,6 +45,10 @@ def _parse_response(response_200.append(response_200_item)return response_200+ if response.status_code == 400:+ response_400 = Error.from_dict(response.json())++ return response_400if response.status_code == 401:response_401 = Error.from_dict(response.json())@@ -66,11 +82,16 @@ def sync_detailed(sandbox_id: str,*,client: AuthenticatedClient,+ start: Union[Unset, int] = UNSET,+ end: Union[Unset, int] = UNSET,) -> Response[Union[Error, list["SandboxMetric"]]]:"""Get sandbox metricsArgs:sandbox_id (str):+ start (Union[Unset, int]):+ end (Union[Unset, int]): Ending timestamp of the metrics that should be returned in+ millisecondsRaises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.@@ -82,6 +103,8 @@ def sync_detailed(kwargs = _get_kwargs(sandbox_id=sandbox_id,+ start=start,+ end=end,)response = client.get_httpx_client().request(@@ -95,11 +118,16 @@ def sync(sandbox_id: str,*,client: AuthenticatedClient,+ start: Union[Unset, int] = UNSET,+ end: Union[Unset, int] = UNSET,) -> Optional[Union[Error, list["SandboxMetric"]]]:"""Get sandbox metricsArgs:sandbox_id (str):+ start (Union[Unset, int]):+ end (Union[Unset, int]): Ending timestamp of the metrics that should be returned in+ millisecondsRaises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.@@ -112,6 +140,8 @@ def sync(return sync_detailed(sandbox_id=sandbox_id,client=client,+ start=start,+ end=end,).parsed@@ -119,11 +149,16 @@ async def asyncio_detailed(sandbox_id: str,*,client: AuthenticatedClient,+ start: Union[Unset, int] = UNSET,+ end: Union[Unset, int] = UNSET,) -> Response[Union[Error, list["SandboxMetric"]]]:"""Get sandbox metricsArgs:sandbox_id (str):+ start (Union[Unset, int]):+ end (Union[Unset, int]): Ending timestamp of the metrics that should be returned in+ millisecondsRaises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.@@ -135,6 +170,8 @@ async def asyncio_detailed(kwargs = _get_kwargs(sandbox_id=sandbox_id,+ start=start,+ end=end,)response = await client.get_async_httpx_client().request(**kwargs)@@ -146,11 +183,16 @@ async def asyncio(sandbox_id: str,*,client: AuthenticatedClient,+ start: Union[Unset, int] = UNSET,+ end: Union[Unset, int] = UNSET,) -> Optional[Union[Error, list["SandboxMetric"]]]:"""Get sandbox metricsArgs:sandbox_id (str):+ start (Union[Unset, int]):+ end (Union[Unset, int]): Ending timestamp of the metrics that should be returned in+ millisecondsRaises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.@@ -164,5 +206,7 @@ async def asyncio(await asyncio_detailed(sandbox_id=sandbox_id,client=client,+ start=start,+ end=end,)).parseddiff --git a/packages/python-sdk/e2b/api/client/models/__init__.py b/packages/python-sdk/e2b/api/client/models/__init__.pyindex 1cec9c41a..5dc96d9c3 100644--- a/packages/python-sdk/e2b/api/client/models/__init__.py+++ b/packages/python-sdk/e2b/api/client/models/__init__.py@@ -3,6 +3,7 @@from .created_access_token import CreatedAccessTokenfrom .created_team_api_key import CreatedTeamAPIKeyfrom .error import Error+from .identifier_masking_details import IdentifierMaskingDetailsfrom .listed_sandbox import ListedSandboxfrom .new_access_token import NewAccessTokenfrom .new_sandbox import NewSandbox@@ -16,13 +17,13 @@ from .post_sandboxes_sandbox_id_refreshes_body import ()from .post_sandboxes_sandbox_id_timeout_body import PostSandboxesSandboxIDTimeoutBodyfrom .resumed_sandbox import ResumedSandbox-from .running_sandbox_with_metrics import RunningSandboxWithMetricsfrom .sandbox import Sandboxfrom .sandbox_detail import SandboxDetailfrom .sandbox_log import SandboxLogfrom .sandbox_logs import SandboxLogsfrom .sandbox_metric import SandboxMetricfrom .sandbox_state import SandboxState+from .sandboxes_with_metrics import SandboxesWithMetricsfrom .team import Teamfrom .team_api_key import TeamAPIKeyfrom .team_user import TeamUser@@ -37,6 +38,7 @@ __all__ = ("CreatedAccessToken","CreatedTeamAPIKey","Error",+ "IdentifierMaskingDetails","ListedSandbox","NewAccessToken","NewSandbox",@@ -48,9 +50,9 @@ __all__ = ("PostSandboxesSandboxIDRefreshesBody","PostSandboxesSandboxIDTimeoutBody","ResumedSandbox",- "RunningSandboxWithMetrics","Sandbox","SandboxDetail",+ "SandboxesWithMetrics","SandboxLog","SandboxLogs","SandboxMetric",diff --git a/packages/python-sdk/e2b/api/client/models/created_access_token.py b/packages/python-sdk/e2b/api/client/models/created_access_token.pyindex beb225edb..04224adbc 100644--- a/packages/python-sdk/e2b/api/client/models/created_access_token.py+++ b/packages/python-sdk/e2b/api/client/models/created_access_token.py@@ -1,12 +1,16 @@import datetimefrom collections.abc import Mapping-from typing import Any, TypeVar+from typing import TYPE_CHECKING, Any, TypeVarfrom uuid import UUIDfrom attrs import define as _attrs_definefrom attrs import field as _attrs_fieldfrom dateutil.parser import isoparse+if TYPE_CHECKING:+ from ..models.identifier_masking_details import IdentifierMaskingDetails++T = TypeVar("T", bound="CreatedAccessToken")@@ -16,16 +20,16 @@ class CreatedAccessToken:Attributes:created_at (datetime.datetime): Timestamp of access token creationid (UUID): Identifier of the access token+ mask (IdentifierMaskingDetails):name (str): Name of the access token- token (str): Raw value of the access token- token_mask (str): Mask of the access token+ token (str): The fully created access token"""created_at: datetime.datetimeid: UUID+ mask: "IdentifierMaskingDetails"name: strtoken: str- token_mask: stradditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)def to_dict(self) -> dict[str, Any]:@@ -33,21 +37,21 @@ class CreatedAccessToken:id = str(self.id)+ mask = self.mask.to_dict()+name = self.nametoken = self.token- token_mask = self.token_mask-field_dict: dict[str, Any] = {}field_dict.update(self.additional_properties)field_dict.update({"createdAt": created_at,"id": id,+ "mask": mask,"name": name,"token": token,- "tokenMask": token_mask,})@@ -55,23 +59,25 @@ class CreatedAccessToken:@classmethoddef from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:+ from ..models.identifier_masking_details import IdentifierMaskingDetails+d = dict(src_dict)created_at = isoparse(d.pop("createdAt"))id = UUID(d.pop("id"))+ mask = IdentifierMaskingDetails.from_dict(d.pop("mask"))+name = d.pop("name")token = d.pop("token")- token_mask = d.pop("tokenMask")-created_access_token = cls(created_at=created_at,id=id,+ mask=mask,name=name,token=token,- token_mask=token_mask,)created_access_token.additional_properties = ddiff --git a/packages/python-sdk/e2b/api/client/models/created_team_api_key.py b/packages/python-sdk/e2b/api/client/models/created_team_api_key.pyindex 55a2a88cc..f1d4150b7 100644--- a/packages/python-sdk/e2b/api/client/models/created_team_api_key.py+++ b/packages/python-sdk/e2b/api/client/models/created_team_api_key.py@@ -7,7 +7,10 @@ from attrs import define as _attrs_definefrom attrs import field as _attrs_fieldfrom dateutil.parser import isoparse+from ..types import UNSET, Unset+if TYPE_CHECKING:+ from ..models.identifier_masking_details import IdentifierMaskingDetailsfrom ..models.team_user import TeamUser@@ -19,21 +22,21 @@ class CreatedTeamAPIKey:"""Attributes:created_at (datetime.datetime): Timestamp of API key creation- created_by (Union['TeamUser', None]):id (UUID): Identifier of the API keykey (str): Raw value of the API key- key_mask (str): Mask of the API key- last_used (Union[None, datetime.datetime]): Last time this API key was used+ mask (IdentifierMaskingDetails):name (str): Name of the API key+ created_by (Union['TeamUser', None, Unset]):+ last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used"""created_at: datetime.datetime- created_by: Union["TeamUser", None]id: UUIDkey: str- key_mask: str- last_used: Union[None, datetime.datetime]+ mask: "IdentifierMaskingDetails"name: str+ created_by: Union["TeamUser", None, Unset] = UNSET+ last_used: Union[None, Unset, datetime.datetime] = UNSETadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)def to_dict(self) -> dict[str, Any]:@@ -41,52 +44,69 @@ class CreatedTeamAPIKey:created_at = self.created_at.isoformat()- created_by: Union[None, dict[str, Any]]- if isinstance(self.created_by, TeamUser):- created_by = self.created_by.to_dict()- else:- created_by = self.created_by-id = str(self.id)key = self.key- key_mask = self.key_mask+ mask = self.mask.to_dict()- last_used: Union[None, str]- if isinstance(self.last_used, datetime.datetime):+ name = self.name++ created_by: Union[None, Unset, dict[str, Any]]+ if isinstance(self.created_by, Unset):+ created_by = UNSET+ elif isinstance(self.created_by, TeamUser):+ created_by = self.created_by.to_dict()+ else:+ created_by = self.created_by++ last_used: Union[None, Unset, str]+ if isinstance(self.last_used, Unset):+ last_used = UNSET+ elif isinstance(self.last_used, datetime.datetime):last_used = self.last_used.isoformat()else:last_used = self.last_used- name = self.name-field_dict: dict[str, Any] = {}field_dict.update(self.additional_properties)field_dict.update({"createdAt": created_at,- "createdBy": created_by,"id": id,"key": key,- "keyMask": key_mask,- "lastUsed": last_used,+ "mask": mask,"name": name,})+ if created_by is not UNSET:+ field_dict["createdBy"] = created_by+ if last_used is not UNSET:+ field_dict["lastUsed"] = last_usedreturn field_dict@classmethoddef from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:+ from ..models.identifier_masking_details import IdentifierMaskingDetailsfrom ..models.team_user import TeamUserd = dict(src_dict)created_at = isoparse(d.pop("createdAt"))- def _parse_created_by(data: object) -> Union["TeamUser", None]:+ id = UUID(d.pop("id"))++ key = d.pop("key")++ mask = IdentifierMaskingDetails.from_dict(d.pop("mask"))++ name = d.pop("name")++ def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]:if data is None:return data+ if isinstance(data, Unset):+ return datatry:if not isinstance(data, dict):raise TypeError()@@ -95,19 +115,15 @@ class CreatedTeamAPIKey:return created_by_type_1except: # noqa: E722pass- return cast(Union["TeamUser", None], data)-- created_by = _parse_created_by(d.pop("createdBy"))-- id = UUID(d.pop("id"))-- key = d.pop("key")+ return cast(Union["TeamUser", None, Unset], data)- key_mask = d.pop("keyMask")+ created_by = _parse_created_by(d.pop("createdBy", UNSET))- def _parse_last_used(data: object) -> Union[None, datetime.datetime]:+ def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]:if data is None:return data+ if isinstance(data, Unset):+ return datatry:if not isinstance(data, str):raise TypeError()@@ -116,20 +132,18 @@ class CreatedTeamAPIKey:return last_used_type_0except: # noqa: E722pass- return cast(Union[None, datetime.datetime], data)+ return cast(Union[None, Unset, datetime.datetime], data)- last_used = _parse_last_used(d.pop("lastUsed"))-- name = d.pop("name")+ last_used = _parse_last_used(d.pop("lastUsed", UNSET))created_team_api_key = cls(created_at=created_at,- created_by=created_by,id=id,key=key,- key_mask=key_mask,- last_used=last_used,+ mask=mask,name=name,+ created_by=created_by,+ last_used=last_used,)created_team_api_key.additional_properties = ddiff --git a/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py b/packages/python-sdk/e2b/api/client/models/identifier_masking_details.pynew file mode 100644index 000000000..60c0bdedb--- /dev/null+++ b/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py@@ -0,0 +1,83 @@+from collections.abc import Mapping+from typing import Any, TypeVar++from attrs import define as _attrs_define+from attrs import field as _attrs_field++T = TypeVar("T", bound="IdentifierMaskingDetails")+++@_attrs_define+class IdentifierMaskingDetails:+ """+ Attributes:+ masked_value_prefix (str): Prefix used in masked version of the token or key+ masked_value_suffix (str): Suffix used in masked version of the token or key+ prefix (str): Prefix that identifies the token or key type+ value_length (int): Length of the token or key+ """++ masked_value_prefix: str+ masked_value_suffix: str+ prefix: str+ value_length: int+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)++ def to_dict(self) -> dict[str, Any]:+ masked_value_prefix = self.masked_value_prefix++ masked_value_suffix = self.masked_value_suffix++ prefix = self.prefix++ value_length = self.value_length++ field_dict: dict[str, Any] = {}+ field_dict.update(self.additional_properties)+ field_dict.update(+ {+ "maskedValuePrefix": masked_value_prefix,+ "maskedValueSuffix": masked_value_suffix,+ "prefix": prefix,+ "valueLength": value_length,+ }+ )++ return field_dict++ @classmethod+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:+ d = dict(src_dict)+ masked_value_prefix = d.pop("maskedValuePrefix")++ masked_value_suffix = d.pop("maskedValueSuffix")++ prefix = d.pop("prefix")++ value_length = d.pop("valueLength")++ identifier_masking_details = cls(+ masked_value_prefix=masked_value_prefix,+ masked_value_suffix=masked_value_suffix,+ prefix=prefix,+ value_length=value_length,+ )++ identifier_masking_details.additional_properties = d+ return identifier_masking_details++ @property+ def additional_keys(self) -> list[str]:+ return list(self.additional_properties.keys())++ def __getitem__(self, key: str) -> Any:+ return self.additional_properties[key]++ def __setitem__(self, key: str, value: Any) -> None:+ self.additional_properties[key] = value++ def __delitem__(self, key: str) -> None:+ del self.additional_properties[key]++ def __contains__(self, key: str) -> bool:+ return key in self.additional_propertiesdiff --git a/packages/python-sdk/e2b/api/client/models/node.py b/packages/python-sdk/e2b/api/client/models/node.pyindex 3e18f67d3..592348ec4 100644--- a/packages/python-sdk/e2b/api/client/models/node.py+++ b/packages/python-sdk/e2b/api/client/models/node.py@@ -1,10 +1,11 @@from collections.abc import Mapping-from typing import Any, TypeVar+from typing import Any, TypeVar, Union, castfrom attrs import define as _attrs_definefrom attrs import field as _attrs_fieldfrom ..models.node_status import NodeStatus+from ..types import UNSET, UnsetT = TypeVar("T", bound="Node")@@ -15,22 +16,28 @@ class Node:Attributes:allocated_cpu (int): Number of allocated CPU coresallocated_memory_mi_b (int): Amount of allocated memory in MiB+ commit (str): Commit of the orchestratorcreate_fails (int): Number of sandbox create fails+ create_successes (int): Number of sandbox create successesnode_id (str): Identifier of the nodesandbox_count (int): Number of sandboxes running on the nodesandbox_starting_count (int): Number of starting Sandboxesstatus (NodeStatus): Status of the nodeversion (str): Version of the orchestrator+ cluster_id (Union[None, Unset, str]): Identifier of the cluster"""allocated_cpu: intallocated_memory_mi_b: int+ commit: strcreate_fails: int+ create_successes: intnode_id: strsandbox_count: intsandbox_starting_count: intstatus: NodeStatusversion: str+ cluster_id: Union[None, Unset, str] = UNSETadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)def to_dict(self) -> dict[str, Any]:@@ -38,8 +45,12 @@ class Node:allocated_memory_mi_b = self.allocated_memory_mi_b+ commit = self.commit+create_fails = self.create_fails+ create_successes = self.create_successes+node_id = self.node_idsandbox_count = self.sandbox_count@@ -50,13 +61,21 @@ class Node:version = self.version+ cluster_id: Union[None, Unset, str]+ if isinstance(self.cluster_id, Unset):+ cluster_id = UNSET+ else:+ cluster_id = self.cluster_id+field_dict: dict[str, Any] = {}field_dict.update(self.additional_properties)field_dict.update({"allocatedCPU": allocated_cpu,"allocatedMemoryMiB": allocated_memory_mi_b,+ "commit": commit,"createFails": create_fails,+ "createSuccesses": create_successes,"nodeID": node_id,"sandboxCount": sandbox_count,"sandboxStartingCount": sandbox_starting_count,@@ -64,6 +83,8 @@ class Node:"version": version,})+ if cluster_id is not UNSET:+ field_dict["clusterID"] = cluster_idreturn field_dict@@ -74,8 +95,12 @@ class Node:allocated_memory_mi_b = d.pop("allocatedMemoryMiB")+ commit = d.pop("commit")+create_fails = d.pop("createFails")+ create_successes = d.pop("createSuccesses")+node_id = d.pop("nodeID")sandbox_count = d.pop("sandboxCount")@@ -86,15 +111,27 @@ class Node:version = d.pop("version")+ def _parse_cluster_id(data: object) -> Union[None, Unset, str]:+ if data is None:+ return data+ if isinstance(data, Unset):+ return data+ return cast(Union[None, Unset, str], data)++ cluster_id = _parse_cluster_id(d.pop("clusterID", UNSET))+node = cls(allocated_cpu=allocated_cpu,allocated_memory_mi_b=allocated_memory_mi_b,+ commit=commit,create_fails=create_fails,+ create_successes=create_successes,node_id=node_id,sandbox_count=sandbox_count,sandbox_starting_count=sandbox_starting_count,status=status,version=version,+ cluster_id=cluster_id,)node.additional_properties = ddiff --git a/packages/python-sdk/e2b/api/client/models/node_detail.py b/packages/python-sdk/e2b/api/client/models/node_detail.pyindex 6f523d37f..ea60fd31b 100644--- a/packages/python-sdk/e2b/api/client/models/node_detail.py+++ b/packages/python-sdk/e2b/api/client/models/node_detail.py@@ -1,10 +1,11 @@from collections.abc import Mapping-from typing import TYPE_CHECKING, Any, TypeVar, cast+from typing import TYPE_CHECKING, Any, TypeVar, Union, castfrom attrs import define as _attrs_definefrom attrs import field as _attrs_fieldfrom ..models.node_status import NodeStatus+from ..types import UNSET, Unsetif TYPE_CHECKING:from ..models.listed_sandbox import ListedSandbox@@ -18,26 +19,36 @@ class NodeDetail:"""Attributes:cached_builds (list[str]): List of cached builds id on the node+ commit (str): Commit of the orchestratorcreate_fails (int): Number of sandbox create fails+ create_successes (int): Number of sandbox create successesnode_id (str): Identifier of the nodesandboxes (list['ListedSandbox']): List of sandboxes running on the nodestatus (NodeStatus): Status of the nodeversion (str): Version of the orchestrator+ cluster_id (Union[None, Unset, str]): Identifier of the cluster"""cached_builds: list[str]+ commit: strcreate_fails: int+ create_successes: intnode_id: strsandboxes: list["ListedSandbox"]status: NodeStatusversion: str+ cluster_id: Union[None, Unset, str] = UNSETadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)def to_dict(self) -> dict[str, Any]:cached_builds = self.cached_builds+ commit = self.commit+create_fails = self.create_fails+ create_successes = self.create_successes+node_id = self.node_idsandboxes = []@@ -49,18 +60,28 @@ class NodeDetail:version = self.version+ cluster_id: Union[None, Unset, str]+ if isinstance(self.cluster_id, Unset):+ cluster_id = UNSET+ else:+ cluster_id = self.cluster_id+field_dict: dict[str, Any] = {}field_dict.update(self.additional_properties)field_dict.update({"cachedBuilds": cached_builds,+ "commit": commit,"createFails": create_fails,+ "createSuccesses": create_successes,"nodeID": node_id,"sandboxes": sandboxes,"status": status,"version": version,})+ if cluster_id is not UNSET:+ field_dict["clusterID"] = cluster_idreturn field_dict@@ -71,8 +92,12 @@ class NodeDetail:d = dict(src_dict)cached_builds = cast(list[str], d.pop("cachedBuilds"))+ commit = d.pop("commit")+create_fails = d.pop("createFails")+ create_successes = d.pop("createSuccesses")+node_id = d.pop("nodeID")sandboxes = []@@ -86,13 +111,25 @@ class NodeDetail:version = d.pop("version")+ def _parse_cluster_id(data: object) -> Union[None, Unset, str]:+ if data is None:+ return data+ if isinstance(data, Unset):+ return data+ return cast(Union[None, Unset, str], data)++ cluster_id = _parse_cluster_id(d.pop("clusterID", UNSET))+node_detail = cls(cached_builds=cached_builds,+ commit=commit,create_fails=create_fails,+ create_successes=create_successes,node_id=node_id,sandboxes=sandboxes,status=status,version=version,+ cluster_id=cluster_id,)node_detail.additional_properties = ddiff --git a/packages/python-sdk/e2b/api/client/models/running_sandbox_with_metrics.py b/packages/python-sdk/e2b/api/client/models/running_sandbox_with_metrics.pydeleted file mode 100644index e4b360f90..000000000--- a/packages/python-sdk/e2b/api/client/models/running_sandbox_with_metrics.py+++ /dev/null@@ -1,154 +0,0 @@-import datetime-from collections.abc import Mapping-from typing import TYPE_CHECKING, Any, TypeVar, Union--from attrs import define as _attrs_define-from attrs import field as _attrs_field-from dateutil.parser import isoparse--from ..types import UNSET, Unset--if TYPE_CHECKING:- from ..models.sandbox_metric import SandboxMetric---T = TypeVar("T", bound="RunningSandboxWithMetrics")---@_attrs_define-class RunningSandboxWithMetrics:- """- Attributes:- client_id (str): Identifier of the client- cpu_count (int): CPU cores for the sandbox- end_at (datetime.datetime): Time when the sandbox will expire- memory_mb (int): Memory for the sandbox in MB- sandbox_id (str): Identifier of the sandbox- started_at (datetime.datetime): Time when the sandbox was started- template_id (str): Identifier of the template from which is the sandbox created- alias (Union[Unset, str]): Alias of the template- metadata (Union[Unset, Any]):- metrics (Union[Unset, list['SandboxMetric']]):- """-- client_id: str- cpu_count: int- end_at: datetime.datetime- memory_mb: int- sandbox_id: str- started_at: datetime.datetime- template_id: str- alias: Union[Unset, str] = UNSET- metadata: Union[Unset, Any] = UNSET- metrics: Union[Unset, list["SandboxMetric"]] = UNSET- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)-- def to_dict(self) -> dict[str, Any]:- client_id = self.client_id-- cpu_count = self.cpu_count-- end_at = self.end_at.isoformat()-- memory_mb = self.memory_mb-- sandbox_id = self.sandbox_id-- started_at = self.started_at.isoformat()-- template_id = self.template_id-- alias = self.alias-- metadata = self.metadata-- metrics: Union[Unset, list[dict[str, Any]]] = UNSET- if not isinstance(self.metrics, Unset):- metrics = []- for metrics_item_data in self.metrics:- metrics_item = metrics_item_data.to_dict()- metrics.append(metrics_item)-- field_dict: dict[str, Any] = {}- field_dict.update(self.additional_properties)- field_dict.update(- {- "clientID": client_id,- "cpuCount": cpu_count,- "endAt": end_at,- "memoryMB": memory_mb,- "sandboxID": sandbox_id,- "startedAt": started_at,- "templateID": template_id,- }- )- if alias is not UNSET:- field_dict["alias"] = alias- if metadata is not UNSET:- field_dict["metadata"] = metadata- if metrics is not UNSET:- field_dict["metrics"] = metrics-- return field_dict-- @classmethod- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:- from ..models.sandbox_metric import SandboxMetric-- d = dict(src_dict)- client_id = d.pop("clientID")-- cpu_count = d.pop("cpuCount")-- end_at = isoparse(d.pop("endAt"))-- memory_mb = d.pop("memoryMB")-- sandbox_id = d.pop("sandboxID")-- started_at = isoparse(d.pop("startedAt"))-- template_id = d.pop("templateID")-- alias = d.pop("alias", UNSET)-- metadata = d.pop("metadata", UNSET)-- metrics = []- _metrics = d.pop("metrics", UNSET)- for metrics_item_data in _metrics or []:- metrics_item = SandboxMetric.from_dict(metrics_item_data)-- metrics.append(metrics_item)-- running_sandbox_with_metrics = cls(- client_id=client_id,- cpu_count=cpu_count,- end_at=end_at,- memory_mb=memory_mb,- sandbox_id=sandbox_id,- started_at=started_at,- template_id=template_id,- alias=alias,- metadata=metadata,- metrics=metrics,- )-- running_sandbox_with_metrics.additional_properties = d- return running_sandbox_with_metrics-- @property- def additional_keys(self) -> list[str]:- return list(self.additional_properties.keys())-- def __getitem__(self, key: str) -> Any:- return self.additional_properties[key]-- def __setitem__(self, key: str, value: Any) -> None:- self.additional_properties[key] = value-- def __delitem__(self, key: str) -> None:- del self.additional_properties[key]-- def __contains__(self, key: str) -> bool:- return key in self.additional_propertiesdiff --git a/packages/python-sdk/e2b/api/client/models/sandbox.py b/packages/python-sdk/e2b/api/client/models/sandbox.pyindex b3b7caa87..7f3f9f54f 100644--- a/packages/python-sdk/e2b/api/client/models/sandbox.py+++ b/packages/python-sdk/e2b/api/client/models/sandbox.py@@ -1,5 +1,5 @@from collections.abc import Mapping-from typing import Any, TypeVar, Union+from typing import Any, TypeVar, Union, castfrom attrs import define as _attrs_definefrom attrs import field as _attrs_field@@ -18,6 +18,7 @@ class Sandbox:sandbox_id (str): Identifier of the sandboxtemplate_id (str): Identifier of the template from which is the sandbox createdalias (Union[Unset, str]): Alias of the template+ domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessibleenvd_access_token (Union[Unset, str]): Access token used for envd communication"""@@ -26,6 +27,7 @@ class Sandbox:sandbox_id: strtemplate_id: stralias: Union[Unset, str] = UNSET+ domain: Union[None, Unset, str] = UNSETenvd_access_token: Union[Unset, str] = UNSETadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)@@ -40,6 +42,12 @@ class Sandbox:alias = self.alias+ domain: Union[None, Unset, str]+ if isinstance(self.domain, Unset):+ domain = UNSET+ else:+ domain = self.domain+envd_access_token = self.envd_access_tokenfield_dict: dict[str, Any] = {}@@ -54,6 +62,8 @@ class Sandbox:)if alias is not UNSET:field_dict["alias"] = alias+ if domain is not UNSET:+ field_dict["domain"] = domainif envd_access_token is not UNSET:field_dict["envdAccessToken"] = envd_access_token@@ -72,6 +82,15 @@ class Sandbox:alias = d.pop("alias", UNSET)+ def _parse_domain(data: object) -> Union[None, Unset, str]:+ if data is None:+ return data+ if isinstance(data, Unset):+ return data+ return cast(Union[None, Unset, str], data)++ domain = _parse_domain(d.pop("domain", UNSET))+envd_access_token = d.pop("envdAccessToken", UNSET)sandbox = cls(@@ -80,6 +99,7 @@ class Sandbox:sandbox_id=sandbox_id,template_id=template_id,alias=alias,+ domain=domain,envd_access_token=envd_access_token,)diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_detail.py b/packages/python-sdk/e2b/api/client/models/sandbox_detail.pyindex dacfda150..02e6ec2a4 100644--- a/packages/python-sdk/e2b/api/client/models/sandbox_detail.py+++ b/packages/python-sdk/e2b/api/client/models/sandbox_detail.py@@ -1,6 +1,6 @@import datetimefrom collections.abc import Mapping-from typing import Any, TypeVar, Union+from typing import Any, TypeVar, Union, castfrom attrs import define as _attrs_definefrom attrs import field as _attrs_field@@ -25,6 +25,7 @@ class SandboxDetail:state (SandboxState): State of the sandboxtemplate_id (str): Identifier of the template from which is the sandbox createdalias (Union[Unset, str]): Alias of the template+ domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessibleenvd_access_token (Union[Unset, str]): Access token used for envd communicationenvd_version (Union[Unset, str]): Version of the envd running in the sandboxmetadata (Union[Unset, Any]):@@ -39,6 +40,7 @@ class SandboxDetail:state: SandboxStatetemplate_id: stralias: Union[Unset, str] = UNSET+ domain: Union[None, Unset, str] = UNSETenvd_access_token: Union[Unset, str] = UNSETenvd_version: Union[Unset, str] = UNSETmetadata: Union[Unset, Any] = UNSET@@ -63,6 +65,12 @@ class SandboxDetail:alias = self.alias+ domain: Union[None, Unset, str]+ if isinstance(self.domain, Unset):+ domain = UNSET+ else:+ domain = self.domain+envd_access_token = self.envd_access_tokenenvd_version = self.envd_version@@ -85,6 +93,8 @@ class SandboxDetail:)if alias is not UNSET:field_dict["alias"] = alias+ if domain is not UNSET:+ field_dict["domain"] = domainif envd_access_token is not UNSET:field_dict["envdAccessToken"] = envd_access_tokenif envd_version is not UNSET:@@ -115,6 +125,15 @@ class SandboxDetail:alias = d.pop("alias", UNSET)+ def _parse_domain(data: object) -> Union[None, Unset, str]:+ if data is None:+ return data+ if isinstance(data, Unset):+ return data+ return cast(Union[None, Unset, str], data)++ domain = _parse_domain(d.pop("domain", UNSET))+envd_access_token = d.pop("envdAccessToken", UNSET)envd_version = d.pop("envdVersion", UNSET)@@ -131,6 +150,7 @@ class SandboxDetail:state=state,template_id=template_id,alias=alias,+ domain=domain,envd_access_token=envd_access_token,envd_version=envd_version,metadata=metadata,diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_metric.py b/packages/python-sdk/e2b/api/client/models/sandbox_metric.pyindex 7526ba933..3ac132ae2 100644--- a/packages/python-sdk/e2b/api/client/models/sandbox_metric.py+++ b/packages/python-sdk/e2b/api/client/models/sandbox_metric.py@@ -16,15 +16,15 @@ class SandboxMetric:Attributes:cpu_count (int): Number of CPU corescpu_used_pct (float): CPU usage percentage- mem_total_mi_b (int): Total memory in MiB- mem_used_mi_b (int): Memory used in MiB+ mem_total (int): Total memory in bytes+ mem_used (int): Memory used in bytestimestamp (datetime.datetime): Timestamp of the metric entry"""cpu_count: intcpu_used_pct: float- mem_total_mi_b: int- mem_used_mi_b: int+ mem_total: int+ mem_used: inttimestamp: datetime.datetimeadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)@@ -33,9 +33,9 @@ class SandboxMetric:cpu_used_pct = self.cpu_used_pct- mem_total_mi_b = self.mem_total_mi_b+ mem_total = self.mem_total- mem_used_mi_b = self.mem_used_mi_b+ mem_used = self.mem_usedtimestamp = self.timestamp.isoformat()@@ -45,8 +45,8 @@ class SandboxMetric:{"cpuCount": cpu_count,"cpuUsedPct": cpu_used_pct,- "memTotalMiB": mem_total_mi_b,- "memUsedMiB": mem_used_mi_b,+ "memTotal": mem_total,+ "memUsed": mem_used,"timestamp": timestamp,})@@ -60,17 +60,17 @@ class SandboxMetric:cpu_used_pct = d.pop("cpuUsedPct")- mem_total_mi_b = d.pop("memTotalMiB")+ mem_total = d.pop("memTotal")- mem_used_mi_b = d.pop("memUsedMiB")+ mem_used = d.pop("memUsed")timestamp = isoparse(d.pop("timestamp"))sandbox_metric = cls(cpu_count=cpu_count,cpu_used_pct=cpu_used_pct,- mem_total_mi_b=mem_total_mi_b,- mem_used_mi_b=mem_used_mi_b,+ mem_total=mem_total,+ mem_used=mem_used,timestamp=timestamp,)diff --git a/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py b/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.pynew file mode 100644index 000000000..64981d955--- /dev/null+++ b/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py@@ -0,0 +1,59 @@+from collections.abc import Mapping+from typing import Any, TypeVar++from attrs import define as _attrs_define+from attrs import field as _attrs_field++T = TypeVar("T", bound="SandboxesWithMetrics")+++@_attrs_define+class SandboxesWithMetrics:+ """+ Attributes:+ sandboxes (Any):+ """++ sandboxes: Any+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)++ def to_dict(self) -> dict[str, Any]:+ sandboxes = self.sandboxes++ field_dict: dict[str, Any] = {}+ field_dict.update(self.additional_properties)+ field_dict.update(+ {+ "sandboxes": sandboxes,+ }+ )++ return field_dict++ @classmethod+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:+ d = dict(src_dict)+ sandboxes = d.pop("sandboxes")++ sandboxes_with_metrics = cls(+ sandboxes=sandboxes,+ )++ sandboxes_with_metrics.additional_properties = d+ return sandboxes_with_metrics++ @property+ def additional_keys(self) -> list[str]:+ return list(self.additional_properties.keys())++ def __getitem__(self, key: str) -> Any:+ return self.additional_properties[key]++ def __setitem__(self, key: str, value: Any) -> None:+ self.additional_properties[key] = value++ def __delitem__(self, key: str) -> None:+ del self.additional_properties[key]++ def __contains__(self, key: str) -> bool:+ return key in self.additional_propertiesdiff --git a/packages/python-sdk/e2b/api/client/models/team_api_key.py b/packages/python-sdk/e2b/api/client/models/team_api_key.pyindex d047ad375..7edbbc1e4 100644--- a/packages/python-sdk/e2b/api/client/models/team_api_key.py+++ b/packages/python-sdk/e2b/api/client/models/team_api_key.py@@ -7,7 +7,10 @@ from attrs import define as _attrs_definefrom attrs import field as _attrs_fieldfrom dateutil.parser import isoparse+from ..types import UNSET, Unset+if TYPE_CHECKING:+ from ..models.identifier_masking_details import IdentifierMaskingDetailsfrom ..models.team_user import TeamUser@@ -19,19 +22,19 @@ class TeamAPIKey:"""Attributes:created_at (datetime.datetime): Timestamp of API key creation- created_by (Union['TeamUser', None]):id (UUID): Identifier of the API key- key_mask (str): Mask of the API key- last_used (Union[None, datetime.datetime]): Last time this API key was used+ mask (IdentifierMaskingDetails):name (str): Name of the API key+ created_by (Union['TeamUser', None, Unset]):+ last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used"""created_at: datetime.datetime- created_by: Union["TeamUser", None]id: UUID- key_mask: str- last_used: Union[None, datetime.datetime]+ mask: "IdentifierMaskingDetails"name: str+ created_by: Union["TeamUser", None, Unset] = UNSET+ last_used: Union[None, Unset, datetime.datetime] = UNSETadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)def to_dict(self) -> dict[str, Any]:@@ -39,49 +42,64 @@ class TeamAPIKey:created_at = self.created_at.isoformat()- created_by: Union[None, dict[str, Any]]- if isinstance(self.created_by, TeamUser):+ id = str(self.id)++ mask = self.mask.to_dict()++ name = self.name++ created_by: Union[None, Unset, dict[str, Any]]+ if isinstance(self.created_by, Unset):+ created_by = UNSET+ elif isinstance(self.created_by, TeamUser):created_by = self.created_by.to_dict()else:created_by = self.created_by- id = str(self.id)-- key_mask = self.key_mask-- last_used: Union[None, str]- if isinstance(self.last_used, datetime.datetime):+ last_used: Union[None, Unset, str]+ if isinstance(self.last_used, Unset):+ last_used = UNSET+ elif isinstance(self.last_used, datetime.datetime):last_used = self.last_used.isoformat()else:last_used = self.last_used- name = self.name-field_dict: dict[str, Any] = {}field_dict.update(self.additional_properties)field_dict.update({"createdAt": created_at,- "createdBy": created_by,"id": id,- "keyMask": key_mask,- "lastUsed": last_used,+ "mask": mask,"name": name,})+ if created_by is not UNSET:+ field_dict["createdBy"] = created_by+ if last_used is not UNSET:+ field_dict["lastUsed"] = last_usedreturn field_dict@classmethoddef from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:+ from ..models.identifier_masking_details import IdentifierMaskingDetailsfrom ..models.team_user import TeamUserd = dict(src_dict)created_at = isoparse(d.pop("createdAt"))- def _parse_created_by(data: object) -> Union["TeamUser", None]:+ id = UUID(d.pop("id"))++ mask = IdentifierMaskingDetails.from_dict(d.pop("mask"))++ name = d.pop("name")++ def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]:if data is None:return data+ if isinstance(data, Unset):+ return datatry:if not isinstance(data, dict):raise TypeError()@@ -90,17 +108,15 @@ class TeamAPIKey:return created_by_type_1except: # noqa: E722pass- return cast(Union["TeamUser", None], data)+ return cast(Union["TeamUser", None, Unset], data)- created_by = _parse_created_by(d.pop("createdBy"))+ created_by = _parse_created_by(d.pop("createdBy", UNSET))- id = UUID(d.pop("id"))-- key_mask = d.pop("keyMask")-- def _parse_last_used(data: object) -> Union[None, datetime.datetime]:+ def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]:if data is None:return data+ if isinstance(data, Unset):+ return datatry:if not isinstance(data, str):raise TypeError()@@ -109,19 +125,17 @@ class TeamAPIKey:return last_used_type_0except: # noqa: E722pass- return cast(Union[None, datetime.datetime], data)+ return cast(Union[None, Unset, datetime.datetime], data)- last_used = _parse_last_used(d.pop("lastUsed"))-- name = d.pop("name")+ last_used = _parse_last_used(d.pop("lastUsed", UNSET))team_api_key = cls(created_at=created_at,- created_by=created_by,id=id,- key_mask=key_mask,- last_used=last_used,+ mask=mask,name=name,+ created_by=created_by,+ last_used=last_used,)team_api_key.additional_properties = ddiff --git a/packages/python-sdk/e2b/api/client/models/template_build.py b/packages/python-sdk/e2b/api/client/models/template_build.pyindex aecc8cb40..1d5691957 100644--- a/packages/python-sdk/e2b/api/client/models/template_build.py+++ b/packages/python-sdk/e2b/api/client/models/template_build.py@@ -1,10 +1,11 @@from collections.abc import Mapping-from typing import Any, TypeVar, cast+from typing import Any, TypeVar, Union, castfrom attrs import define as _attrs_definefrom attrs import field as _attrs_fieldfrom ..models.template_build_status import TemplateBuildStatus+from ..types import UNSET, UnsetT = TypeVar("T", bound="TemplateBuild")@@ -17,12 +18,14 @@ class TemplateBuild:logs (list[str]): Build logsstatus (TemplateBuildStatus): Status of the templatetemplate_id (str): Identifier of the template+ reason (Union[Unset, str]): Message with the status reason, currently reporting only for error status"""build_id: strlogs: list[str]status: TemplateBuildStatustemplate_id: str+ reason: Union[Unset, str] = UNSETadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)def to_dict(self) -> dict[str, Any]:@@ -34,6 +37,8 @@ class TemplateBuild:template_id = self.template_id+ reason = self.reason+field_dict: dict[str, Any] = {}field_dict.update(self.additional_properties)field_dict.update(@@ -44,6 +49,8 @@ class TemplateBuild:"templateID": template_id,})+ if reason is not UNSET:+ field_dict["reason"] = reasonreturn field_dict@@ -58,11 +65,14 @@ class TemplateBuild:template_id = d.pop("templateID")+ reason = d.pop("reason", UNSET)+template_build = cls(build_id=build_id,logs=logs,status=status,template_id=template_id,+ reason=reason,)template_build.additional_properties = ddiff --git a/packages/python-sdk/e2b/api/client/models/template_build_request.py b/packages/python-sdk/e2b/api/client/models/template_build_request.pyindex 71ad19052..31c9689b2 100644--- a/packages/python-sdk/e2b/api/client/models/template_build_request.py+++ b/packages/python-sdk/e2b/api/client/models/template_build_request.py@@ -17,6 +17,7 @@ class TemplateBuildRequest:alias (Union[Unset, str]): Alias of the templatecpu_count (Union[Unset, int]): CPU cores for the sandboxmemory_mb (Union[Unset, int]): Memory for the sandbox in MB+ ready_cmd (Union[Unset, str]): Ready check command to execute in the template after the buildstart_cmd (Union[Unset, str]): Start command to execute in the template after the buildteam_id (Union[Unset, str]): Identifier of the team"""@@ -25,6 +26,7 @@ class TemplateBuildRequest:alias: Union[Unset, str] = UNSETcpu_count: Union[Unset, int] = UNSETmemory_mb: Union[Unset, int] = UNSET+ ready_cmd: Union[Unset, str] = UNSETstart_cmd: Union[Unset, str] = UNSETteam_id: Union[Unset, str] = UNSETadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)@@ -38,6 +40,8 @@ class TemplateBuildRequest:memory_mb = self.memory_mb+ ready_cmd = self.ready_cmd+start_cmd = self.start_cmdteam_id = self.team_id@@ -55,6 +59,8 @@ class TemplateBuildRequest:field_dict["cpuCount"] = cpu_countif memory_mb is not UNSET:field_dict["memoryMB"] = memory_mb+ if ready_cmd is not UNSET:+ field_dict["readyCmd"] = ready_cmdif start_cmd is not UNSET:field_dict["startCmd"] = start_cmdif team_id is not UNSET:@@ -73,6 +79,8 @@ class TemplateBuildRequest:memory_mb = d.pop("memoryMB", UNSET)+ ready_cmd = d.pop("readyCmd", UNSET)+start_cmd = d.pop("startCmd", UNSET)team_id = d.pop("teamID", UNSET)@@ -82,6 +90,7 @@ class TemplateBuildRequest:alias=alias,cpu_count=cpu_count,memory_mb=memory_mb,+ ready_cmd=ready_cmd,start_cmd=start_cmd,team_id=team_id,)diff --git a/packages/python-sdk/e2b/sandbox/main.py b/packages/python-sdk/e2b/sandbox/main.pyindex 8fda0f95f..c8dea728e 100644--- a/packages/python-sdk/e2b/sandbox/main.py+++ b/packages/python-sdk/e2b/sandbox/main.py@@ -41,7 +41,18 @@ class SandboxSetup(ABC):def sandbox_id(self) -> str:...- def _file_url(self, path: Optional[str] = None, user: str = "user", signature: Optional[str] = None, signature_expiration: Optional[int] = None) -> str:+ @property+ @abstractmethod+ def sandbox_domain(self) -> str:+ ...++ def _file_url(+ self,+ path: Optional[str] = None,+ user: str = "user",+ signature: Optional[str] = None,+ signature_expiration: Optional[int] = None,+ ) -> str:url = urllib.parse.urljoin(self.envd_api_url, ENVD_API_FILES_ROUTE)query = {"path": path} if path else {}query = {**query, "username": user}@@ -62,7 +73,13 @@ class SandboxSetup(ABC):return url- def download_url(self, path: str, user: str = "user", use_signature: bool = False, use_signature_expiration: Optional[int] = None) -> str:+ def download_url(+ self,+ path: str,+ user: str = "user",+ use_signature: bool = False,+ use_signature_expiration: Optional[int] = None,+ ) -> str:"""Get the URL to download a file from the sandbox.@@ -75,12 +92,22 @@ class SandboxSetup(ABC):"""if use_signature:- signature = get_signature(path, "read", user, self._envd_access_token, use_signature_expiration)- return self._file_url(path, user, signature["signature"], signature["expiration"])+ signature = get_signature(+ path, "read", user, self._envd_access_token, use_signature_expiration+ )+ return self._file_url(+ path, user, signature["signature"], signature["expiration"]+ )else:return self._file_url(path)- def upload_url(self, path: Optional[str] = None, user: str = "user", use_signature: bool = False, use_signature_expiration: Optional[int] = None) -> str:+ def upload_url(+ self,+ path: Optional[str] = None,+ user: str = "user",+ use_signature: bool = False,+ use_signature_expiration: Optional[int] = None,+ ) -> str:"""Get the URL to upload a file to the sandbox.@@ -95,8 +122,12 @@ class SandboxSetup(ABC):"""if use_signature:- signature = get_signature(path, "write", user, self._envd_access_token, use_signature_expiration)- return self._file_url(path, user, signature["signature"], signature["expiration"])+ signature = get_signature(+ path, "write", user, self._envd_access_token, use_signature_expiration+ )+ return self._file_url(+ path, user, signature["signature"], signature["expiration"]+ )else:return self._file_url(path)@@ -112,4 +143,4 @@ class SandboxSetup(ABC):if self.connection_config.debug:return f"localhost:{port}"- return f"{port}-{self.sandbox_id}.{self.connection_config.domain}"+ return f"{port}-{self.sandbox_id}.{self.sandbox_domain}"diff --git a/packages/python-sdk/e2b/sandbox/sandbox_api.py b/packages/python-sdk/e2b/sandbox/sandbox_api.pyindex ba1836316..f928a4039 100644--- a/packages/python-sdk/e2b/sandbox/sandbox_api.py+++ b/packages/python-sdk/e2b/sandbox/sandbox_api.py@@ -14,6 +14,8 @@ class SandboxInfo:sandbox_id: str"""Sandbox ID."""+ sandbox_domain: Optional[str]+ """Domain where the sandbox is hosted."""template_id: str"""Template ID."""name: Optional[str]@@ -29,6 +31,7 @@ class SandboxInfo:_envd_access_token: Optional[str]"""Envd access token."""+@dataclassclass ListedSandbox:"""Information about a sandbox."""@@ -51,6 +54,7 @@ class ListedSandbox:"""Sandbox start time."""end_at: datetime+@dataclassclass SandboxQuery:"""Query parameters for listing sandboxes."""diff --git a/packages/python-sdk/e2b/sandbox/signature.py b/packages/python-sdk/e2b/sandbox/signature.pyindex d094ee908..b08a40b96 100644--- a/packages/python-sdk/e2b/sandbox/signature.py+++ b/packages/python-sdk/e2b/sandbox/signature.py@@ -6,6 +6,7 @@ from typing import Optional, TypedDict, LiteralOperation = Literal["read", "write"]+class Signature(TypedDict):signature: strexpiration: Optional[int] # Unix timestamp or Nonediff --git a/packages/python-sdk/e2b/sandbox_async/main.py b/packages/python-sdk/e2b/sandbox_async/main.pyindex 1bd0dd9fe..27f60b915 100644--- a/packages/python-sdk/e2b/sandbox_async/main.py+++ b/packages/python-sdk/e2b/sandbox_async/main.py@@ -32,6 +32,7 @@ class AsyncTransportWithLogger(httpx.AsyncHTTPTransport):class AsyncSandboxOpts(TypedDict):sandbox_id: str+ sandbox_domain: Optional[str]envd_version: Optional[str]envd_access_token: Optional[str]connection_config: ConnectionConfig@@ -88,6 +89,13 @@ class AsyncSandbox(SandboxSetup, SandboxApi):"""return self._sandbox_id+ @property+ def sandbox_domain(self) -> str:+ """+ Unique identifier of the sandbox.+ """+ return self._sandbox_domain+@propertydef envd_api_url(self) -> str:return self._envd_api_url@@ -112,9 +120,11 @@ class AsyncSandbox(SandboxSetup, SandboxApi):"""super().__init__()- self._sandbox_id = opts["sandbox_id"]self._connection_config = opts["connection_config"]+ self._sandbox_id = opts["sandbox_id"]+ self._sandbox_domain = opts["sandbox_domain"] or self.connection_config.domain+self._envd_api_url = f"{'http' if self.connection_config.debug else 'https'}://{self.get_host(self.envd_port)}"self._envd_version = opts["envd_version"]self._envd_access_token = opts["envd_access_token"]@@ -219,6 +229,7 @@ class AsyncSandbox(SandboxSetup, SandboxApi):if debug:sandbox_id = "debug_sandbox_id"+ sandbox_domain = Noneenvd_version = Noneenvd_access_token = Noneelse:@@ -236,6 +247,7 @@ class AsyncSandbox(SandboxSetup, SandboxApi):)sandbox_id = response.sandbox_id+ sandbox_domain = response.sandbox_domainenvd_version = response.envd_versionenvd_access_token = response.envd_access_token@@ -255,6 +267,7 @@ class AsyncSandbox(SandboxSetup, SandboxApi):return cls(sandbox_id=sandbox_id,+ sandbox_domain=sandbox_domain,envd_version=envd_version,envd_access_token=envd_access_token,connection_config=connection_config,@@ -313,6 +326,7 @@ class AsyncSandbox(SandboxSetup, SandboxApi):return cls(sandbox_id=sandbox_id,+ sandbox_domain=response.sandbox_domain,connection_config=connection_config,envd_version=response.envd_version,envd_access_token=response._envd_access_token,diff --git a/packages/python-sdk/e2b/sandbox_async/sandbox_api.py b/packages/python-sdk/e2b/sandbox_async/sandbox_api.pyindex 59a38e9bd..6ef22bb76 100644--- a/packages/python-sdk/e2b/sandbox_async/sandbox_api.py+++ b/packages/python-sdk/e2b/sandbox_async/sandbox_api.py@@ -4,7 +4,12 @@ from typing import Optional, Dict, Listfrom packaging.version import Version-from e2b.sandbox.sandbox_api import SandboxInfo, SandboxApiBase, SandboxQuery, ListedSandbox+from e2b.sandbox.sandbox_api import (+ SandboxInfo,+ SandboxApiBase,+ SandboxQuery,+ ListedSandbox,+)from e2b.exceptions import TemplateExceptionfrom e2b.api import AsyncApiClient, SandboxCreateResponsefrom e2b.api.client.models import NewSandbox, PostSandboxesSandboxIDTimeoutBody@@ -144,6 +149,7 @@ class SandboxApi(SandboxApiBase):return SandboxInfo(sandbox_id=res.parsed.sandbox_id,+ sandbox_domain=res.parsed.domain,template_id=res.parsed.template_id,name=res.parsed.alias if isinstance(res.parsed.alias, str) else None,metadata=(@@ -288,6 +294,7 @@ class SandboxApi(SandboxApiBase):return SandboxCreateResponse(sandbox_id=res.parsed.sandbox_id,+ sandbox_domain=res.parsed.domain,envd_version=res.parsed.envd_version,envd_access_token=res.parsed.envd_access_token,)diff --git a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.pyindex 65a84b264..a7ae9320c 100644--- a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py+++ b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py@@ -449,7 +449,7 @@ class Filesystem:headers={**authentication_header(user),KEEPALIVE_PING_HEADER: str(KEEPALIVE_PING_INTERVAL_SEC),- }+ },)except Exception as e:raise handle_rpc_exception(e)diff --git a/packages/python-sdk/e2b/sandbox_sync/main.py b/packages/python-sdk/e2b/sandbox_sync/main.pyindex 6dba662a9..b09cc8190 100644--- a/packages/python-sdk/e2b/sandbox_sync/main.py+++ b/packages/python-sdk/e2b/sandbox_sync/main.py@@ -76,10 +76,17 @@ class Sandbox(SandboxSetup, SandboxApi):@propertydef sandbox_id(self) -> str:"""- Unique identifier of the sandbox+ Unique identifier of the sandbox."""return self._sandbox_id+ @property+ def sandbox_domain(self) -> str:+ """+ Domain where the sandbox is hosted.+ """+ return self._sandbox_domain+@propertydef envd_api_url(self) -> str:return self._envd_api_url@@ -139,6 +146,7 @@ class Sandbox(SandboxSetup, SandboxApi):if debug:self._sandbox_id = "debug_sandbox_id"+ self._sandbox_domain = Noneself._envd_version = Noneself._envd_access_token = Noneelif sandbox_id is not None:@@ -152,11 +160,12 @@ class Sandbox(SandboxSetup, SandboxApi):)self._sandbox_id = sandbox_id+ self._sandbox_domain = response.sandbox_domainself._envd_version = response.envd_versionself._envd_access_token = response._envd_access_tokenif response._envd_access_token is not None and not isinstance(- response._envd_access_token, Unset+ response._envd_access_token, Unset):connection_headers["X-Access-Token"] = response._envd_access_tokenelse:@@ -174,7 +183,9 @@ class Sandbox(SandboxSetup, SandboxApi):secure=secure or False,proxy=proxy,)+self._sandbox_id = response.sandbox_id+ self._sandbox_domain = response.sandbox_domainself._envd_version = response.envd_versionif response.envd_access_token is not None and not isinstance(@@ -195,6 +206,7 @@ class Sandbox(SandboxSetup, SandboxApi):proxy=proxy,)+ self._sandbox_domain = self._sandbox_domain or self._connection_config.domainself._envd_api_url = f"{'http' if self.connection_config.debug else 'https'}://{self.get_host(self.envd_port)}"self._envd_api = httpx.Client(base_url=self.envd_api_url,diff --git a/packages/python-sdk/e2b/sandbox_sync/sandbox_api.py b/packages/python-sdk/e2b/sandbox_sync/sandbox_api.pyindex a47241a1e..e817276dc 100644--- a/packages/python-sdk/e2b/sandbox_sync/sandbox_api.py+++ b/packages/python-sdk/e2b/sandbox_sync/sandbox_api.py@@ -3,7 +3,12 @@ import urllib.parsefrom typing import Optional, Dict, Listfrom packaging.version import Version-from e2b.sandbox.sandbox_api import SandboxInfo, SandboxApiBase, SandboxQuery, ListedSandbox+from e2b.sandbox.sandbox_api import (+ SandboxInfo,+ SandboxApiBase,+ SandboxQuery,+ ListedSandbox,+)from e2b.exceptions import TemplateExceptionfrom e2b.api import ApiClient, SandboxCreateResponsefrom e2b.api.client.models import NewSandbox, PostSandboxesSandboxIDTimeoutBody@@ -139,6 +144,7 @@ class SandboxApi(SandboxApiBase):return SandboxInfo(sandbox_id=res.parsed.sandbox_id,+ sandbox_domain=res.parsed.domain,template_id=res.parsed.template_id,name=res.parsed.alias if isinstance(res.parsed.alias, str) else None,metadata=(@@ -280,6 +286,7 @@ class SandboxApi(SandboxApiBase):return SandboxCreateResponse(sandbox_id=res.parsed.sandbox_id,+ sandbox_domain=res.parsed.domain,envd_version=res.parsed.envd_version,envd_access_token=res.parsed.envd_access_token,)diff --git a/packages/python-sdk/e2b_connect/client.py b/packages/python-sdk/e2b_connect/client.pyindex ab52a3baa..0029a973b 100644--- a/packages/python-sdk/e2b_connect/client.py+++ b/packages/python-sdk/e2b_connect/client.py@@ -37,6 +37,7 @@ class Code(Enum):data_loss = "data_loss"unauthenticated = "unauthenticated"+def make_error_from_http_code(http_code: int):error_code_map = {400: Code.invalid_argument,@@ -54,9 +55,10 @@ def make_error_from_http_code(http_code: int):504: Code.deadline_exceeded,505: Code.unimplemented,}-+return error_code_map.get(http_code, Code.unknown)+class ConnectException(Exception):def __init__(self, status: Code, message: str):self.status = status@@ -85,12 +87,10 @@ def error_for_response(http_resp: Response):error = json.loads(http_resp.content)return make_error(error)except (json.decoder.JSONDecodeError, KeyError):- error = {- "code": http_resp.status,- "message": http_resp.content.decode('utf-8')- }+ error = {"code": http_resp.status, "message": http_resp.content.decode("utf-8")}return make_error(error)+def make_error(error):status = Nonetry:diff --git a/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.py b/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.pyindex 8020ec2f6..b7906a665 100644--- a/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.py+++ b/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.py@@ -1,4 +1,3 @@-from e2b import AsyncSandboxdiff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_exists.py b/packages/python-sdk/tests/async/sandbox_async/files/test_exists.pyindex 3b81a23f2..203dd19a3 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_exists.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_exists.py@@ -1,4 +1,3 @@-from e2b import AsyncSandboxdiff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_remove.py b/packages/python-sdk/tests/async/sandbox_async/files/test_remove.pyindex 752929b97..07cf2cfa3 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_remove.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_remove.py@@ -1,4 +1,3 @@-from e2b import AsyncSandboxdiff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_secured.py b/packages/python-sdk/tests/async/sandbox_async/files/test_secured.pyindex 6e7dd2d23..8a67bc234 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_secured.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_secured.py@@ -7,6 +7,7 @@ from e2b import (AsyncSandbox,)+@pytest.mark.skip_debug()async def test_download_url_with_signing(template):sbx = await AsyncSandbox.create(template, timeout=100, secure=True)@@ -20,11 +21,12 @@ async def test_download_url_with_signing(template):with urllib.request.urlopen(signed_url) as resp:assert resp.status == 200body_bytes = resp.read()- body_text = body_bytes.decode()+ body_text = body_bytes.decode()assert body_text == file_contentfinally:await sbx.kill()+@pytest.mark.skip_debug()async def test_download_url_with_signing_and_expiration(template):sbx = await AsyncSandbox.create(template, timeout=100, secure=True)@@ -38,11 +40,12 @@ async def test_download_url_with_signing_and_expiration(template):with urllib.request.urlopen(signed_url) as resp:assert resp.status == 200body_bytes = resp.read()- body_text = body_bytes.decode()+ body_text = body_bytes.decode()assert body_text == file_contentfinally:await sbx.kill()+@pytest.mark.skip_debug()async def test_download_url_with_expired_signing(template):sbx = await AsyncSandbox.create(template, timeout=100, secure=True)@@ -62,11 +65,11 @@ async def test_download_url_with_expired_signing(template):err = exc_info.valueassert err.code == 401, f"Unexpected status {err.code}"- error_json_str = err.read().decode() # bytes ➜ str- error_payload = json.loads(error_json_str) # str ➜ dict+ error_json_str = err.read().decode() # bytes ➜ str+ error_payload = json.loads(error_json_str) # str ➜ dictexpected_payload = {"code": 401, "message": "signature is already expired"}assert error_payload == expected_payloadfinally:- await sbx.kill()\ No newline at end of file+ await sbx.kill()diff --git a/packages/python-sdk/tests/async/sandbox_async/test_connect.py b/packages/python-sdk/tests/async/sandbox_async/test_connect.pyindex 89a6d065d..6a6fc65a2 100644--- a/packages/python-sdk/tests/async/sandbox_async/test_connect.py+++ b/packages/python-sdk/tests/async/sandbox_async/test_connect.py@@ -3,6 +3,7 @@ import pytestfrom e2b import AsyncSandbox+@pytest.mark.skip_debug()async def test_connect(template):sbx = await AsyncSandbox.create(template, timeout=10)@@ -14,6 +15,7 @@ async def test_connect(template):finally:await sbx.kill()+@pytest.mark.skip_debug()async def test_connect_with_secure(template):dir_name = f"test_directory_{uuid.uuid4()}"diff --git a/packages/python-sdk/tests/async/sandbox_async/test_secure.py b/packages/python-sdk/tests/async/sandbox_async/test_secure.pyindex 8759a8b33..8557e4597 100644--- a/packages/python-sdk/tests/async/sandbox_async/test_secure.py+++ b/packages/python-sdk/tests/async/sandbox_async/test_secure.py@@ -2,6 +2,7 @@ import pytestfrom e2b import AsyncSandbox+@pytest.mark.skip_debug()async def test_start_secured(template):sbx = await AsyncSandbox.create(template, timeout=5, secure=True)@@ -12,6 +13,7 @@ async def test_start_secured(template):finally:await sbx.kill()+@pytest.mark.skip_debug()async def test_connect_to_secured(template):sbx = await AsyncSandbox.create(template, timeout=100, secure=True)diff --git a/packages/python-sdk/tests/sync/sandbox_sync/files/test_secured.py b/packages/python-sdk/tests/sync/sandbox_sync/files/test_secured.pyindex 84b396ce8..2dc55a103 100644--- a/packages/python-sdk/tests/sync/sandbox_sync/files/test_secured.py+++ b/packages/python-sdk/tests/sync/sandbox_sync/files/test_secured.py@@ -5,6 +5,7 @@ import pytestfrom e2b import Sandbox+@pytest.mark.skip_debug()async def test_download_url_with_signing(template):sbx = Sandbox(template, timeout=100, secure=True)@@ -18,11 +19,12 @@ async def test_download_url_with_signing(template):with urllib.request.urlopen(signed_url) as resp:assert resp.status == 200body_bytes = resp.read()- body_text = body_bytes.decode()+ body_text = body_bytes.decode()assert body_text == file_contentfinally:sbx.kill()+@pytest.mark.skip_debug()async def test_download_url_with_signing_and_expiration(template):sbx = Sandbox(template, timeout=100, secure=True)@@ -36,11 +38,12 @@ async def test_download_url_with_signing_and_expiration(template):with urllib.request.urlopen(signed_url) as resp:assert resp.status == 200body_bytes = resp.read()- body_text = body_bytes.decode()+ body_text = body_bytes.decode()assert body_text == file_contentfinally:sbx.kill()+@pytest.mark.skip_debug()async def test_download_url_with_expired_signing(template):sbx = Sandbox(template, timeout=100, secure=True)@@ -60,11 +63,11 @@ async def test_download_url_with_expired_signing(template):err = exc_info.valueassert err.code == 401, f"Unexpected status {err.code}"- error_json_str = err.read().decode() # bytes ➜ str- error_payload = json.loads(error_json_str) # str ➜ dict+ error_json_str = err.read().decode() # bytes ➜ str+ error_payload = json.loads(error_json_str) # str ➜ dictexpected_payload = {"code": 401, "message": "signature is already expired"}assert error_payload == expected_payloadfinally:- sbx.kill()\ No newline at end of file+ sbx.kill()diff --git a/packages/python-sdk/tests/sync/sandbox_sync/test_secure.py b/packages/python-sdk/tests/sync/sandbox_sync/test_secure.pyindex aad330d78..fe597fef5 100644--- a/packages/python-sdk/tests/sync/sandbox_sync/test_secure.py+++ b/packages/python-sdk/tests/sync/sandbox_sync/test_secure.py@@ -2,6 +2,7 @@ import pytestfrom e2b import Sandbox+@pytest.mark.skip_debug()def test_start_secured(template):sbx = Sandbox(template, timeout=5, secure=True)@@ -12,6 +13,7 @@ def test_start_secured(template):finally:sbx.kill()+@pytest.mark.skip_debug()def test_connect_to_secured(template):sbx = Sandbox(template, timeout=5, secure=True)diff --git a/spec/openapi.yml b/spec/openapi.ymlindex b47e63996..5a783614a 100644--- a/spec/openapi.yml+++ b/spec/openapi.yml@@ -201,8 +201,8 @@ components:- timestamp- cpuCount- cpuUsedPct- - memUsedMiB- - memTotalMiB+ - memUsed+ - memTotalproperties:timestamp:type: string@@ -216,14 +216,14 @@ components:type: numberformat: floatdescription: CPU usage percentage- memUsedMiB:+ memUsed:type: integerformat: int64- description: Memory used in MiB- memTotalMiB:+ description: Memory used in bytes+ memTotal:type: integerformat: int64- description: Total memory in MiB+ description: Total memory in bytesSandbox:required:@@ -243,6 +243,7 @@ components:description: Alias of the templateclientID:type: string+ deprecated: truedescription: Identifier of the clientenvdVersion:type: string@@ -250,6 +251,10 @@ components:envdAccessToken:type: stringdescription: Access token used for envd communication+ domain:+ type: string+ nullable: true+ description: Base domain where the sandbox traffic is accessibleSandboxDetail:required:@@ -273,6 +278,7 @@ components:description: Identifier of the sandboxclientID:type: string+ deprecated: truedescription: Identifier of the clientstartedAt:type: string@@ -288,6 +294,10 @@ components:envdAccessToken:type: stringdescription: Access token used for envd communication+ domain:+ type: string+ nullable: true+ description: Base domain where the sandbox traffic is accessiblecpuCount:$ref: "#/components/schemas/CPUCount"memoryMB:@@ -319,6 +329,7 @@ components:description: Identifier of the sandboxclientID:type: string+ deprecated: truedescription: Identifier of the clientstartedAt:type: string@@ -337,45 +348,12 @@ components:state:$ref: "#/components/schemas/SandboxState"- RunningSandboxWithMetrics:+ SandboxesWithMetrics:required:- - templateID- - sandboxID- - clientID- - startedAt- - cpuCount- - memoryMB- - endAt+ - sandboxesproperties:- templateID:- type: string- description: Identifier of the template from which is the sandbox created- alias:- type: string- description: Alias of the template- sandboxID:- type: string- description: Identifier of the sandbox- clientID:- type: string- description: Identifier of the client- startedAt:- type: string- format: date-time- description: Time when the sandbox was started- endAt:- type: string- format: date-time- description: Time when the sandbox will expire- cpuCount:- $ref: "#/components/schemas/CPUCount"- memoryMB:- $ref: "#/components/schemas/MemoryMB"- metadata:- $ref: "#/components/schemas/SandboxMetadata"- metrics:- type: array- items:+ sandboxes:+ additionalProperties:$ref: "#/components/schemas/SandboxMetric"NewSandbox:@@ -489,6 +467,9 @@ components:startCmd:description: Start command to execute in the template after the buildtype: string+ readyCmd:+ description: Ready check command to execute in the template after the build+ type: stringcpuCount:$ref: "#/components/schemas/CPUCount"memoryMB:@@ -521,6 +502,9 @@ components:- waiting- ready- error+ reason:+ type: string+ description: Message with the status reason, currently reporting only for error statusNodeStatus:type: string@@ -545,16 +529,25 @@ components:- sandboxCount- allocatedCPU- allocatedMemoryMiB+ - createSuccesses- createFails- sandboxStartingCount- version+ - commitproperties:version:type: stringdescription: Version of the orchestrator+ commit:+ type: string+ description: Commit of the orchestratornodeID:type: stringdescription: Identifier of the node+ clusterID:+ type: string+ nullable: true+ description: Identifier of the clusterstatus:$ref: "#/components/schemas/NodeStatus"sandboxCount:@@ -569,6 +562,10 @@ components:type: integerformat: int32description: Amount of allocated memory in MiB+ createSuccesses:+ type: integer+ format: uint64+ description: Number of sandbox create successescreateFails:type: integerformat: uint64@@ -584,12 +581,21 @@ components:- status- sandboxes- cachedBuilds+ - createSuccesses- createFails- version+ - commitproperties:+ clusterID:+ type: string+ nullable: true+ description: Identifier of the clusterversion:type: stringdescription: Version of the orchestrator+ commit:+ type: string+ description: Commit of the orchestratornodeID:type: stringdescription: Identifier of the node@@ -605,6 +611,10 @@ components:description: List of cached builds id on the nodeitems:type: string+ createSuccesses:+ type: integer+ format: uint64+ description: Number of sandbox create successescreateFails:type: integerformat: uint64@@ -615,7 +625,7 @@ components:- id- name- token- - tokenMask+ - mask- createdAtproperties:id:@@ -627,10 +637,9 @@ components:description: Name of the access tokentoken:type: string- description: Raw value of the access token- tokenMask:- type: string- description: Mask of the access token+ description: The fully created access token+ mask:+ $ref: "#/components/schemas/IdentifierMaskingDetails"createdAt:type: stringformat: date-time@@ -648,10 +657,8 @@ components:required:- id- name- - keyMask+ - mask- createdAt- - createdBy- - lastUsedproperties:id:type: string@@ -660,9 +667,8 @@ components:name:type: stringdescription: Name of the API key- keyMask:- type: string- description: Mask of the API key+ mask:+ $ref: "#/components/schemas/IdentifierMaskingDetails"createdAt:type: stringformat: date-time@@ -680,26 +686,23 @@ components:CreatedTeamAPIKey:required:- id- - name- key- - keyMask+ - mask+ - name- createdAt- - createdBy- - lastUsedproperties:id:type: stringformat: uuiddescription: Identifier of the API key- name:- type: string- description: Name of the API keykey:type: stringdescription: Raw value of the API key- keyMask:+ mask:+ $ref: "#/components/schemas/IdentifierMaskingDetails"+ name:type: string- description: Mask of the API key+ description: Name of the API keycreatedAt:type: stringformat: date-time@@ -743,6 +746,26 @@ components:type: stringdescription: Error+ IdentifierMaskingDetails:+ required:+ - prefix+ - valueLength+ - maskedValuePrefix+ - maskedValueSuffix+ properties:+ prefix:+ type: string+ description: Prefix that identifies the token or key type+ valueLength:+ type: integer+ description: Length of the token or key+ maskedValuePrefix:+ type: string+ description: Prefix used in masked version of the token or key+ maskedValueSuffix:+ type: string+ description: Suffix used in masked version of the token or key+tags:- name: templates- name: sandboxes@@ -900,27 +923,31 @@ paths:/sandboxes/metrics:get:- description: List all running sandboxes with metrics+ description: List metrics for given sandboxestags: [sandboxes]security:- ApiKeyAuth: []+ - Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - name: metadata+ - name: sandbox_idsin: query- description: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded.- required: false+ required: true+ description: Comma-separated list of sandbox IDs to get metrics for+ explode: falseschema:- type: string+ type: array+ items:+ type: string+ maxItems: 100+ uniqueItems: trueresponses:"200":description: Successfully returned all running sandboxes with metricscontent:application/json:schema:- type: array- items:- allOf:- - $ref: "#/components/schemas/RunningSandboxWithMetrics"+ $ref: "#/components/schemas/SandboxesWithMetrics""401":$ref: "#/components/responses/401""400":@@ -967,9 +994,9 @@ paths:"500":$ref: "#/components/responses/500"- /sandboxes/{sandboxID}/metrics:+ /sandboxes/{sandboxID}:get:- description: Get sandbox metrics+ description: Get a sandbox by idtags: [sandboxes]security:- ApiKeyAuth: []@@ -979,13 +1006,11 @@ paths:- $ref: "#/components/parameters/sandboxID"responses:"200":- description: Successfully returned the sandbox metrics+ description: Successfully returned the sandboxcontent:application/json:schema:- type: array- items:- $ref: "#/components/schemas/SandboxMetric"+ $ref: "#/components/schemas/SandboxDetail""404":$ref: "#/components/responses/404""401":@@ -993,9 +1018,8 @@ paths:"500":$ref: "#/components/responses/500"- /sandboxes/{sandboxID}:- get:- description: Get a sandbox by id+ delete:+ description: Kill a sandboxtags: [sandboxes]security:- ApiKeyAuth: []@@ -1004,12 +1028,8 @@ paths:parameters:- $ref: "#/components/parameters/sandboxID"responses:- "200":- description: Successfully returned the sandbox- content:- application/json:- schema:- $ref: "#/components/schemas/SandboxDetail"+ "204":+ description: The sandbox was killed successfully"404":$ref: "#/components/responses/404""401":@@ -1017,8 +1037,9 @@ paths:"500":$ref: "#/components/responses/500"- delete:- description: Kill a sandbox+ /sandboxes/{sandboxID}/metrics:+ get:+ description: Get sandbox metricstags: [sandboxes]security:- ApiKeyAuth: []@@ -1026,16 +1047,40 @@ paths:Supabase2TeamAuth: []parameters:- $ref: "#/components/parameters/sandboxID"+ - in: query+ name: start+ schema:+ type: integer+ format: int64+ minimum: 0+ description: Starting timestamp of the metrics that should be returned in milliseconds+ - in: query+ name: end+ schema:+ type: integer+ format: int64+ minimum: 0+ description: Ending timestamp of the metrics that should be returned in milliseconds+responses:- "204":- description: The sandbox was killed successfully- "404":- $ref: "#/components/responses/404"+ "200":+ description: Successfully returned the sandbox metrics+ content:+ application/json:+ schema:+ type: array+ items:+ $ref: "#/components/schemas/SandboxMetric"+ "400":+ $ref: "#/components/responses/400""401":$ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404""500":$ref: "#/components/responses/500"+# TODO: Pause and resume might be exposed as POST /sandboxes/{sandboxID}/snapshot and then POST /sandboxes with specified snapshotting setup/sandboxes/{sandboxID}/pause:post: