Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add changeset
Jakub Novaka725c8f7d4c8
diff --git a/.changeset/fast-steaks-push.md b/.changeset/fast-steaks-push.mdnew file mode 100644index 000000000..2efbb4ecf--- /dev/null+++ b/.changeset/fast-steaks-push.md@@ -0,0 +1,5 @@+---+"e2b": patch+---++Fix subclassing in JSdiff --git a/packages/js-sdk/testground/basic.cjs b/packages/js-sdk/testground/basic.cjsindex c5bf98bbf..23d477d01 100644--- a/packages/js-sdk/testground/basic.cjs+++ b/packages/js-sdk/testground/basic.cjs@@ -4,18 +4,12 @@ function wait(ms) {}async function main() {- const sandbox = await e2b.Sandbox.create({- id: 'base',- apiKey: process.env.E2B_API_KEY- })+ for (let i = 0; i < 10; i++) {+ console.log('Creating sandbox', i + 1)+ e2b.Sandbox.create({id: 'base', apiKey: process.env.E2B_API_KEY})+ }+ await e2b.Sandbox.create({id: 'base', apiKey: process.env.E2B_API_KEY})- await sandbox.filesystem.write(- '/code/hello.txt', "My friend!"- )- const files = await sandbox.filesystem.read('/code/hello.txt')- console.log(files)-- await sandbox.close()}main().catch(console.error)diff --git a/packages/python-sdk/e2b/sandbox/sandbox_rpc.py b/packages/python-sdk/e2b/sandbox/sandbox_rpc.pyindex 207df64d8..ee13d8131 100644--- a/packages/python-sdk/e2b/sandbox/sandbox_rpc.py+++ b/packages/python-sdk/e2b/sandbox/sandbox_rpc.py@@ -1,12 +1,11 @@from __future__ import annotations-import asyncioimport jsonimport loggingimport threadingimport time-from concurrent.futures import ThreadPoolExecutor, TimeoutError+from concurrent.futures import TimeoutErrorfrom queue import Queuefrom threading import Eventfrom typing import Any, Callable, Dict, Iterator, List, Union, Optional@@ -19,8 +18,7 @@ from websockets.typing import Datafrom e2b.constants import TIMEOUTfrom e2b.sandbox.exception import RpcException, TimeoutException, SandboxExceptionfrom e2b.sandbox.websocket_client import WebSocket-from e2b.utils.future import DeferredFuture, run_async_func_in_loop-from e2b.utils.threads import shutdown_executor+from e2b.utils.future import DeferredFuturelogger = logging.getLogger(__name__)@@ -74,7 +72,7 @@ class SandboxRpc(BaseModel):self._receive_message(data)self._queue_out.task_done()- def connect(self, timeout: Optional[float] = TIMEOUT):+ def connect(self, timeout: float = TIMEOUT):started = Event()stopped = Event()self._process_cleanup.append(stopped.set)@@ -138,7 +136,7 @@ class SandboxRpc(BaseModel):logger.error(f"WebSocket timed out while waiting for: {request} {e}")raise TimeoutException(f"WebSocket timed out while waiting for: {request} {e}"- )+ ) from ereturn rexcept Exception as e:logger.error(f"WebSocket received error while waiting for: {request} {e}")