From 9d471c2188362b15a1527eb4478dc0f58fd66ca0 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 19 Nov 2024 13:28:50 -0800 Subject: [PATCH] [ENV DOCS] --- docs/swarms/install/workspace_manager.md | 46 +++++++++++++++++++++++- swarms/structs/agent.py | 8 ++--- swarms/telemetry/auto_upgrade_swarms.py | 11 ++++++ 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/docs/swarms/install/workspace_manager.md b/docs/swarms/install/workspace_manager.md index b0c0ad25..d2cb4ca3 100644 --- a/docs/swarms/install/workspace_manager.md +++ b/docs/swarms/install/workspace_manager.md @@ -24,6 +24,25 @@ WORKSPACE_DIR=/path/to/your/workspace - Keeps track of agent interactions - Preserves conversation logs +#### `SWARMS_AUTOUPDATE_ON` +- **Purpose**: Controls automatic updates of the Swarms framework +- **Type**: Boolean +- **Default**: `false` +- **Example**: +```bash +SWARMS_AUTOUPDATE_ON=true +``` +- **Features**: + - Automatically updates to the latest stable version + - Ensures you have the newest features + - Maintains compatibility with the latest improvements + - Handles dependency updates +- **Considerations**: + - Set to `false` if you need version stability + - Recommended `true` for development environments + - Consider system requirements for auto-updates + - May require restart after updates + ### Telemetry Configuration #### `USE_TELEMETRY` @@ -70,6 +89,9 @@ touch .env # Basic configuration WORKSPACE_DIR=./my_workspace +# Enable auto-updates +SWARMS_AUTOUPDATE_ON=true + # Enable telemetry USE_TELEMETRY=true @@ -78,7 +100,7 @@ SWARMS_API_KEY=your_api_key_here ``` 3. Obtain your API key: - - Visit [swarms.ai dashboard](https://swarms.ai) + - Visit [swarms.ai](https://swarms.ai) - Create an account or log in - Navigate to the API section - Generate your unique API key @@ -100,11 +122,18 @@ SWARMS_API_KEY=your_api_key_here - Consider privacy implications in production - Review collected data periodically +4. **Auto-Update Management**: + - Test updates in development before enabling in production + - Keep backups before enabling auto-updates + - Monitor system resources during updates + - Schedule updates during low-traffic periods + ## Examples ### Basic Development Setup ```bash WORKSPACE_DIR=./dev_workspace +SWARMS_AUTOUPDATE_ON=true USE_TELEMETRY=true SWARMS_API_KEY=sk_test_xxxxxxxxxxxx ``` @@ -112,10 +141,19 @@ SWARMS_API_KEY=sk_test_xxxxxxxxxxxx ### Production Setup ```bash WORKSPACE_DIR=/var/log/swarms/prod_workspace +SWARMS_AUTOUPDATE_ON=false USE_TELEMETRY=true SWARMS_API_KEY=sk_prod_xxxxxxxxxxxx ``` +### Testing Environment +```bash +WORKSPACE_DIR=./test_workspace +SWARMS_AUTOUPDATE_ON=true +USE_TELEMETRY=false +SWARMS_API_KEY=sk_test_xxxxxxxxxxxx +``` + ## Troubleshooting Common issues and solutions: @@ -135,6 +173,12 @@ Common issues and solutions: - Verify firewall settings - Check for proper boolean values +4. **Auto-Update Issues**: + - Check internet connectivity + - Verify sufficient disk space + - Ensure proper permissions for updates + - Check system compatibility requirements + ## Additional Resources - [Swarms Framework Documentation](https://github.com/kyegomez/swarms) diff --git a/swarms/structs/agent.py b/swarms/structs/agent.py index f40910b6..90a34951 100644 --- a/swarms/structs/agent.py +++ b/swarms/structs/agent.py @@ -2286,9 +2286,9 @@ class Agent: device_id = device_id or self.device_id all_cores = all_cores or self.all_cores all_gpus = all_gpus or self.all_gpus - do_not_use_cluster_ops = do_not_use_cluster_ops or self.do_not_use_cluster_ops - - + do_not_use_cluster_ops = ( + do_not_use_cluster_ops or self.do_not_use_cluster_ops + ) if scheduled_run_date: while datetime.now() < scheduled_run_date: @@ -2314,7 +2314,7 @@ class Agent: *args, **kwargs, ) - + except ValueError as e: logger.error(f"Invalid device specified: {e}") raise e diff --git a/swarms/telemetry/auto_upgrade_swarms.py b/swarms/telemetry/auto_upgrade_swarms.py index d4627b95..7203cd85 100644 --- a/swarms/telemetry/auto_upgrade_swarms.py +++ b/swarms/telemetry/auto_upgrade_swarms.py @@ -1,3 +1,4 @@ +import os import subprocess from swarms.utils.loguru_logger import initialize_logger @@ -9,6 +10,16 @@ logger = initialize_logger(log_folder="auto_upgrade_swarms") def auto_update(): """auto update swarms""" try: + # Check if auto-update is disabled + auto_update_enabled = os.getenv( + "SWARMS_AUTOUPDATE_ON", "true" + ).lower() + if auto_update_enabled == "false": + logger.info( + "Auto-update is disabled via SWARMS_AUTOUPDATE_ON" + ) + return + outcome = check_for_update() if outcome is True: logger.info(