The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework
π¦ Twitter β’ π’ Discord β’ Swarms Platform β’ π Documentation
[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb) [![GitHub issues](https://img.shields.io/github/issues/kyegomez/swarms)](https://github.com/kyegomez/swarms/issues) [![GitHub forks](https://img.shields.io/github/forks/kyegomez/swarms)](https://github.com/kyegomez/swarms/network) [![GitHub stars](https://img.shields.io/github/stars/kyegomez/swarms)](https://github.com/kyegomez/swarms/stargazers) [![GitHub license](https://img.shields.io/github/license/kyegomez/swarms)](https://github.com/kyegomez/swarms/blob/main/LICENSE)[![GitHub star chart](https://img.shields.io/github/stars/kyegomez/swarms?style=social)](https://star-history.com/#kyegomez/swarms)[![Dependency Status](https://img.shields.io/librariesio/github/kyegomez/swarms)](https://libraries.io/github/kyegomez/swarms) [![Downloads](https://static.pepy.tech/badge/swarms/month)](https://pepy.tech/project/swarms) [![Share on Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Share%20%40kyegomez/swarms)](https://twitter.com/intent/tweet?text=Check%20out%20this%20amazing%20AI%20project:%20&url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms) [![Share on Facebook](https://img.shields.io/badge/Share-%20facebook-blue)](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms) [![Share on LinkedIn](https://img.shields.io/badge/Share-%20linkedin-blue)](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&title=&summary=&source=) [![Share on Reddit](https://img.shields.io/badge/-Share%20on%20Reddit-orange)](https://www.reddit.com/submit?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&title=Swarms%20-%20the%20future%20of%20AI) [![Share on Hacker News](https://img.shields.io/badge/-Share%20on%20Hacker%20News-orange)](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&t=Swarms%20-%20the%20future%20of%20AI) [![Share on Pinterest](https://img.shields.io/badge/-Share%20on%20Pinterest-red)](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&media=https%3A%2F%2Fexample.com%2Fimage.jpg&description=Swarms%20-%20the%20future%20of%20AI) [![Share on WhatsApp](https://img.shields.io/badge/-Share%20on%20WhatsApp-green)](https://api.whatsapp.com/send?text=Check%20out%20Swarms%20-%20the%20future%20of%20AI%20%23swarms%20%23AI%0A%0Ahttps%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms) Swarms is an enterprise grade and production ready multi-agent collaboration framework that enables you to orchestrate many agents to work collaboratively at scale to automate real-world activities. ---- ## Requirements - `python3.10` or above! - `$ pip install -U swarms` And, don't forget to install swarms! - `.env` file with API keys from your providers like `OPENAI_API_KEY`, `ANTHROPIC_API_KEY` - Set an `.env` Variable with your desired workspace dir: `WORKSPACE_DIR="agent_workspace"` or do it in your terminal with `export WORKSPACE_DIR="agent_workspace"` ## Onboarding Refer to our documentation for production grade implementation details. | Section | Links | |----------------------|--------------------------------------------------------------------------------------------| | Installation | [Installation](https://docs.swarms.world/en/latest/swarms/install/install/) | | Quickstart | [Get Started](https://docs.swarms.world/en/latest/swarms/install/quickstart/) | | Agent Internal Mechanisms | [Agent Architecture](https://docs.swarms.world/en/latest/swarms/framework/agents_explained/) | | Agent API | [Agent API](https://docs.swarms.world/en/latest/swarms/structs/agent/) | | Integrating External Agents Griptape, Autogen, etc | [Integrating External APIs](https://docs.swarms.world/en/latest/swarms/agents/external_party_agents/) | | Creating Agents from YAML | [Creating Agents from YAML](https://docs.swarms.world/en/latest/swarms/agents/create_agents_yaml/) | | Why You Need Swarms | [Why MultiAgent Collaboration is Necessary](https://docs.swarms.world/en/latest/swarms/concept/why/) | | Swarm Architectures Analysis | [Swarm Architectures](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/) | | Choosing the Right Swarm for Your Business ProblemΒΆ | [CLICK HERE](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/) | | AgentRearrange Docs| [CLICK HERE](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/) | ## Install π» ```bash $ pip3 install -U swarms ``` ## Onboarding Now that you have downloaded swarms with `pip3 install -U swarms`, we get access to the `CLI`. Get Onboarded with CLI Now with: ```bash swarms onboarding ``` You can also run this command for help: ```bash swarms help ``` ### Output ```bash _________ / _____/_ _ _______ _______ _____ ______ \_____ \ \/ \/ /\__ \_ __ \/ \ / ___/ / \ / / __ \| | \/ Y Y \___ \ /_______ / \/\_/ (____ /__| |__|_| /____ > \/ \/ \/ \/ Swarms CLI - Help Commands: onboarding : Starts the onboarding process help : Shows this help message get-api-key : Retrieves your API key from the platform check-login : Checks if you're logged in and starts the cache read-docs : Redirects you to swarms cloud documentation! run-agents : Run your Agents from your agents.yaml For more details, visit: https://docs.swarms.world ``` For more documentation on the CLI [CLICK HERE](https://docs.swarms.world/en/latest/swarms/cli/main/) --- # Usage Examples π€ Here are some simple examples but we have more comprehensive documentation at our [docs here](https://docs.swarms.world/en/latest/) --- ## `Agent` Class The `Agent` class is a fundamental component of the Swarms framework, designed to execute tasks autonomously. It fuses llms, tools and long-term memory capabilities to create a full stack agent. The `Agent` class is highly customizable, allowing for fine-grained control over its behavior and interactions. ### `run` Method The `run` method is the primary entry point for executing tasks with an `Agent` instance. It accepts a task string as the main input task and processes it according to the agent's configuration. And, it can also accept an `img` parameter such as `img="image_filepath.png` to process images if you have a VLM ### Settings and Customization The `Agent` class offers a range of settings to tailor its behavior to specific needs. Some key settings include: | Setting | Description | Default Value | | --- | --- | --- | | `agent_name` | The name of the agent. | "DefaultAgent" | | `system_prompt` | The system prompt to use for the agent. | "Default system prompt." | | `llm` | The language model to use for processing tasks. | `OpenAIChat` instance | | `max_loops` | The maximum number of loops to execute for a task. | 1 | | `autosave` | Enables or disables autosaving of the agent's state. | False | | `dashboard` | Enables or disables the dashboard for the agent. | False | | `verbose` | Controls the verbosity of the agent's output. | False | | `dynamic_temperature_enabled` | Enables or disables dynamic temperature adjustment for the language model. | False | | `saved_state_path` | The path to save the agent's state. | "agent_state.json" | | `user_name` | The username associated with the agent. | "default_user" | | `retry_attempts` | The number of retry attempts for failed tasks. | 1 | | `context_length` | The maximum length of the context to consider for tasks. | 200000 | | `return_step_meta` | Controls whether to return step metadata in the output. | False | | `output_type` | The type of output to return (e.g., "json", "string"). | "string" | ```python import os from swarms import Agent from swarm_models import OpenAIChat from swarms.prompts.finance_agent_sys_prompt import ( FINANCIAL_AGENT_SYS_PROMPT, ) from dotenv import load_dotenv load_dotenv() # Get the OpenAI API key from the environment variable api_key = os.getenv("OPENAI_API_KEY") # Create an instance of the OpenAIChat class model = OpenAIChat( openai_api_key=api_key, model_name="gpt-4o-mini", temperature=0.1 ) # Initialize the agent agent = Agent( agent_name="Financial-Analysis-Agent", system_prompt=FINANCIAL_AGENT_SYS_PROMPT, llm=model, max_loops=1, autosave=True, dashboard=False, verbose=True, dynamic_temperature_enabled=True, saved_state_path="finance_agent.json", user_name="swarms_corp", retry_attempts=1, context_length=200000, return_step_meta=False, # output_type="json", ) out = agent.run( "How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria" ) print(out) ``` ----- ### Integrating RAG with Swarms for Enhanced Long-Term Memory `Agent` equipped with quasi-infinite long term memory using RAG (Relational Agent Graph) for advanced document understanding, analysis, and retrieval capabilities. **Mermaid Diagram for RAG Integration** ```mermaid graph TD A[Initialize Agent with RAG] --> B[Receive Task] B --> C[Query Long-Term Memory] C --> D[Process Task with Context] D --> E[Generate Response] E --> F[Update Long-Term Memory] F --> G[Return Output] ``` **Step 1: Initialize the ChromaDB Client** ```python import os from swarms_memory import ChromaDB # Initialize the ChromaDB client for long-term memory management chromadb = ChromaDB( metric="cosine", # Metric for similarity measurement output_dir="finance_agent_rag", # Directory for storing RAG data # docs_folder="artifacts", # Uncomment and specify the folder containing your documents ) ``` **Step 2: Define the Model** ```python from swarm_models import Anthropic from swarms.prompts.finance_agent_sys_prompt import ( FINANCIAL_AGENT_SYS_PROMPT, ) # Define the Anthropic model for language processing model = Anthropic(anthropic_api_key=os.getenv("ANTHROPIC_API_KEY")) ``` **Step 3: Initialize the Agent with RAG** ```python from swarms import Agent # Initialize the agent with RAG capabilities agent = Agent( agent_name="Financial-Analysis-Agent", system_prompt=FINANCIAL_AGENT_SYS_PROMPT, agent_description="Agent creates a comprehensive financial analysis", llm=model, max_loops="auto", # Auto-adjusts loops based on task complexity autosave=True, # Automatically saves agent state dashboard=False, # Disables dashboard for this example verbose=True, # Enables verbose mode for detailed output streaming_on=True, # Enables streaming for real-time processing dynamic_temperature_enabled=True, # Dynamically adjusts temperature for optimal performance saved_state_path="finance_agent.json", # Path to save agent state user_name="swarms_corp", # User name for the agent retry_attempts=3, # Number of retry attempts for failed tasks context_length=200000, # Maximum length of the context to consider long_term_memory=chromadb, # Integrates ChromaDB for long-term memory management ) # Run the agent with a sample task agent.run( "What are the components of a startups stock incentive equity plan" ) ``` ------- ### Misc Agent Settings We provide vast array of features to save agent states using json, yaml, toml, upload pdfs, batched jobs, and much more! **Method Table** | Method | Description | | --- | --- | | `to_dict()` | Converts the agent object to a dictionary. | | `to_toml()` | Converts the agent object to a TOML string. | | `model_dump_json()` | Dumps the model to a JSON file. | | `model_dump_yaml()` | Dumps the model to a YAML file. | | `ingest_docs()` | Ingests documents into the agent's knowledge base. | | `receive_message()` | Receives a message from a user and processes it. | | `send_agent_message()` | Sends a message from the agent to a user. | | `filtered_run()` | Runs the agent with a filtered system prompt. | | `bulk_run()` | Runs the agent with multiple system prompts. | | `add_memory()` | Adds a memory to the agent. | | `check_available_tokens()` | Checks the number of available tokens for the agent. | | `tokens_checks()` | Performs token checks for the agent. | | `print_dashboard()` | Prints the dashboard of the agent. | | `get_docs_from_doc_folders()` | Fetches all the documents from the doc folders. | | `activate_agentops()` | Activates agent operations. | | `check_end_session_agentops()` | Checks the end of the session for agent operations. | ```python # # Convert the agent object to a dictionary print(agent.to_dict()) print(agent.to_toml()) print(agent.model_dump_json()) print(agent.model_dump_yaml()) # Ingest documents into the agent's knowledge base agent.ingest_docs("your_pdf_path.pdf") # Receive a message from a user and process it agent.receive_message(name="agent_name", message="message") # Send a message from the agent to a user agent.send_agent_message(agent_name="agent_name", message="message") # Ingest multiple documents into the agent's knowledge base agent.ingest_docs("your_pdf_path.pdf", "your_csv_path.csv") # Run the agent with a filtered system prompt agent.filtered_run( "How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?" ) # Run the agent with multiple system prompts agent.bulk_run( [ "How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?", "Another system prompt", ] ) # Add a memory to the agent agent.add_memory("Add a memory to the agent") # Check the number of available tokens for the agent agent.check_available_tokens() # Perform token checks for the agent agent.tokens_checks() # Print the dashboard of the agent agent.print_dashboard() # Fetch all the documents from the doc folders agent.get_docs_from_doc_folders() # Activate agent ops agent.activate_agentops() agent.check_end_session_agentops() # Dump the model to a JSON file agent.model_dump_json() print(agent.to_toml()) ``` ### `Agent`with Pydantic BaseModel as Output Type The following is an example of an agent that intakes a pydantic basemodel and outputs it at the same time: ```python from pydantic import BaseModel, Field from swarms import Agent from swarm_models import Anthropic # Initialize the schema for the person's information class Schema(BaseModel): name: str = Field(..., title="Name of the person") agent: int = Field(..., title="Age of the person") is_student: bool = Field(..., title="Whether the person is a student") courses: list[str] = Field( ..., title="List of courses the person is taking" ) # Convert the schema to a JSON string tool_schema = Schema( name="Tool Name", agent=1, is_student=True, courses=["Course1", "Course2"], ) # Define the task to generate a person's information task = "Generate a person's information based on the following schema:" # Initialize the agent agent = Agent( agent_name="Person Information Generator", system_prompt=( "Generate a person's information based on the following schema:" ), # Set the tool schema to the JSON string -- this is the key difference tool_schema=tool_schema, llm=Anthropic(), max_loops=3, autosave=True, dashboard=False, streaming_on=True, verbose=True, interactive=True, # Set the output type to the tool schema which is a BaseModel output_type=tool_schema, # or dict, or str metadata_output_type="json", # List of schemas that the agent can handle list_base_models=[tool_schema], function_calling_format_type="OpenAI", function_calling_type="json", # or soon yaml ) # Run the agent to generate the person's information generated_data = agent.run(task) # Print the generated data print(f"Generated data: {generated_data}") ``` ### Multi Modal Autonomous Agent Run the agent with multiple modalities useful for various real-world tasks in manufacturing, logistics, and health. ```python import os from dotenv import load_dotenv from swarms import Agent from swarm_models import GPT4VisionAPI # Load the environment variables load_dotenv() # Initialize the language model llm = GPT4VisionAPI( openai_api_key=os.environ.get("OPENAI_API_KEY"), max_tokens=500, ) # Initialize the task task = ( "Analyze this image of an assembly line and identify any issues such as" " misaligned parts, defects, or deviations from the standard assembly" " process. IF there is anything unsafe in the image, explain why it is" " unsafe and how it could be improved." ) img = "assembly_line.jpg" ## Initialize the workflow agent = Agent( agent_name = "Multi-ModalAgent", llm=llm, max_loops="auto", autosave=True, dashboard=True, multi_modal=True ) # Run the workflow on a task agent.run(task, img) ``` ---- ### `ToolAgent` ToolAgent is an agent that can use tools through JSON function calling. It intakes any open source model from huggingface and is extremely modular and plug in and play. We need help adding general support to all models soon. ```python from pydantic import BaseModel, Field from transformers import AutoModelForCausalLM, AutoTokenizer from swarms import ToolAgent from swarms.utils.json_utils import base_model_to_json # Load the pre-trained model and tokenizer model = AutoModelForCausalLM.from_pretrained( "databricks/dolly-v2-12b", load_in_4bit=True, device_map="auto", ) tokenizer = AutoTokenizer.from_pretrained("databricks/dolly-v2-12b") # Initialize the schema for the person's information class Schema(BaseModel): name: str = Field(..., title="Name of the person") agent: int = Field(..., title="Age of the person") is_student: bool = Field( ..., title="Whether the person is a student" ) courses: list[str] = Field( ..., title="List of courses the person is taking" ) # Convert the schema to a JSON string tool_schema = base_model_to_json(Schema) # Define the task to generate a person's information task = ( "Generate a person's information based on the following schema:" ) # Create an instance of the ToolAgent class agent = ToolAgent( name="dolly-function-agent", description="Ana gent to create a child data", model=model, tokenizer=tokenizer, json_schema=tool_schema, ) # Run the agent to generate the person's information generated_data = agent.run(task) # Print the generated data print(f"Generated data: {generated_data}") ``` ## Integrating External Agents Integrating external agents from other agent frameworks is easy with swarms. Steps: 1. Create a new class that inherits `Agent` 2. Create a `.run(task: str) -> str` method that runs the agent and returns the response. 3. The new Agent must return a string of the response. But you may add additional methods to save the output to JSON. ### Griptape Example For example, here's an example on how to create an agent from griptape. Hereβs how you can create a custom **Griptape** agent that integrates with the **Swarms** framework by inheriting from the `Agent` class in **Swarms** and overriding the `run(task: str) -> str` method. ```python from swarms import ( Agent as SwarmsAgent, ) # Import the base Agent class from Swarms from griptape.structures import Agent as GriptapeAgent from griptape.tools import ( WebScraperTool, FileManagerTool, PromptSummaryTool, ) # Create a custom agent class that inherits from SwarmsAgent class GriptapeSwarmsAgent(SwarmsAgent): def __init__(self, *args, **kwargs): # Initialize the Griptape agent with its tools self.agent = GriptapeAgent( input="Load {{ args[0] }}, summarize it, and store it in a file called {{ args[1] }}.", tools=[ WebScraperTool(off_prompt=True), PromptSummaryTool(off_prompt=True), FileManagerTool(), ], *args, **kwargs, # Add additional settings ) # Override the run method to take a task and execute it using the Griptape agent def run(self, task: str) -> str: # Extract URL and filename from task (you can modify this parsing based on task structure) url, filename = task.split( "," ) # Example of splitting task string # Execute the Griptape agent with the task inputs result = self.agent.run(url.strip(), filename.strip()) # Return the final result as a string return str(result) # Example usage: griptape_swarms_agent = GriptapeSwarmsAgent() output = griptape_swarms_agent.run( "https://griptape.ai, griptape.txt" ) print(output) ``` ### Key Components: 1. **GriptapeSwarmsAgent**: A custom class that inherits from the `SwarmsAgent` class and integrates the Griptape agent. 2. **run(task: str) -> str**: A method that takes a task string, processes it (e.g., splitting into a URL and filename), and runs the Griptape agent with the provided inputs. 3. **Griptape Tools**: The tools integrated into the Griptape agent (e.g., `WebScraperTool`, `PromptSummaryTool`, `FileManagerTool`) allow for web scraping, summarization, and file management. You can now easily plug this custom Griptape agent into the **Swarms Framework** and use it to run tasks! # 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. 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. | **Name** | **Description** | **Code Link** | **Use Cases** | |-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------| | Hierarchical Swarms | A system where agents are organized in a hierarchy, with higher-level agents coordinating lower-level agents to achieve complex tasks. | [Code Link](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/#hierarchical-swarm) | Manufacturing process optimization, multi-level sales management, healthcare resource coordination | | Agent Rearrange | A setup where agents rearrange themselves dynamically based on the task requirements and environmental conditions. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/) | Adaptive manufacturing lines, dynamic sales territory realignment, flexible healthcare staffing | | Concurrent Workflows | Agents perform different tasks simultaneously, coordinating to complete a larger goal. | [Code Link](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/#concurrent-workflows) | Concurrent production lines, parallel sales operations, simultaneous patient care processes | | Sequential Coordination | Agents perform tasks in a specific sequence, where the completion of one task triggers the start of the next. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/sequential_workflow/) | Step-by-step assembly lines, sequential sales processes, stepwise patient treatment workflows | | Parallel Processing | Agents work on different parts of a task simultaneously to speed up the overall process. | [Code Link](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/#parallel-processing) | Parallel data processing in manufacturing, simultaneous sales analytics, concurrent medical tests | | Mixture of Agents | A heterogeneous swarm where agents with different capabilities are combined to solve complex problems. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/moa/) | Financial forecasting, complex problem-solving requiring diverse skills | | Graph Workflow | Agents collaborate in a directed acyclic graph (DAG) format to manage dependencies and parallel tasks. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/graph_workflow/) | AI-driven software development pipelines, complex project management | | Group Chat | Agents engage in a chat-like interaction to reach decisions collaboratively. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/group_chat/) | Real-time collaborative decision-making, contract negotiations | | Agent Registry | A centralized registry where agents are stored, retrieved, and invoked dynamically. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/agent_registry/) | Dynamic agent management, evolving recommendation engines | | Spreadsheet Swarm | Manages tasks at scale, tracking agent outputs in a structured format like CSV files. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/spreadsheet_swarm/) | Large-scale marketing analytics, financial audits | | Forest Swarm | A swarm structure that organizes agents in a tree-like hierarchy for complex decision-making processes. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/forest_swarm/) | Multi-stage workflows, hierarchical reinforcement learning | ### `SequentialWorkflow` Sequential Workflow enables you to sequentially execute tasks with `Agent` and then pass the output into the next agent and onwards until you have specified your max loops. ```mermaid graph LR A[Agent 1] --> B[Agent 2] B --> C[Agent 3] C --> D[Agent 4] D --> E[Max Loops] E --> F[End] ``` In this example, each `Agent` represents a task that is executed sequentially. The output of each agent is passed to the next agent in the sequence until the maximum number of loops is reached. This workflow is particularly useful for tasks that require a series of steps to be executed in a specific order, such as data processing pipelines or complex calculations that rely on the output of previous steps. ```python from swarms import Agent, SequentialWorkflow from swarm_models import Anthropic # Initialize the language model agent (e.g., GPT-3) llm = Anthropic() # Initialize agents for individual tasks agent1 = Agent( agent_name="Blog generator", system_prompt="Generate a blog post like stephen king", llm=llm, max_loops=1, dashboard=False, tools=[], ) agent2 = Agent( agent_name="summarizer", system_prompt="Sumamrize the blog post", llm=llm, max_loops=1, dashboard=False, tools=[], ) # Create the Sequential workflow workflow = SequentialWorkflow( agents=[agent1, agent2], max_loops=1, verbose=False ) # Run the workflow workflow.run( "Generate a blog post on how swarms of agents can help businesses grow." ) ``` ------ ## `AgentRearrange` The `AgentRearrange` orchestration technique, inspired by Einops and einsum, allows you to define and map out the relationships between various agents. It provides a powerful tool for orchestrating complex workflows, enabling you to specify linear and sequential relationships such as `a -> a1 -> a2 -> a3`, or concurrent relationships where the first agent sends a message to 3 agents simultaneously: `a -> a1, a2, a3`. This level of customization allows for the creation of highly efficient and dynamic workflows, where agents can work in parallel or in sequence as needed. The `AgentRearrange` technique is a valuable addition to the swarms library, providing a new level of flexibility and control over the orchestration of agents. For more detailed information and examples, please refer to the [official documentation](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/). ```python from swarms import Agent, AgentRearrange from swarm_models import Anthropic # Initialize the director agent director = Agent( agent_name="Director", system_prompt="Directs the tasks for the workers", llm=Anthropic(), max_loops=1, dashboard=False, streaming_on=True, verbose=True, stopping_token="