From b238ecf74cdb3a571bfbeddf443792b40c15eafa Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 12 Oct 2024 12:31:11 -0400 Subject: [PATCH] [CLEANUP] --- README.md | 22 +++++++++++++++++++--- swarms/cli/main.py | 35 ++++++++++++++++++++++++++--------- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7cb1bee0..7eb69404 100644 --- a/README.md +++ b/README.md @@ -604,11 +604,27 @@ You can now easily plug this custom Griptape agent into the **Swarms Framework** -# Multi-Agent Orchestration: -Swarms was designed to facilitate the communication between many different and specialized agents from a vast array of other frameworks such as langchain, autogen, crew, and more. +## Understanding Swarms -In traditional swarm theory, there are many types of swarms usually for very specialized use-cases and problem sets. Such as Hiearchical and sequential are great for accounting and sales, because there is usually a boss coordinator agent that distributes a workload to other specialized agents. +### What is a Swarm? +A swarm, in the context of multi-agent systems, refers to a group of more than two agents working collaboratively to achieve a common goal. These agents can be software entities, such as llms that interact with each other to perform complex tasks. The concept of a swarm is inspired by natural systems like ant colonies or bird flocks, where simple individual behaviors lead to complex group dynamics and problem-solving capabilities. + +### How Swarm Architectures Facilitate Communication + +Swarm architectures are designed to establish and manage communication between agents within a swarm. These architectures define how agents interact, share information, and coordinate their actions to achieve the desired outcomes. Here are some key aspects of swarm architectures: + +1. **Hierarchical Communication**: In hierarchical swarms, communication flows from higher-level agents to lower-level agents. Higher-level agents act as coordinators, distributing tasks and aggregating results. This structure is efficient for tasks that require top-down control and decision-making. + +2. **Parallel Communication**: In parallel swarms, agents operate independently and communicate with each other as needed. This architecture is suitable for tasks that can be processed concurrently without dependencies, allowing for faster execution and scalability. + +3. **Sequential Communication**: Sequential swarms process tasks in a linear order, where each agent's output becomes the input for the next agent. This ensures that tasks with dependencies are handled in the correct sequence, maintaining the integrity of the workflow. + +4. **Mesh Communication**: In mesh swarms, agents are fully connected, allowing any agent to communicate with any other agent. This setup provides high flexibility and redundancy, making it ideal for complex systems requiring dynamic interactions. + +5. **Federated Communication**: Federated swarms involve multiple independent swarms that collaborate by sharing information and results. Each swarm operates autonomously but can contribute to a larger task, enabling distributed problem-solving across different nodes. + +Swarm architectures leverage these communication patterns to ensure that agents work together efficiently, adapting to the specific requirements of the task at hand. By defining clear communication protocols and interaction models, swarm architectures enable the seamless orchestration of multiple agents, leading to enhanced performance and problem-solving capabilities. | **Name** | **Description** | **Code Link** | **Use Cases** | diff --git a/swarms/cli/main.py b/swarms/cli/main.py index 3bcd984b..a798627b 100644 --- a/swarms/cli/main.py +++ b/swarms/cli/main.py @@ -10,6 +10,7 @@ from swarms.agents.create_agents_from_yaml import ( ) from swarms.agents.cli_prompt_generator_func import generate_prompt import subprocess + console = Console() @@ -101,29 +102,43 @@ def check_login(): with open(cache_file, "w") as f: f.write("logged_in") console.print("[bold green]Login successful![/bold green]") - + + def check_and_upgrade_version(): - console.print("[bold yellow]Checking for Swarms updates...[/bold yellow]") + console.print( + "[bold yellow]Checking for Swarms updates...[/bold yellow]" + ) try: # Check for updates using pip result = subprocess.run( ["pip", "list", "--outdated", "--format=freeze"], capture_output=True, - text=True + text=True, ) outdated_packages = result.stdout.splitlines() # Check if Swarms is outdated for package in outdated_packages: if package.startswith("swarms=="): - console.print("[bold magenta]New version available! Upgrading...[/bold magenta]") - subprocess.run(["pip", "install", "--upgrade", "swarms"], check=True) - console.print("[bold green]Swarms upgraded successfully![/bold green]") + console.print( + "[bold magenta]New version available! Upgrading...[/bold magenta]" + ) + subprocess.run( + ["pip", "install", "--upgrade", "swarms"], + check=True, + ) + console.print( + "[bold green]Swarms upgraded successfully![/bold green]" + ) return - console.print("[bold green]Swarms is up-to-date.[/bold green]") + console.print( + "[bold green]Swarms is up-to-date.[/bold green]" + ) except Exception as e: - console.print(f"[bold red]Error checking for updates: {e}[/bold red]") + console.print( + f"[bold red]Error checking for updates: {e}[/bold red]" + ) # Main CLI handler @@ -190,7 +205,9 @@ def main(): yaml_file=args.yaml_file, return_type="tasks" ) elif args.command == "generate-prompt": - if args.prompt: # Corrected from args.prompt_task to args.prompt + if ( + args.prompt + ): # Corrected from args.prompt_task to args.prompt generate_prompt( num_loops=args.num_loops, autosave=args.autosave,