Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Skip set timeout in debug mode

Jakub Novak1dd46c3dadf1
diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.ts
index 84c595d89..21ee455a0 100644
--- a/packages/js-sdk/src/sandbox/index.ts
+++ b/packages/js-sdk/src/sandbox/index.ts
@@ -101,12 +101,17 @@ export class Sandbox extends SandboxApi {
}
async setTimeout(timeoutMs: number, opts?: Pick<SandboxOpts, 'requestTimeoutMs'>) {
+ if (this.connectionConfig.debug) {
+ // Skip timeout in debug mode
+ return
+ }
+
await Sandbox.setTimeout(this.sandboxId, timeoutMs, { ...this.connectionConfig, ...opts })
}
async kill(opts?: Pick<SandboxOpts, 'requestTimeoutMs'>) {
if (this.connectionConfig.debug) {
- console.log('Skipping kill in debug mode')
+ // Skip killing in debug mode
return
}
diff --git a/packages/python-sdk/e2b/sandbox_async/sandbox_api.py b/packages/python-sdk/e2b/sandbox_async/sandbox_api.py
index fb76841cd..256ed5ece 100644
--- a/packages/python-sdk/e2b/sandbox_async/sandbox_api.py
+++ b/packages/python-sdk/e2b/sandbox_async/sandbox_api.py
@@ -75,6 +75,7 @@ class SandboxApi(SandboxApiBase):
)
if config.debug:
+ # Skip killing the sandbox in debug mode
return True
async with AsyncApiClient(config) as api_client:
@@ -108,6 +109,10 @@ class SandboxApi(SandboxApiBase):
request_timeout=request_timeout,
)
+ if config.debug:
+ # Skip setting the timeout in debug mode
+ return
+
async with AsyncApiClient(config) as api_client:
res = await post_sandboxes_sandbox_id_timeout.asyncio_detailed(
sandbox_id,
diff --git a/packages/python-sdk/e2b/sandbox_sync/sandbox_api.py b/packages/python-sdk/e2b/sandbox_sync/sandbox_api.py
index 4a899ed58..bf03b05d5 100644
--- a/packages/python-sdk/e2b/sandbox_sync/sandbox_api.py
+++ b/packages/python-sdk/e2b/sandbox_sync/sandbox_api.py
@@ -78,6 +78,7 @@ class SandboxApi(SandboxApiBase):
)
if config.debug:
+ # Skip killing the sandbox in debug mode
return True
with ApiClient(
@@ -113,6 +114,10 @@ class SandboxApi(SandboxApiBase):
request_timeout=request_timeout,
)
+ if config.debug:
+ # Skip setting timeout in debug mode
+ return
+
with ApiClient(
config, transport=HTTPTransport(limits=SandboxApiBase._limits)
) as api_client: