Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Suppress ws reconnect logs by default; Reduce backoff
Tomas Valentaa9da9a714a79
diff --git a/.changeset/rotten-months-cheat.md b/.changeset/rotten-months-cheat.mdnew file mode 100644index 000000000..d5e541cf1--- /dev/null+++ b/.changeset/rotten-months-cheat.md@@ -0,0 +1,5 @@+---+"@e2b/python-sdk": patch+---++Supress ws reconnect logs by default; Change reconnect backoffdiff --git a/packages/python-sdk/e2b/sandbox/websocket_client.py b/packages/python-sdk/e2b/sandbox/websocket_client.pyindex c87052453..4a03c78aa 100644--- a/packages/python-sdk/e2b/sandbox/websocket_client.py+++ b/packages/python-sdk/e2b/sandbox/websocket_client.py@@ -7,7 +7,7 @@ from queue import Queuefrom threading import Eventfrom typing import Any, Callable, List, Optional-from websockets import WebSocketClientProtocol, connect+from websockets.legacy.client import WebSocketClientProtocol, connectfrom websockets.exceptions import ConnectionClosedfrom websockets.typing import Data@@ -63,10 +63,21 @@ class WebSocket:async def _connect(self):logger.debug(f"WebSocket connecting to {self.url}")- websocket_connector = connect(self.url, max_size=None, max_queue=None)++ ws_logger = logger.getChild("websockets.client")+ ws_logger.setLevel(logging.ERROR)++ websocket_connector = connect(+ self.url,+ max_size=None,+ max_queue=None,+ logger=ws_logger,+ )+websocket_connector.BACKOFF_MIN = 1websocket_connector.BACKOFF_FACTOR = 1- websocket_connector.BACKOFF_INITIAL = 0.4+ websocket_connector.BACKOFF_INITIAL = 0.3 # type: ignore+async for websocket in websocket_connector:try:self._ws = websocket