diff --git a/swarms/structs/agent.py b/swarms/structs/agent.py index a59e0d4e4..ea30150f8 100644 --- a/swarms/structs/agent.py +++ b/swarms/structs/agent.py @@ -312,7 +312,7 @@ def __init__( frequency_penalty: float = 0.0, presence_penalty: float = 0.0, temperature: float = 0.1, - workspace_dir: str = "agent_workspace", + workspace_dir: str = None, timeout: Optional[int] = None, # short_memory: Optional[str] = None, created_at: float = time.time(), @@ -426,7 +426,7 @@ def __init__( self.frequency_penalty = frequency_penalty self.presence_penalty = presence_penalty self.temperature = temperature - self.workspace_dir = workspace_dir + self.workspace_dir = workspace_dir or os.getenv("WORKSPACE_DIR", "./workspace") self.timeout = timeout self.created_at = created_at self.return_step_meta = return_step_meta @@ -469,7 +469,10 @@ def __init__( self.executor = ThreadPoolExecutor( max_workers=executor_workers ) - + #check and create workspace dir + if not os.path.exists(self.workspace_dir): + os.makedirs(self.workspace_dir) + # Initialize the tool struct if ( exists(tools) diff --git a/swarms/telemetry/check_update.py b/swarms/telemetry/check_update.py index 2b0b9a1cd..4eeea35d7 100644 --- a/swarms/telemetry/check_update.py +++ b/swarms/telemetry/check_update.py @@ -1,6 +1,6 @@ import importlib.util import sys - +import os import pkg_resources import requests from packaging import version @@ -47,6 +47,9 @@ def check_for_update() -> bool: """ try: # Fetch the latest version from the PyPI API + auto_update = os.getenv("SWARMS_AUTOUPDATE_ON", "false").lower() == "true" + if not auto_update: + return response = requests.get("https://pypi.org/pypi/swarms/json") response.raise_for_status() # Raises an HTTPError if the response status code is 4XX/5XX latest_version = response.json()["info"]["version"]