Welcome to the walkthrough guide for beginners on using the "Flow" feature within the Swarms framework. This guide is designed to help you understand and utilize the capabilities of the Flow class for seamless and reliable interactions with autonomous agents.
Welcome to the walkthrough guide for beginners on using the "Agent" feature within the Swarms framework. This guide is designed to help you understand and utilize the capabilities of the Agent class for seamless and reliable interactions with autonomous agents.
## Official Swarms Links
## Official Swarms Links
=====================
=====================
@ -21,27 +21,27 @@ Now let's begin...
## [Table of Contents](https://github.com/kyegomez/swarms)
## [Table of Contents](https://github.com/kyegomez/swarms)
### [1.1 What is Swarms?](https://github.com/kyegomez/swarms)
### [1.1 What is Swarms?](https://github.com/kyegomez/swarms)
@ -70,23 +70,23 @@ Now let's begin...
Swarms is a powerful framework designed to provide tools and capabilities for working with language models and automating various tasks. It allows developers to interact with language models seamlessly.
Swarms is a powerful framework designed to provide tools and capabilities for working with language models and automating various tasks. It allows developers to interact with language models seamlessly.
## 1.2 Understanding the Flow Feature
## 1.2 Understanding the Agent Feature
==================================
==================================
### [What is the Flow Feature?](https://github.com/kyegomez/swarms)
### [What is the Agent Feature?](https://github.com/kyegomez/swarms)
The Flow feature is a powerful component of the Swarms framework that allows developers to create a sequential, conversational interaction with AI language models. It enables developers to build multi-step conversations, generate long-form content, and perform complex tasks using AI. The Flow class provides autonomy to language models, enabling them to generate responses in a structured manner.
The Agent feature is a powerful component of the Swarms framework that allows developers to create a sequential, conversational interaction with AI language models. It enables developers to build multi-step conversations, generate long-form content, and perform complex tasks using AI. The Agent class provides autonomy to language models, enabling them to generate responses in a structured manner.
Before diving into the practical aspects, let's clarify some key concepts related to the Flow feature:
Before diving into the practical aspects, let's clarify some key concepts related to the Agent feature:
- Flow: A Flow is an instance of the Flow class that represents an ongoing interaction with an AI language model. It consists of a series of steps and responses.
- Agent: A Agent is an instance of the Agent class that represents an ongoing interaction with an AI language model. It consists of a series of steps and responses.
- Stopping Condition: A stopping condition is a criterion that, when met, allows the Flow to stop generating responses. This can be user-defined and can depend on the content of the responses.
- Stopping Condition: A stopping condition is a criterion that, when met, allows the Agent to stop generating responses. This can be user-defined and can depend on the content of the responses.
- Loop Interval: The loop interval specifies the time delay between consecutive interactions with the AI model.
- Loop Interval: The loop interval specifies the time delay between consecutive interactions with the AI model.
- Retry Mechanism: In case of errors or failures during AI model interactions, the Flow can be configured to make multiple retry attempts with a specified interval.
- Retry Mechanism: In case of errors or failures during AI model interactions, the Agent can be configured to make multiple retry attempts with a specified interval.
- Interactive Mode: Interactive mode allows developers to have a back-and-forth conversation with the AI model, making it suitable for real-time interactions.
- Interactive Mode: Interactive mode allows developers to have a back-and-forth conversation with the AI model, making it suitable for real-time interactions.
## [2. Setting Up Your Development Environment](https://github.com/kyegomez/swarms)
## [2. Setting Up Your Development Environment](https://github.com/kyegomez/swarms)
@ -95,38 +95,38 @@ Before diving into the practical aspects, let's clarify some key concepts relate
Before you can start using the Swarms Flow module, you need to set up your development environment. First, you'll need to install the necessary dependencies, including Swarms itself.
Before you can start using the Swarms Agent module, you need to set up your development environment. First, you'll need to install the necessary dependencies, including Swarms itself.
# Install Swarms and required libraries
# Install Swarms and required libraries
`pip3 install --upgrade swarms`
`pip3 install --upgrade swarms`
## [2. Creating Your First Flow](https://github.com/kyegomez/swarms)
## [2. Creating Your First Agent](https://github.com/kyegomez/swarms)
Now, let's create your first Flow. A Flow represents a chain-like structure that allows you to engage in multi-step conversations with language models. The Flow structure is what gives an LLM autonomy. It's the Mitochondria of an autonomous agent.
Now, let's create your first Agent. A Agent represents a chain-like structure that allows you to engage in multi-step conversations with language models. The Agent structure is what gives an LLM autonomy. It's the Mitochondria of an autonomous agent.
# Import necessary modules
# Import necessary modules
```python
```python
from swarms.models import OpenAIChat # Zephr, Mistral
from swarms.models import OpenAIChat # Zephr, Mistral
from swarms.structs import Flow
from swarms.structs import Agent
api_key = ""# Initialize the language model (LLM)
api_key = ""# Initialize the language model (LLM)
llm = OpenAIChat(openai_api_key=api_key, temperature=0.5, max_tokens=3000)# Initialize the Flow object
llm = OpenAIChat(openai_api_key=api_key, temperature=0.5, max_tokens=3000)# Initialize the Agent object
flow = Flow(llm=llm, max_loops=5)# Run the flow
agent = Agent(llm=llm, max_loops=5)# Run the agent
out = flow.run("Create an financial analysis on the following metrics")
out = agent.run("Create an financial analysis on the following metrics")
print(out)
print(out)
```
```
### [3. Initializing the Flow Object](https://github.com/kyegomez/swarms)
### [3. Initializing the Agent Object](https://github.com/kyegomez/swarms)
You can define custom stopping conditions for your Flow. For example, you might want the Flow to stop when a specific word is mentioned in the response.
You can define custom stopping conditions for your Agent. For example, you might want the Agent to stop when a specific word is mentioned in the response.
Interactive mode allows you to have a back-and-forth conversation with the language model. When enabled, the Flow will prompt for user input after each response.
Interactive mode allows you to have a back-and-forth conversation with the language model. When enabled, the Agent will prompt for user input after each response.
# Enable interactive mode
# Enable interactive mode
`flow.interactive = True`
`agent.interactive = True`
This is useful for real-time conversations with the model.
This is useful for real-time conversations with the model.
## [5. Saving and Loading Flows](https://github.com/kyegomez/swarms)
## [5. Saving and Loading Agents](https://github.com/kyegomez/swarms)
In a world where digital tasks continue to multiply and diversify, the need for automation has never been more critical. Developers find themselves at the forefront of this automation revolution, tasked with creating reliable solutions that can seamlessly handle an array of digital tasks. Enter the Swarms framework and the Flow structure, a dynamic duo that empowers developers to build autonomous agents capable of efficiently and effectively automating a wide range of digital tasks.
In a world where digital tasks continue to multiply and diversify, the need for automation has never been more critical. Developers find themselves at the forefront of this automation revolution, tasked with creating reliable solutions that can seamlessly handle an array of digital tasks. Enter the Swarms framework and the Agent structure, a dynamic duo that empowers developers to build autonomous agents capable of efficiently and effectively automating a wide range of digital tasks.
@ -300,7 +300,7 @@ One of the standout features of Swarms is its seamless integration with state-of
By leveraging Swarms, developers can effortlessly incorporate these language models into their applications and workflows. For instance, they can build chatbots that provide intelligent responses to customer inquiries or generate lengthy documents with minimal manual intervention. This not only saves time but also enhances overall productivity.
By leveraging Swarms, developers can effortlessly incorporate these language models into their applications and workflows. For instance, they can build chatbots that provide intelligent responses to customer inquiries or generate lengthy documents with minimal manual intervention. This not only saves time but also enhances overall productivity.
Swarms excels in orchestrating multi-step conversational flows. Developers can define intricate sequences of interactions, where the system generates responses, and users provide input at various stages. This functionality is a game-changer for building chatbots, virtual assistants, or any application requiring dynamic and context-aware conversations.
Swarms excels in orchestrating multi-step conversational flows. Developers can define intricate sequences of interactions, where the system generates responses, and users provide input at various stages. This functionality is a game-changer for building chatbots, virtual assistants, or any application requiring dynamic and context-aware conversations.
@ -324,58 +324,58 @@ Swarms encourages the collection of feedback on generated responses. Developers
Error handling is a critical aspect of any automation framework. Swarms simplifies this process by offering a retry mechanism. In case of errors or issues during conversations, developers can configure the framework to attempt generating responses again, ensuring robust and resilient automation.
Error handling is a critical aspect of any automation framework. Swarms simplifies this process by offering a retry mechanism. In case of errors or issues during conversations, developers can configure the framework to attempt generating responses again, ensuring robust and resilient automation.
[6. Saving and Loading Flows](https://github.com/kyegomez/swarms)
[6. Saving and Loading Agents](https://github.com/kyegomez/swarms)
Developers can save the state of their conversational flows, allowing for seamless continuity and reusability. This feature is particularly beneficial when working on long-term projects or scenarios where conversations need to be resumed from a specific point.
Developers can save the state of their conversational flows, allowing for seamless continuity and reusability. This feature is particularly beneficial when working on long-term projects or scenarios where conversations need to be resumed from a specific point.
[Unleashing the Potential of Automation with Swarms and Flow](https://github.com/kyegomez/swarms)
[Unleashing the Potential of Automation with Swarms and Agent](https://github.com/kyegomez/swarms)
The combined power of the Swarms framework and the Flow structure creates a synergy that empowers developers to automate a multitude of digital tasks. These tools provide versatility, customization, and extensibility, making them ideal for a wide range of applications. Let's explore some of the remarkable ways in which developers can leverage Swarms and Flow for automation:
The combined power of the Swarms framework and the Agent structure creates a synergy that empowers developers to automate a multitude of digital tasks. These tools provide versatility, customization, and extensibility, making them ideal for a wide range of applications. Let's explore some of the remarkable ways in which developers can leverage Swarms and Agent for automation:
[1. Customer Support and Service Automation](https://github.com/kyegomez/swarms)
[1. Customer Support and Service Automation](https://github.com/kyegomez/swarms)
Swarms and Flow enable the creation of AI-powered customer support chatbots that excel at handling common inquiries, troubleshooting issues, and escalating complex problems to human agents when necessary. This level of automation not only reduces response times but also enhances the overall customer experience.
Swarms and Agent enable the creation of AI-powered customer support chatbots that excel at handling common inquiries, troubleshooting issues, and escalating complex problems to human agents when necessary. This level of automation not only reduces response times but also enhances the overall customer experience.
[2. Content Generation and Curation](https://github.com/kyegomez/swarms)
[2. Content Generation and Curation](https://github.com/kyegomez/swarms)
Developers can harness the power of Swarms and Flow to automate content generation tasks, such as writing articles, reports, or product descriptions. By providing an initial prompt, the system can generate high-quality content that adheres to specific guidelines and styles.
Developers can harness the power of Swarms and Agent to automate content generation tasks, such as writing articles, reports, or product descriptions. By providing an initial prompt, the system can generate high-quality content that adheres to specific guidelines and styles.
Furthermore, these tools can automate content curation by summarizing lengthy articles, extracting key insights from research papers, and even translating content into multiple languages.
Furthermore, these tools can automate content curation by summarizing lengthy articles, extracting key insights from research papers, and even translating content into multiple languages.
[3. Data Analysis and Reporting](https://github.com/kyegomez/swarms)
[3. Data Analysis and Reporting](https://github.com/kyegomez/swarms)
Automation in data analysis and reporting is fundamental for data-driven decision-making. Swarms and Flow simplify these processes by enabling developers to create flows that interact with databases, query data, and generate reports based on user-defined criteria. This empowers businesses to derive insights quickly and make informed decisions.
Automation in data analysis and reporting is fundamental for data-driven decision-making. Swarms and Agent simplify these processes by enabling developers to create flows that interact with databases, query data, and generate reports based on user-defined criteria. This empowers businesses to derive insights quickly and make informed decisions.
[4. Programming and Code Generation](https://github.com/kyegomez/swarms)
[4. Programming and Code Generation](https://github.com/kyegomez/swarms)
Swarms and Flow streamline code generation and programming tasks. Developers can create flows to assist in writing code snippets, auto-completing code, or providing solutions to common programming challenges. This accelerates software development and reduces the likelihood of coding errors.
Swarms and Agent streamline code generation and programming tasks. Developers can create flows to assist in writing code snippets, auto-completing code, or providing solutions to common programming challenges. This accelerates software development and reduces the likelihood of coding errors.
[5. Language Translation and Localization](https://github.com/kyegomez/swarms)
[5. Language Translation and Localization](https://github.com/kyegomez/swarms)
With the ability to interface with language models, Swarms and Flow can automate language translation tasks. They can seamlessly translate content from one language to another, making it easier for businesses to reach global audiences and localize their offerings effectively.
With the ability to interface with language models, Swarms and Agent can automate language translation tasks. They can seamlessly translate content from one language to another, making it easier for businesses to reach global audiences and localize their offerings effectively.
[6. Virtual Assistants and AI Applications](https://github.com/kyegomez/swarms)
[6. Virtual Assistants and AI Applications](https://github.com/kyegomez/swarms)
Developers can build virtual assistants and AI applications that offer personalized experiences. These applications can automate tasks such as setting reminders, answering questions, providing recommendations, and much more. Swarms and Flow provide the foundation for creating intelligent, interactive virtual assistants.
Developers can build virtual assistants and AI applications that offer personalized experiences. These applications can automate tasks such as setting reminders, answering questions, providing recommendations, and much more. Swarms and Agent provide the foundation for creating intelligent, interactive virtual assistants.
[Future Opportunities and Challenges](https://github.com/kyegomez/swarms)
[Future Opportunities and Challenges](https://github.com/kyegomez/swarms)
As Swarms and Flow continue to evolve, developers can look forward to even more advanced features and capabilities. However, with great power comes great responsibility. Developers must remain vigilant about the ethical use of automation and language models. Ensuring that automated systems provide accurate and unbiased information is an ongoing challenge that the developer community must address.
As Swarms and Agent continue to evolve, developers can look forward to even more advanced features and capabilities. However, with great power comes great responsibility. Developers must remain vigilant about the ethical use of automation and language models. Ensuring that automated systems provide accurate and unbiased information is an ongoing challenge that the developer community must address.
The Swarms framework and the Flow structure empower developers to automate an extensive array of digital tasks by offering versatility, customization, and extensibility. From natural language understanding and generation to orchestrating multi-step conversational flows, these tools simplify complex automation scenarios.
The Swarms framework and the Agent structure empower developers to automate an extensive array of digital tasks by offering versatility, customization, and extensibility. From natural language understanding and generation to orchestrating multi-step conversational flows, these tools simplify complex automation scenarios.
By embracing Swarms and Flow, developers can not only save time and resources but also unlock new opportunities for innovation. The ability to harness the power of language models and create intelligent, interactive applications opens doors to a future where automation plays a pivotal role in our digital lives.
By embracing Swarms and Agent, developers can not only save time and resources but also unlock new opportunities for innovation. The ability to harness the power of language models and create intelligent, interactive applications opens doors to a future where automation plays a pivotal role in our digital lives.
As the developer community continues to explore the capabilities of Swarms and Flow, it is essential to approach automation with responsibility, ethics, and a commitment to delivering valuable, user-centric experiences. With Swarms and Flow, the future of automation is in the hands of developers, ready to create a more efficient, intelligent, and automated world.
As the developer community continues to explore the capabilities of Swarms and Agent, it is essential to approach automation with responsibility, ethics, and a commitment to delivering valuable, user-centric experiences. With Swarms and Agent, the future of automation is in the hands of developers, ready to create a more efficient, intelligent, and automated world.
In this code snippet, we have initialized two Flow instances (flow1 and flow2) representing individual tasks within our workflow. These flows will use the OpenAIChat model we initialized earlier. We then create a SequentialWorkflow instance named workflow with a maximum loop count of 1. The max_loops parameter determines how many times the entire workflow can be run, and we set it to 1 for this example.
In this code snippet, we have initialized two Agent instances (flow1 and flow2) representing individual tasks within our workflow. These flows will use the OpenAIChat model we initialized earlier. We then create a SequentialWorkflow instance named workflow with a maximum loop count of 1. The max_loops parameter determines how many times the entire workflow can be run, and we set it to 1 for this example.
Adding Tasks to the SequentialWorkflow
Adding Tasks to the SequentialWorkflow
Now that we have created the SequentialWorkflow, let’s add tasks to it. In our example, we’ll create two tasks: one for generating a 10,000-word blog on “health and wellness” and another for summarizing the generated blog.
Now that we have created the SequentialWorkflow, let’s add tasks to it. In our example, we’ll create two tasks: one for generating a 10,000-word blog on “health and wellness” and another for summarizing the generated blog.
@ -104,7 +104,7 @@ workflow.add("Generate a 10,000 word blog on health and wellness.", flow1)
`workflow.add("Summarize the generated blog", flow2)`
`workflow.add("Summarize the generated blog", flow2)`
The workflow.add() method is used to add tasks to the workflow. Each task is described using a human-readable description, such as "Generate a 10,000 word blog on health and wellness," and is associated with a flow (callable object) that will be executed as the task. In our example, flow1 and flow2 represent the tasks.
The workflow.add() method is used to add tasks to the workflow. Each task is described using a human-readable description, such as "Generate a 10,000 word blog on health and wellness," and is associated with a agent (callable object) that will be executed as the task. In our example, flow1 and flow2 represent the tasks.
Running the SequentialWorkflow
Running the SequentialWorkflow
With tasks added to the SequentialWorkflow, we can now run the workflow sequentially using the workflow.run() method.
With tasks added to the SequentialWorkflow, we can now run the workflow sequentially using the workflow.run() method.
@ -165,7 +165,7 @@ In essence, Swarms makes the dream of comprehensive business automation an attai
### Value prop SWARMS
### Value prop SWARMS
```
```
We've helped thousands of people just like you automate 30% of their activities with Swarms. And, all it takes to get started is a fast simple onboarding flow that asks you to integrate your tools and datasources.
We've helped thousands of people just like you automate 30% of their activities with Swarms. And, all it takes to get started is a fast simple onboarding agent that asks you to integrate your tools and datasources.
```
```
In today's competitive landscape, organizations of all sizes are continually seeking ways to automate routine tasks, streamline processes, and make data-driven decisions. Enter Swarms, a revolutionary AI-based technology that leverages the power of multiple autonomous agents to perform tasks with unprecedented speed and accuracy.
In today's competitive landscape, organizations of all sizes are continually seeking ways to automate routine tasks, streamline processes, and make data-driven decisions. Enter Swarms, a revolutionary AI-based technology that leverages the power of multiple autonomous agents to perform tasks with unprecedented speed and accuracy.
@ -74,7 +74,7 @@ Ultimately, the key is to adopt a long-term perspective, just like Jeff Bezos. I
# Open Source Salesperson Onboarding Experience
# Open Source Salesperson Onboarding Experience
Creating an efficient, streamlined, and effective onboarding experience for open source salespeople is essential to minimize time and maximize engagement. Drawing inspiration from the simplicity and user-focus of Steve Jobs, this document proposes an onboarding flow that is effortless, engaging, and educational.
Creating an efficient, streamlined, and effective onboarding experience for open source salespeople is essential to minimize time and maximize engagement. Drawing inspiration from the simplicity and user-focus of Steve Jobs, this document proposes an onboarding agent that is effortless, engaging, and educational.
"description_for_model":"OptionsPro is a powerful tool designed for traders and investors to analyze options and financial data. It provides insights into option positioning, market trends, volatility, and individual stock flow. The API offers two main endpoints: \"market-outlook\" and \"stock-outlook.\" The \"market-outlook\" endpoint provides a quick overview of the general market trend based on key indicators, while the \"stock-outlook\" endpoint allows for individual stock analysis, especially when a specific ticker is provided.\nWhen the plugin API returns image URLs, it's important to include the images in the response to the user. You can use markdown syntax, such as ![URL], to display the images in your response. Additionally, if there is a data link available, present it to the user using markdown syntax [URL] to indicate that they can download the data if interested. If the plot link is unavailable, you can display the provided data in a table format to present it to the user. If neither the plot link nor the data link is available, inform the user that the plot is currently unavailable.\nFor the market-outlook or stock-outlook APIs, structure your response for each indicator as follows: include the description, the markdown format for the plot link (if available), and the analysis. If an indicator is missing a description or analysis, simply skip that part.\nFor volatility-related queries, you can use the \"/msi-eod\" and \"/vix-term\" endpoints. Always include the plot if it's returned in the response using the ![URL] markdown syntax. If multiple plot urls are returned, show them all. Most responses will include raw calculated data and our analysis. Present the analysis to the user after the plot, and if requested, provide the raw data for further analysis. \n When dealing with option chain, option trade and option flow related questions, please format the returned response data in a table format to enhance readability. \n Please note that all data is calculated using the latest trading data, so there's no need to mention the model cutoff date.\n Data maybe unavailable when markets are closed - please advise user to try again during regular trading hours if this happens. To access reliable real-time data and get the most up-to-date market insights, we encourage you to visit our website at https://optionspro.io/ and explore our premium plans.",
"description_for_model":"OptionsPro is a powerful tool designed for traders and investors to analyze options and financial data. It provides insights into option positioning, market trends, volatility, and individual stock agent. The API offers two main endpoints: \"market-outlook\" and \"stock-outlook.\" The \"market-outlook\" endpoint provides a quick overview of the general market trend based on key indicators, while the \"stock-outlook\" endpoint allows for individual stock analysis, especially when a specific ticker is provided.\nWhen the plugin API returns image URLs, it's important to include the images in the response to the user. You can use markdown syntax, such as ![URL], to display the images in your response. Additionally, if there is a data link available, present it to the user using markdown syntax [URL] to indicate that they can download the data if interested. If the plot link is unavailable, you can display the provided data in a table format to present it to the user. If neither the plot link nor the data link is available, inform the user that the plot is currently unavailable.\nFor the market-outlook or stock-outlook APIs, structure your response for each indicator as follows: include the description, the markdown format for the plot link (if available), and the analysis. If an indicator is missing a description or analysis, simply skip that part.\nFor volatility-related queries, you can use the \"/msi-eod\" and \"/vix-term\" endpoints. Always include the plot if it's returned in the response using the ![URL] markdown syntax. If multiple plot urls are returned, show them all. Most responses will include raw calculated data and our analysis. Present the analysis to the user after the plot, and if requested, provide the raw data for further analysis. \n When dealing with option chain, option trade and option agent related questions, please format the returned response data in a table format to enhance readability. \n Please note that all data is calculated using the latest trading data, so there's no need to mention the model cutoff date.\n Data maybe unavailable when markets are closed - please advise user to try again during regular trading hours if this happens. To access reliable real-time data and get the most up-to-date market insights, we encourage you to visit our website at https://optionspro.io/ and explore our premium plans.",
"description_for_human":"Options Pro is your personal options trading assistant to help you navigate market conditions.",
"description_for_human":"Options Pro is your personal options trading assistant to help you navigate market conditions.",
"auth":{
"auth":{
"type":"none"
"type":"none"
@ -11058,7 +11058,7 @@
"schema_version":"v1",
"schema_version":"v1",
"name_for_model":"EmailByNylas",
"name_for_model":"EmailByNylas",
"name_for_human":"Email by Nylas",
"name_for_human":"Email by Nylas",
"description_for_model":"Use EmailByNylas for accessing email accounts through a conversational interface that follows the following guidelines:\n\n1. Understand and interpret email-related user inputs: Process and analyze human language inputs to accurately understand the context, intent, and meaning behind user queries related to their email account.\n\n2. Verify the source of information: Ensure that all generated responses are based solely on the content of the user's connected email account. Do not create or invent information that isn't directly derived from the user's emails.\n\n3. Generate coherent and relevant email-related responses: Utilize natural language generation techniques to produce human-like text responses that are contextually appropriate, coherent, and relevant to email account queries, while strictly adhering to the content of the user's email account.\n\n4. Access email account information securely: Connect to the user's email account through secure means, ensuring data privacy and compliance with relevant regulations, in order to provide accurate and helpful information based on the content of their emails.\n\n5. Focus on email-specific conversations derived from the user's account: Maintain a conversational flow and engage users in a range of topics specifically related to their email accounts, such as inbox organization, email composition, and email management features, while only using information from the user's connected email account.\n\n6. Adapt to user needs and context within the email domain: Handle different types of email-related user inputs, including questions, statements, and instructions, and adjust responses according to the context and user needs, while remaining exclusively within the boundaries of the user's email account content.\n\n7. Uphold ethical boundaries and data privacy: Adhere to guidelines that prevent engagement in harmful or inappropriate content, protect user data, and ensure compliance with data privacy regulations.\n\n8. Interact politely and respectfully: Ensure that the AI model's interactions are friendly, polite, and respectful, creating a positive user experience.\n\n9. Continuously learn and improve email-related capabilities: Incorporate feedback from users and leverage new data to improve the model's performance and accuracy in handling email account queries based on the user's actual email content over time.",
"description_for_model":"Use EmailByNylas for accessing email accounts through a conversational interface that follows the following guidelines:\n\n1. Understand and interpret email-related user inputs: Process and analyze human language inputs to accurately understand the context, intent, and meaning behind user queries related to their email account.\n\n2. Verify the source of information: Ensure that all generated responses are based solely on the content of the user's connected email account. Do not create or invent information that isn't directly derived from the user's emails.\n\n3. Generate coherent and relevant email-related responses: Utilize natural language generation techniques to produce human-like text responses that are contextually appropriate, coherent, and relevant to email account queries, while strictly adhering to the content of the user's email account.\n\n4. Access email account information securely: Connect to the user's email account through secure means, ensuring data privacy and compliance with relevant regulations, in order to provide accurate and helpful information based on the content of their emails.\n\n5. Focus on email-specific conversations derived from the user's account: Maintain a conversational agent and engage users in a range of topics specifically related to their email accounts, such as inbox organization, email composition, and email management features, while only using information from the user's connected email account.\n\n6. Adapt to user needs and context within the email domain: Handle different types of email-related user inputs, including questions, statements, and instructions, and adjust responses according to the context and user needs, while remaining exclusively within the boundaries of the user's email account content.\n\n7. Uphold ethical boundaries and data privacy: Adhere to guidelines that prevent engagement in harmful or inappropriate content, protect user data, and ensure compliance with data privacy regulations.\n\n8. Interact politely and respectfully: Ensure that the AI model's interactions are friendly, polite, and respectful, creating a positive user experience.\n\n9. Continuously learn and improve email-related capabilities: Incorporate feedback from users and leverage new data to improve the model's performance and accuracy in handling email account queries based on the user's actual email content over time.",
"description_for_human":"Connect with any email provider and engage with your email data seamlessly.",
"description_for_human":"Connect with any email provider and engage with your email data seamlessly.",
@ -34,7 +34,7 @@ Executes the OmniAgent. The agent plans its actions based on the user's input, e
Facilitates an interactive chat with the agent. It processes user messages, handles exceptions, and returns a response, either in streaming format or as a whole string.
Facilitates an interactive chat with the agent. It processes user messages, handles exceptions, and returns a response, either in streaming format or as a whole string.
#### 3. `_stream_response(self, response: str)`:
#### 3. `_stream_response(self, response: str)`:
For streaming mode, this function yields the response token by token, ensuring a smooth output flow.
For streaming mode, this function yields the response token by token, ensuring a smooth output agent.
## Examples & Use Cases
## Examples & Use Cases
Initialize the `OmniModalAgent` and communicate with it:
Initialize the `OmniModalAgent` and communicate with it:
The `Flow` class is a Python module designed to facilitate interactions with a language model, particularly one that operates as an autonomous agent. This class is part of a larger framework aimed at creating conversational agents using advanced language models like GPT-3. It enables you to establish a conversational loop with the model, generate responses, collect feedback, and control the flow of the conversation.
The `Agent` class is a Python module designed to facilitate interactions with a language model, particularly one that operates as an autonomous agent. This class is part of a larger framework aimed at creating conversational agents using advanced language models like GPT-3. It enables you to establish a conversational loop with the model, generate responses, collect feedback, and control the agent of the conversation.
In this documentation, you will learn how to use the `Flow` class effectively, its purpose, and how it can be integrated into your projects.
In this documentation, you will learn how to use the `Agent` class effectively, its purpose, and how it can be integrated into your projects.
## Purpose
## Purpose
The `Flow` class serves several key purposes:
The `Agent` class serves several key purposes:
1. **Conversational Loop**: It establishes a conversational loop with a language model. This means it allows you to interact with the model in a back-and-forth manner, taking turns in the conversation.
1. **Conversational Loop**: It establishes a conversational loop with a language model. This means it allows you to interact with the model in a back-and-forth manner, taking turns in the conversation.
@ -20,10 +20,10 @@ The `Flow` class serves several key purposes:
## Class Definition
## Class Definition
The `Flow` class has the following constructor:
The `Agent` class has the following constructor:
```python
```python
class Flow:
class Agent:
def __init__(
def __init__(
self,
self,
llm: Any,
llm: Any,
@ -49,18 +49,18 @@ class Flow:
## Usage
## Usage
The `Flow` class can be used to create a conversational loop with the language model. Here's how you can use it:
The `Agent` class can be used to create a conversational loop with the language model. Here's how you can use it:
```python
```python
from swarms.structs import Flow
from swarms.structs import Agent
flow = Flow(llm=my_language_model, max_loops=5)
agent = Agent(llm=my_language_model, max_loops=5)
# Define a starting task or message
# Define a starting task or message
initial_task = "Generate a 10,000 word blog on health and wellness."
initial_task = "Generate a 10,000 word blog on health and wellness."
The `Flow` class provides a powerful way to interact with language models in a conversational manner. By defining custom stopping conditions, collecting feedback, and controlling the flow of the conversation, you can create engaging and interactive applications that make use of advanced language models.
The `Agent` class provides a powerful way to interact with language models in a conversational manner. By defining custom stopping conditions, collecting feedback, and controlling the agent of the conversation, you can create engaging and interactive applications that make use of advanced language models.
@ -22,9 +22,9 @@ Before delving into the details of the **SequentialWorkflow** class, let's defin
A **task** refers to a specific unit of work that needs to be executed as part of the workflow. Each task is associated with a description and can be implemented as a callable object, such as a function or a model.
A **task** refers to a specific unit of work that needs to be executed as part of the workflow. Each task is associated with a description and can be implemented as a callable object, such as a function or a model.
### Flow
### Agent
A **flow** represents a callable object that can be a task within the **SequentialWorkflow**. Flows encapsulate the logic and functionality of a particular task. Flows can be functions, models, or any callable object that can be executed.
A **agent** represents a callable object that can be a task within the **SequentialWorkflow**. Agents encapsulate the logic and functionality of a particular task. Agents can be functions, models, or any callable object that can be executed.
### Sequential Execution
### Sequential Execution
@ -70,7 +70,7 @@ The **SequentialWorkflow** class is versatile and can be employed in a wide rang
2. **Workflow Creation**: Create an instance of the **SequentialWorkflow** class. Specify the maximum number of loops the workflow should run and whether a dashboard should be displayed.
2. **Workflow Creation**: Create an instance of the **SequentialWorkflow** class. Specify the maximum number of loops the workflow should run and whether a dashboard should be displayed.
3. **Task Addition**: Add tasks to the workflow using the `add` method. Each task should be described using a human-readable description, and the associated flow (callable object) should be provided. Additional arguments and keyword arguments can be passed to the task.
3. **Task Addition**: Add tasks to the workflow using the `add` method. Each task should be described using a human-readable description, and the associated agent (callable object) should be provided. Additional arguments and keyword arguments can be passed to the task.
4. **Task Execution**: Execute the workflow using the `run` method. The tasks within the workflow will be executed sequentially, with task results passed as inputs to subsequent tasks.
4. **Task Execution**: Execute the workflow using the `run` method. The tasks within the workflow will be executed sequentially, with task results passed as inputs to subsequent tasks.
@ -93,10 +93,10 @@ Let's begin with a quick example to demonstrate how to create and run a Sequenti
```python
```python
from swarms.models import OpenAIChat
from swarms.models import OpenAIChat
from swarms.structs import Flow
from swarms.structs import Agent
from swarms.structs.sequential_workflow import SequentialWorkflow
from swarms.structs.sequential_workflow import SequentialWorkflow
# Initialize the language model flow (e.g., GPT-3)
# Initialize the language model agent (e.g., GPT-3)
- `flow` (Union[Callable, Flow]): The callable object representing the task. It can be a function, class, or a `Flow` instance.
- `agent` (Union[Callable, Agent]): The callable object representing the task. It can be a function, class, or a `Agent` instance.
- `args` (List[Any]): A list of positional arguments to pass to the task when executed. Default is an empty list.
- `args` (List[Any]): A list of positional arguments to pass to the task when executed. Default is an empty list.
- `kwargs` (Dict[str, Any]): A dictionary of keyword arguments to pass to the task when executed. Default is an empty dictionary.
- `kwargs` (Dict[str, Any]): A dictionary of keyword arguments to pass to the task when executed. Default is an empty dictionary.
- `result` (Any): The result of the task's execution. Default is `None`.
- `result` (Any): The result of the task's execution. Default is `None`.
@ -156,7 +156,7 @@ Execute the task.
def execute(self):
def execute(self):
```
```
This method executes the task and updates the `result` and `history` attributes of the task. It checks if the task is a `Flow` instance and if the 'task' argument is needed.
This method executes the task and updates the `result` and `history` attributes of the task. It checks if the task is a `Agent` instance and if the 'task' argument is needed.
This method adds a new task to the workflow. You can provide a description of the task, the callable object (function, class, or `Flow` instance), and any additional positional or keyword arguments required for the task.
This method adds a new task to the workflow. You can provide a description of the task, the callable object (function, class, or `Agent` instance), and any additional positional or keyword arguments required for the task.
#### `reset_workflow()`
#### `reset_workflow()`
@ -262,7 +262,7 @@ Run the workflow sequentially.
def run(self) -> None:
def run(self) -> None:
```
```
This method executes the tasks in the workflow sequentially. It checks if a task is a `Flow` instance and handles the flow of data between tasks accordingly.
This method executes the tasks in the workflow sequentially. It checks if a task is a `Agent` instance and handles the agent of data between tasks accordingly.
#### `arun()`
#### `arun()`
@ -272,7 +272,7 @@ Asynchronously run the workflow.
async def arun(self) -> None:
async def arun(self) -> None:
```
```
This method asynchronously executes the tasks in the workflow sequentially. It's suitable for use cases where asynchronous execution is required. It also handles data flow between tasks.
This method asynchronously executes the tasks in the workflow sequentially. It's suitable for use cases where asynchronous execution is required. It also handles data agent between tasks.
#### `workflow_bootup(**kwargs)`
#### `workflow_bootup(**kwargs)`
@ -306,7 +306,7 @@ In this example, we'll create a Sequential Workflow and add tasks to it.
```python
```python
from swarms.models import OpenAIChat
from swarms.models import OpenAIChat
from swarms.structs import Flow
from swarms.structs import Agent
from swarms.structs.sequential_workflow import SequentialWorkflow
from swarms.structs.sequential_workflow import SequentialWorkflow
@ -579,11 +579,11 @@ In summary, the Sequential Workflow module provides a foundation for orchestrati
## Frequently Asked Questions (FAQs)
## Frequently Asked Questions (FAQs)
### Q1: What is the difference between a task and a flow in Sequential Workflows?
### Q1: What is the difference between a task and a agent in Sequential Workflows?
**A1:** In Sequential Workflows, a **task** refers to a specific unit of work that needs to be executed. It can be implemented as a callable object, such as a Python function, and is the fundamental building block of a workflow.
**A1:** In Sequential Workflows, a **task** refers to a specific unit of work that needs to be executed. It can be implemented as a callable object, such as a Python function, and is the fundamental building block of a workflow.
A **flow**, on the other hand, is an encapsulation of a task within the workflow. Flows define the order in which tasks are executed and can be thought of as task containers. They allow you to specify dependencies, error handling, and other workflow-related configurations.
A **agent**, on the other hand, is an encapsulation of a task within the workflow. Agents define the order in which tasks are executed and can be thought of as task containers. They allow you to specify dependencies, error handling, and other workflow-related configurations.
### Q2: Can I run tasks in parallel within a Sequential Workflow?
### Q2: Can I run tasks in parallel within a Sequential Workflow?
The Swarms framework is a Python library designed to facilitate the creation and management of a simulated group chat environment. This environment can be used for a variety of purposes, such as training conversational agents, role-playing games, or simulating dialogues for machine learning purposes. The core functionality revolves around managing the flow of messages between different agents within the chat, as well as handling the selection and responses of these agents based on the conversation's context.
The Swarms framework is a Python library designed to facilitate the creation and management of a simulated group chat environment. This environment can be used for a variety of purposes, such as training conversational agents, role-playing games, or simulating dialogues for machine learning purposes. The core functionality revolves around managing the agent of messages between different agents within the chat, as well as handling the selection and responses of these agents based on the conversation's context.
### Purpose
### Purpose
@ -13,7 +13,7 @@ The purpose of the Swarms framework, and specifically the `GroupChat` and `Group
### Key Features
### Key Features
- **Agent Interaction**: Allows multiple agents to communicate within a group chat scenario.
- **Agent Interaction**: Allows multiple agents to communicate within a group chat scenario.
- **Message Management**: Handles the storage and flow of messages within the group chat.
- **Message Management**: Handles the storage and agent of messages within the group chat.
- **Role Play**: Enables agents to assume specific roles and interact accordingly.
- **Role Play**: Enables agents to assume specific roles and interact accordingly.
- **Conversation Context**: Maintains the context of the conversation for appropriate responses by agents.
- **Conversation Context**: Maintains the context of the conversation for appropriate responses by agents.
@ -29,7 +29,7 @@ The `GroupChat` class is the backbone of the Swarms framework's chat simulation.
| Parameter | Type | Description | Default Value |
| Parameter | Type | Description | Default Value |
@ -132,7 +132,7 @@ By leveraging the framework's features, users can create complex interaction sce
**Q: Can the Swarms framework handle real-time interactions between agents?**
**Q: Can the Swarms framework handle real-time interactions between agents?**
A: The Swarms framework is designed to simulate group chat environments. While it does not handle real-time interactions as they would occur on a network, it can simulate the flow of conversation in a way that mimics real-time communication.
A: The Swarms framework is designed to simulate group chat environments. While it does not handle real-time interactions as they would occur on a network, it can simulate the agent of conversation in a way that mimics real-time communication.
**Q: Is the Swarms framework capable of natural language processing?**
**Q: Is the Swarms framework capable of natural language processing?**
@ -152,7 +152,7 @@ A: The framework is can be integrated with any chat services. However, it could
**Q: How does the `GroupChatManager` select the next speaker?**
**Q: How does the `GroupChatManager` select the next speaker?**
A: The `GroupChatManager` uses a selection mechanism, which is typically based on the conversation's context and the roles of the agents, to determine the next speaker. The specifics of this mechanism can be customized to match the desired flow of the conversation.
A: The `GroupChatManager` uses a selection mechanism, which is typically based on the conversation's context and the roles of the agents, to determine the next speaker. The specifics of this mechanism can be customized to match the desired agent of the conversation.
**Q: Can I contribute to the Swarms framework or suggest features?**
**Q: Can I contribute to the Swarms framework or suggest features?**
"As the Onboarding Agent, your role is critical in guiding new users, particularly tech-savvy entrepreneurs, through the initial stages of engaging with our advanced swarm technology services. Begin by welcoming users in a friendly, professional manner, setting a positive tone for the interaction. Your conversation should flow logically, starting with an introduction to our services and their potential benefits for the user's specific business context.
"As the Onboarding Agent, your role is critical in guiding new users, particularly tech-savvy entrepreneurs, through the initial stages of engaging with our advanced swarm technology services. Begin by welcoming users in a friendly, professional manner, setting a positive tone for the interaction. Your conversation should agent logically, starting with an introduction to our services and their potential benefits for the user's specific business context.
Inquireabouttheirindustry,delvingintospecificssuchastheindustry's current trends, challenges, and the role technology plays in their sector. Show expertise and understanding by using industry-specific terminology and referencing relevant technological advancements. Ask open-ended questions to encourage detailed responses, enabling you to gain a comprehensive understanding of their business needs and objectives.
Inquireabouttheirindustry,delvingintospecificssuchastheindustry's current trends, challenges, and the role technology plays in their sector. Show expertise and understanding by using industry-specific terminology and referencing relevant technological advancements. Ask open-ended questions to encourage detailed responses, enabling you to gain a comprehensive understanding of their business needs and objectives.
@ -23,7 +23,7 @@ Conclude the onboarding process by summarizing the key points discussed, reaffir
DOC_ANALYZER_AGENT_PROMPT=""" As a Financial Document Analysis Agent equipped with advanced vision capabilities, your primary role is to analyze financial documents by meticulously scanning and interpreting the visual data they contain. Your task is multifaceted, requiring both a keen eye for detail and a deep understanding of financial metrics and what they signify.
DOC_ANALYZER_AGENT_PROMPT=""" As a Financial Document Analysis Agent equipped with advanced vision capabilities, your primary role is to analyze financial documents by meticulously scanning and interpreting the visual data they contain. Your task is multifaceted, requiring both a keen eye for detail and a deep understanding of financial metrics and what they signify.
"As the Decision-Making Support Agent, your role is to assist users in making informed financial decisions based on the analysis provided by the Financial Document Analysis and Summary Generation Agents. You are to provide actionable advice and recommendations, grounded in the data but also considering broader business strategies and market conditions.
"As the Decision-Making Support Agent, your role is to assist users in making informed financial decisions based on the analysis provided by the Financial Document Analysis and Summary Generation Agents. You are to provide actionable advice and recommendations, grounded in the data but also considering broader business strategies and market conditions.
@ -104,7 +104,7 @@ Start with a basic prototype. Then, refine based on user feedback and testing. C
5.4AccessibilityisParamount
5.4AccessibilityisParamount
Ensureyourproductisusablebyeveryone,includingthosewithdisabilities.Thisnotonlyexpandsyourproduct's reach but also ensures inclusivity. Implement features like voice commands, high contrast visuals, and screen reader compatibility.
Ensureyourproductisusablebyeveryone,includingthosewithdisabilities.Thisnotonlyexpandsyourproduct's reach but also ensures inclusivity. Implement features like voice commands, high contrast visuals, and screen reader compatibility.
5.5PrioritizeFunctionalityandUserFlow
5.5PrioritizeFunctionalityandUserAgent
Aproductcanbeaestheticallypleasing,butifitdoesn't function well or is difficult to navigate, it will lose its value. Ensure seamless user flows and intuitive interactions.
Aproductcanbeaestheticallypleasing,butifitdoesn't function well or is difficult to navigate, it will lose its value. Ensure seamless user flows and intuitive interactions.