Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/quiet-flowers-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@e2b/python-sdk': minor
'e2b': minor
---

adds network configs and lifecycle handling to info responses
15 changes: 15 additions & 0 deletions packages/js-sdk/src/api/schema.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/js-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type {
SandboxPaginator,
SandboxNetworkOpts,
SandboxLifecycle,
SandboxInfoLifecycle,
SnapshotInfo,
SnapshotListOpts,
SnapshotPaginator,
Expand Down
42 changes: 42 additions & 0 deletions packages/js-sdk/src/sandbox/sandboxApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ export type SandboxLifecycle = {
autoResume?: boolean
}

export type SandboxInfoLifecycle = {
/**
* Action to take when sandbox timeout is reached.
*/
onTimeout: 'pause' | 'kill'

/**
* Whether the sandbox can auto-resume.
*/
autoResume: boolean
}

/**
* Options for request to the Sandbox API.
*/
Expand Down Expand Up @@ -310,6 +322,21 @@ export interface SandboxInfo {
* Envd version.
*/
envdVersion: string

/**
* Whether internet access was explicitly enabled or disabled for the sandbox.
*/
allowInternetAccess?: boolean | undefined

/**
* Sandbox network configuration.
*/
network?: SandboxNetworkOpts

/**
* Sandbox lifecycle configuration.
*/
lifecycle?: SandboxInfoLifecycle
}

/**
Expand Down Expand Up @@ -552,13 +579,28 @@ export class SandboxApi {
templateId: res.data.templateID,
...(res.data.alias && { name: res.data.alias }),
metadata: res.data.metadata ?? {},
allowInternetAccess: res.data.allowInternetAccess ?? undefined,
envdVersion: res.data.envdVersion,
envdAccessToken: res.data.envdAccessToken,
startedAt: new Date(res.data.startedAt),
endAt: new Date(res.data.endAt),
state: res.data.state,
cpuCount: res.data.cpuCount,
memoryMB: res.data.memoryMB,
network: res.data.network
? {
allowOut: res.data.network.allowOut,
denyOut: res.data.network.denyOut,
allowPublicTraffic: res.data.network.allowPublicTraffic,
maskRequestHost: res.data.network.maskRequestHost,
}
: undefined,
lifecycle: res.data.lifecycle
? {
onTimeout: res.data.lifecycle.onTimeout,
autoResume: res.data.lifecycle.autoResume,
}
: undefined,
sandboxDomain: res.data.domain || undefined,
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/python-sdk/e2b/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
GitHubMcpServerConfig,
McpServer,
SandboxInfo,
SandboxInfoLifecycle,
SandboxMetrics,
SandboxLifecycle,
SandboxNetworkOpts,
Expand Down Expand Up @@ -132,6 +133,7 @@
"FileUploadException",
# Sandbox API
"SandboxInfo",
"SandboxInfoLifecycle",
"SandboxMetrics",
"ProcessInfo",
"SandboxQuery",
Expand Down
4 changes: 4 additions & 0 deletions packages/python-sdk/e2b/api/client/models/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions packages/python-sdk/e2b/api/client/models/sandbox_detail.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions packages/python-sdk/e2b/api/client/models/sandbox_lifecycle.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading