docs setups

pull/53/head
Kye 1 year ago
parent 99f60ac9be
commit bbd367378a

@ -0,0 +1,13 @@
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
mkdocs:
configuration: mkdocs.yml
python:
install:
- requirements: requirements.txt

@ -0,0 +1,42 @@
## **Applications of Swarms: Revolutionizing Customer Support**
---
**Introduction**:
In today's fast-paced digital world, responsive and efficient customer support is a linchpin for business success. The introduction of AI-driven swarms in the customer support domain can transform the way businesses interact with and assist their customers. By leveraging the combined power of multiple AI agents working in concert, businesses can achieve unprecedented levels of efficiency, customer satisfaction, and operational cost savings.
---
### **The Benefits of Using Swarms for Customer Support:**
1. **24/7 Availability**: Swarms never sleep. Customers receive instantaneous support at any hour, ensuring constant satisfaction and loyalty.
2. **Infinite Scalability**: Whether it's ten inquiries or ten thousand, swarms can handle fluctuating volumes with ease, eliminating the need for vast human teams and minimizing response times.
3. **Adaptive Intelligence**: Swarms learn collectively, meaning that a solution found for one customer can be instantly applied to benefit all. This leads to constantly improving support experiences, evolving with every interaction.
---
### **Features - Reinventing Customer Support**:
- **AI Inbox Monitor**: Continuously scans email inboxes, identifying and categorizing support requests for swift responses.
- **Intelligent Debugging**: Proactively helps customers by diagnosing and troubleshooting underlying issues.
- **Automated Refunds & Coupons**: Seamless integration with payment systems like Stripe allows for instant issuance of refunds or coupons if a problem remains unresolved.
- **Full System Integration**: Holistically connects with CRM, email systems, and payment portals, ensuring a cohesive and unified support experience.
- **Conversational Excellence**: With advanced LLMs (Language Model Transformers), the swarm agents can engage in natural, human-like conversations, enhancing customer comfort and trust.
- **Rule-based Operation**: By working with rule engines, swarms ensure that all actions adhere to company guidelines, ensuring consistent, error-free support.
- **Turing Test Ready**: Crafted to meet and exceed the Turing Test standards, ensuring that every customer interaction feels genuine and personal.
---
**Conclusion**:
Swarms are not just another technological advancement; they represent the future of customer support. Their ability to provide round-the-clock, scalable, and continuously improving support can redefine customer experience standards. By adopting swarms, businesses can stay ahead of the curve, ensuring unparalleled customer loyalty and satisfaction.
**Experience the future of customer support. Dive into the swarm revolution.**

@ -0,0 +1,64 @@
## **Swarms in Marketing Agencies: A New Era of Automated Media Strategy**
---
### **Introduction**:
- Brief background on marketing agencies and their role in driving brand narratives and sales.
- Current challenges and pain points faced in media planning, placements, and budgeting.
- Introduction to the transformative potential of swarms in reshaping the marketing industry.
---
### **1. Fundamental Problem: Media Plan Creation**:
- **Definition**: The challenge of creating an effective media plan that resonates with a target audience and aligns with brand objectives.
- **Traditional Solutions and Their Shortcomings**: Manual brainstorming sessions, over-reliance on past strategies, and long turnaround times leading to inefficiency.
- **How Swarms Address This Problem**:
- **Benefit 1**: Automated Media Plan Generation Swarms ingest branding summaries, objectives, and marketing strategies to generate media plans, eliminating guesswork and human error.
- **Real-world Application of Swarms**: The automation of media plans based on client briefs, including platform selections, audience targeting, and creative versions.
---
### **2. Fundamental Problem: Media Placements**:
- **Definition**: The tedious task of determining where ads will be placed, considering demographics, platform specifics, and more.
- **Traditional Solutions and Their Shortcomings**: Manual placement leading to possible misalignment with target audiences and brand objectives.
- **How Swarms Address This Problem**:
- **Benefit 2**: Precision Media Placements Swarms analyze audience data and demographics to suggest the best placements, optimizing for conversions and brand reach.
- **Real-world Application of Swarms**: Automated selection of ad placements across platforms like Facebook, Google, and DSPs based on media plans.
---
### **3. Fundamental Problem: Budgeting**:
- **Definition**: Efficiently allocating and managing advertising budgets across multiple campaigns, platforms, and timeframes.
- **Traditional Solutions and Their Shortcomings**: Manual budgeting using tools like Excel, prone to errors, and inefficient shifts in allocations.
- **How Swarms Address This Problem**:
- **Benefit 3**: Intelligent Media Budgeting Swarms enable dynamic budget allocation based on performance analytics, maximizing ROI.
- **Real-world Application of Swarms**: Real-time adjustments in budget allocations based on campaign performance, eliminating long waiting periods and manual recalculations.
---
### **Features**:
1. Automated Media Plan Generator: Input your objectives and receive a comprehensive media plan.
2. Precision Media Placement Tool: Ensure your ads appear in the right places to the right people.
3. Dynamic Budget Allocation: Maximize ROI with real-time budget adjustments.
4. Integration with Common Tools: Seamless integration with tools like Excel and APIs for exporting placements.
5. Conversational Platform: A suite of tools built for modern marketing agencies, bringing all tasks under one umbrella.
---
### **Testimonials**:
- "Swarms have completely revolutionized our media planning process. What used to take weeks now takes mere hours." - *Senior Media Strategist, Top-tier Marketing Agency*
- "The precision with which we can place ads now is unprecedented. It's like having a crystal ball for marketing!" - *Campaign Manager, Global Advertising Firm*
---
### **Conclusion**:
- Reiterate the immense potential of swarms in revolutionizing media planning, placements, and budgeting for marketing agencies.
- Call to action: For marketing agencies looking to step into the future and leave manual inefficiencies behind, swarms are the answer.
---

@ -0,0 +1,358 @@
# Architecture
## **1. Introduction**
In today's rapidly evolving digital world, harnessing the collaborative power of multiple computational agents is more crucial than ever. 'Swarms' represents a bold stride in this direction—a scalable and dynamic framework designed to enable swarms of agents to function in harmony and tackle complex tasks. This document serves as a comprehensive guide, elucidating the underlying architecture and strategies pivotal to realizing the Swarms vision.
---
## **2. The Vision**
At its heart, the Swarms framework seeks to emulate the collaborative efficiency witnessed in natural systems, like ant colonies or bird flocks. These entities, though individually simple, achieve remarkable outcomes through collaboration. Similarly, Swarms will unleash the collective potential of numerous agents, operating cohesively.
---
## **3. Architecture Overview**
### **3.1 Agent Level**
The base level that serves as the building block for all further complexity.
#### Mechanics:
* **Model**: At its core, each agent harnesses a powerful model like OpenAI's GPT.
* **Vectorstore**: A memory structure allowing agents to store and retrieve information.
* **Tools**: Utilities and functionalities that aid in the agent's task execution.
#### Interaction:
Agents interact with the external world through their model and tools. The Vectorstore aids in retaining knowledge and facilitating inter-agent communication.
### **3.2 Worker Infrastructure Level**
Building on the agent foundation, enhancing capability and readiness for swarm integration.
#### Mechanics:
* **Human Input Integration**: Enables agents to accept and understand human-provided instructions.
* **Unique Identifiers**: Assigns each agent a unique ID to facilitate tracking and communication.
* **Asynchronous Tools**: Bolsters agents' capability to multitask and interact in real-time.
#### Interaction:
Each worker is an enhanced agent, capable of operating independently or in sync with its peers, allowing for dynamic, scalable operations.
### **3.3 Swarm Level**
Multiple Worker Nodes orchestrated into a synchronized, collaborative entity.
#### Mechanics:
* **Orchestrator**: The maestro, responsible for directing the swarm, task allocation, and communication.
* **Scalable Communication Layer**: Facilitates interactions among nodes and between nodes and the orchestrator.
* **Task Assignment & Completion Protocols**: Structured procedures ensuring tasks are efficiently distributed and concluded.
#### Interaction:
Nodes collaborate under the orchestrator's guidance, ensuring tasks are partitioned appropriately, executed, and results consolidated.
### **3.4 Hivemind Level**
Envisioned as a 'Swarm of Swarms'. An upper echelon of collaboration.
#### Mechanics:
* **Hivemind Orchestrator**: Oversees multiple swarm orchestrators, ensuring harmony on a grand scale.
* **Inter-Swarm Communication Protocols**: Dictates how swarms interact, exchange information, and co-execute tasks.
#### Interaction:
Multiple swarms, each a formidable force, combine their prowess under the Hivemind. This level tackles monumental tasks by dividing them among swarms.
---
## **4. Building the Framework: A Task Checklist**
### **4.1 Foundations: Agent Level**
* Define and standardize agent properties.
* Integrate desired model (e.g., OpenAI's GPT) with agent.
* Implement Vectorstore mechanisms: storage, retrieval, and communication protocols.
* Incorporate essential tools and utilities.
* Conduct preliminary testing: Ensure agents can execute basic tasks and utilize the Vectorstore.
### **4.2 Enhancements: Worker Infrastructure Level**
* Interface agents with human input mechanisms.
* Assign and manage unique identifiers for each worker.
* Integrate asynchronous capabilities: Ensure real-time response and multitasking.
* Test worker nodes for both solitary and collaborative tasks.
### **4.3 Cohesion: Swarm Level**
* Design and develop the orchestrator: Ensure it can manage multiple worker nodes.
* Establish a scalable and efficient communication layer.
* Implement task distribution and retrieval protocols.
* Test swarms for efficiency, scalability, and robustness.
### **4.4 Apex Collaboration: Hivemind Level**
* Build the Hivemind Orchestrator: Ensure it can oversee multiple swarms.
* Define inter-swarm communication, prioritization, and task-sharing protocols.
* Develop mechanisms to balance loads and optimize resource utilization across swarms.
* Thoroughly test the Hivemind level for macro-task execution.
---
## **5. Integration and Communication Mechanisms**
### **5.1 Vectorstore as the Universal Communication Layer**
Serving as the memory and communication backbone, the Vectorstore must:
* Facilitate rapid storage and retrieval of high-dimensional vectors.
* Enable similarity-based lookups: Crucial for recognizing patterns or finding similar outputs.
* Scale seamlessly as agent count grows.
### **5.2 Orchestrator-Driven Communication**
* Orchestrators, both at the swarm and hivemind level, should employ adaptive algorithms to optimally distribute tasks.
* Ensure real-time monitoring of task execution and worker node health.
* Integrate feedback loops: Allow for dynamic task reassignment in case of node failures or inefficiencies.
---
## **6. Conclusion & Forward Path**
The Swarms framework, once realized, will usher in a new era of computational efficiency and collaboration. While the roadmap ahead is intricate, with diligent planning, development, and testing, Swarms will redefine the boundaries of collaborative computing.
--------
# Overview
### 1. Model
**Overview:**
The foundational level where a trained model (e.g., OpenAI GPT model) is initialized. It's the base on which further abstraction levels build upon. It provides the core capabilities to perform tasks, answer queries, etc.
**Diagram:**
```
[ Model (openai) ]
```
### 2. Agent Level
**Overview:**
At the agent level, the raw model is coupled with tools and a vector store, allowing it to be more than just a model. The agent can now remember, use tools, and become a more versatile entity ready for integration into larger systems.
**Diagram:**
```
+-----------+
| Agent |
| +-------+ |
| | Model | |
| +-------+ |
| +-----------+ |
| | VectorStore | |
| +-----------+ |
| +-------+ |
| | Tools | |
| +-------+ |
+-----------+
```
### 3. Worker Infrastructure Level
**Overview:**
The worker infrastructure is a step above individual agents. Here, an agent is paired with additional utilities like human input and other tools, making it a more advanced, responsive unit capable of complex tasks.
**Diagram:**
```
+----------------+
| WorkerNode |
| +-----------+ |
| | Agent | |
| | +-------+ | |
| | | Model | | |
| | +-------+ | |
| | +-------+ | |
| | | Tools | | |
| | +-------+ | |
| +-----------+ |
| |
| +-----------+ |
| |Human Input| |
| +-----------+ |
| |
| +-------+ |
| | Tools | |
| +-------+ |
+----------------+
```
### 4. Swarm Level
**Overview:**
At the swarm level, the orchestrator is central. It's responsible for assigning tasks to worker nodes, monitoring their completion, and handling the communication layer (for example, through a vector store or another universal communication mechanism) between worker nodes.
**Diagram:**
```
+------------+
|Orchestrator|
+------------+
|
+---------------------------+
| |
| Swarm-level Communication|
| Layer (e.g. |
| Vector Store) |
+---------------------------+
/ | \
+---------------+ +---------------+ +---------------+
|WorkerNode 1 | |WorkerNode 2 | |WorkerNode n |
| | | | | |
+---------------+ +---------------+ +---------------+
| Task Assigned | Task Completed | Communication |
```
### 5. Hivemind Level
**Overview:**
At the Hivemind level, it's a multi-swarm setup, with an upper-layer orchestrator managing multiple swarm-level orchestrators. The Hivemind orchestrator is responsible for broader tasks like assigning macro-tasks to swarms, handling inter-swarm communications, and ensuring the overall system is functioning smoothly.
**Diagram:**
```
+--------+
|Hivemind|
+--------+
|
+--------------+
|Hivemind |
|Orchestrator |
+--------------+
/ | \
+------------+ +------------+ +------------+
|Orchestrator| |Orchestrator| |Orchestrator|
+------------+ +------------+ +------------+
| | |
+--------------+ +--------------+ +--------------+
| Swarm-level| | Swarm-level| | Swarm-level|
|Communication| |Communication| |Communication|
| Layer | | Layer | | Layer |
+--------------+ +--------------+ +--------------+
/ \ / \ / \
+-------+ +-------+ +-------+ +-------+ +-------+
|Worker | |Worker | |Worker | |Worker | |Worker |
| Node | | Node | | Node | | Node | | Node |
+-------+ +-------+ +-------+ +-------+ +-------+
```
This setup allows the Hivemind level to operate at a grander scale, with the capability to manage hundreds or even thousands of worker nodes across multiple swarms efficiently.
-------
# **Swarms Framework Development Strategy Checklist**
## **Introduction**
The development of the Swarms framework requires a systematic and granular approach to ensure that each component is robust and that the overall framework is efficient and scalable. This checklist will serve as a guide to building Swarms from the ground up, breaking down tasks into small, manageable pieces.
---
## **1. Agent Level Development**
### **1.1 Model Integration**
- [ ] Research the most suitable models (e.g., OpenAI's GPT).
- [ ] Design an API for the agent to call the model.
- [ ] Implement error handling when model calls fail.
- [ ] Test the model with sample data for accuracy and speed.
### **1.2 Vectorstore Implementation**
- [ ] Design the schema for the vector storage system.
- [ ] Implement storage methods to add, delete, and update vectors.
- [ ] Develop retrieval methods with optimization for speed.
- [ ] Create protocols for vector-based communication between agents.
- [ ] Conduct stress tests to ascertain storage and retrieval speed.
### **1.3 Tools & Utilities Integration**
- [ ] List out essential tools required for agent functionality.
- [ ] Develop or integrate APIs for each tool.
- [ ] Implement error handling and logging for tool interactions.
- [ ] Validate tools integration with unit tests.
---
## **2. Worker Infrastructure Level Development**
### **2.1 Human Input Integration**
- [ ] Design a UI/UX for human interaction with worker nodes.
- [ ] Create APIs for input collection.
- [ ] Implement input validation and error handling.
- [ ] Test human input methods for clarity and ease of use.
### **2.2 Unique Identifier System**
- [ ] Research optimal formats for unique ID generation.
- [ ] Develop methods for generating and assigning IDs to agents.
- [ ] Implement a tracking system to manage and monitor agents via IDs.
- [ ] Validate the uniqueness and reliability of the ID system.
### **2.3 Asynchronous Operation Tools**
- [ ] Incorporate libraries/frameworks to enable asynchrony.
- [ ] Ensure tasks within an agent can run in parallel without conflict.
- [ ] Test asynchronous operations for efficiency improvements.
---
## **3. Swarm Level Development**
### **3.1 Orchestrator Design & Development**
- [ ] Draft a blueprint of orchestrator functionalities.
- [ ] Implement methods for task distribution among worker nodes.
- [ ] Develop communication protocols for the orchestrator to monitor workers.
- [ ] Create feedback systems to detect and address worker node failures.
- [ ] Test orchestrator with a mock swarm to ensure efficient task allocation.
### **3.2 Communication Layer Development**
- [ ] Select a suitable communication protocol/framework (e.g., gRPC, WebSockets).
- [ ] Design the architecture for scalable, low-latency communication.
- [ ] Implement methods for sending, receiving, and broadcasting messages.
- [ ] Test communication layer for reliability, speed, and error handling.
### **3.3 Task Management Protocols**
- [ ] Develop a system to queue, prioritize, and allocate tasks.
- [ ] Implement methods for real-time task status tracking.
- [ ] Create a feedback loop for completed tasks.
- [ ] Test task distribution, execution, and feedback systems for efficiency.
---
## **4. Hivemind Level Development**
### **4.1 Hivemind Orchestrator Development**
- [ ] Extend swarm orchestrator functionalities to manage multiple swarms.
- [ ] Create inter-swarm communication protocols.
- [ ] Implement load balancing mechanisms to distribute tasks across swarms.
- [ ] Validate hivemind orchestrator functionalities with multi-swarm setups.
### **4.2 Inter-Swarm Communication Protocols**
- [ ] Design methods for swarms to exchange data.
- [ ] Implement data reconciliation methods for swarms working on shared tasks.
- [ ] Test inter-swarm communication for efficiency and data integrity.
---
## **5. Scalability & Performance Testing**
- [ ] Simulate heavy loads to test the limits of the framework.
- [ ] Identify and address bottlenecks in both communication and computation.
- [ ] Conduct speed tests under different conditions.
- [ ] Test the system's responsiveness under various levels of stress.
---
## **6. Documentation & User Guide**
- [ ] Develop detailed documentation covering architecture, setup, and usage.
- [ ] Create user guides with step-by-step instructions.
- [ ] Incorporate visual aids, diagrams, and flowcharts for clarity.
- [ ] Update documentation regularly with new features and improvements.
---
## **7. Continuous Integration & Deployment**
- [ ] Setup CI/CD pipelines for automated testing and deployment.
- [ ] Ensure automatic rollback in case of deployment failures.
- [ ] Integrate code quality and security checks in the pipeline.
- [ ] Document deployment strategies and best practices.
---
## **Conclusion**
The Swarms framework represents a monumental leap in agent-based computation. This checklist provides a thorough roadmap for the framework's development, ensuring that every facet is addressed in depth. Through diligent adherence to this guide, the Swarms vision can be realized as a powerful, scalable, and robust system ready to tackle the challenges of tomorrow.
(Note: This document, given the word limit, provides a high-level overview. A full 5000-word document would delve into even more intricate details, nuances, potential pitfalls, and include considerations for security, user experience, compatibility, etc.)

@ -0,0 +1,7 @@
.md-typeset__table {
min-width: 100%;
}
.md-typeset table:not([class]) {
display: table;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 KiB

@ -0,0 +1,86 @@
# Bounty Program
Our bounty program is an exciting opportunity for contributors to help us build the future of Swarms. By participating, you can earn rewards while contributing to a project that aims to revolutionize digital activity.
Here's how it works:
1. **Check out our Roadmap**: We've shared our roadmap detailing our short and long-term goals. These are the areas where we're seeking contributions.
2. **Pick a Task**: Choose a task from the roadmap that aligns with your skills and interests. If you're unsure, you can reach out to our team for guidance.
3. **Get to Work**: Once you've chosen a task, start working on it. Remember, quality is key. We're looking for contributions that truly make a difference.
4. **Submit your Contribution**: Once your work is complete, submit it for review. We'll evaluate your contribution based on its quality, relevance, and the value it brings to Swarms.
5. **Earn Rewards**: If your contribution is approved, you'll earn a bounty. The amount of the bounty depends on the complexity of the task, the quality of your work, and the value it brings to Swarms.
## The Three Phases of Our Bounty Program
### Phase 1: Building the Foundation
In the first phase, our focus is on building the basic infrastructure of Swarms. This includes developing key components like the Swarms class, integrating essential tools, and establishing task completion and evaluation logic. We'll also start developing our testing and evaluation framework during this phase. If you're interested in foundational work and have a knack for building robust, scalable systems, this phase is for you.
### Phase 2: Enhancing the System
In the second phase, we'll focus on enhancing Swarms by integrating more advanced features, improving the system's efficiency, and refining our testing and evaluation framework. This phase involves more complex tasks, so if you enjoy tackling challenging problems and contributing to the development of innovative features, this is the phase for you.
### Phase 3: Towards Super-Intelligence
The third phase of our bounty program is the most exciting - this is where we aim to achieve super-intelligence. In this phase, we'll be working on improving the swarm's capabilities, expanding its skills, and fine-tuning the system based on real-world testing and feedback. If you're excited about the future of AI and want to contribute to a project that could potentially transform the digital world, this is the phase for you.
Remember, our roadmap is a guide, and we encourage you to bring your own ideas and creativity to the table. We believe that every contribution, no matter how small, can make a difference. So join us on this exciting journey and help us create the future of Swarms.
**To participate in our bounty program, visit the [Swarms Bounty Program Page](https://swarms.ai/bounty).** Let's build the future together!
## Bounties for Roadmap Items
To accelerate the development of Swarms and to encourage more contributors to join our journey towards automating every digital activity in existence, we are announcing a Bounty Program for specific roadmap items. Each bounty will be rewarded based on the complexity and importance of the task. Below are the items available for bounty:
1. **Multi-Agent Debate Integration**: $2000
2. **Meta Prompting Integration**: $1500
3. **Swarms Class**: $1500
4. **Integration of Additional Tools**: $1000
5. **Task Completion and Evaluation Logic**: $2000
6. **Ocean Integration**: $2500
7. **Improved Communication**: $2000
8. **Testing and Evaluation**: $1500
9. **Worker Swarm Class**: $2000
10. **Documentation**: $500
For each bounty task, there will be a strict evaluation process to ensure the quality of the contribution. This process includes a thorough review of the code and extensive testing to ensure it meets our standards.
# 3-Phase Testing Framework
To ensure the quality and efficiency of the Swarm, we will introduce a 3-phase testing framework which will also serve as our evaluation criteria for each of the bounty tasks.
## Phase 1: Unit Testing
In this phase, individual modules will be tested to ensure that they work correctly in isolation. Unit tests will be designed for all functions and methods, with an emphasis on edge cases.
## Phase 2: Integration Testing
After passing unit tests, we will test the integration of different modules to ensure they work correctly together. This phase will also test the interoperability of the Swarm with external systems and libraries.
## Phase 3: Benchmarking & Stress Testing
In the final phase, we will perform benchmarking and stress tests. We'll push the limits of the Swarm under extreme conditions to ensure it performs well in real-world scenarios. This phase will measure the performance, speed, and scalability of the Swarm under high load conditions.
By following this 3-phase testing framework, we aim to develop a reliable, high-performing, and scalable Swarm that can automate all digital activities.
# Reverse Engineering to Reach Phase 3
To reach the Phase 3 level, we need to reverse engineer the tasks we need to complete. Here's an example of what this might look like:
1. **Set Clear Expectations**: Define what success looks like for each task. Be clear about the outputs and outcomes we expect. This will guide our testing and development efforts.
2. **Develop Testing Scenarios**: Create a comprehensive list of testing scenarios that cover both common and edge cases. This will help us ensure that our Swarm can handle a wide range of situations.
3. **Write Test Cases**: For each scenario, write detailed test cases that outline the exact steps to be followed, the inputs to be used, and the expected outputs.
4. **Execute the Tests**: Run the test cases on our Swarm, making note of any issues or bugs that arise.
5. **Iterate and Improve**: Based on the results of our tests, iterate and improve our Swarm. This may involve fixing bugs, optimizing code, or redesigning parts of our system.
6. **Repeat**: Repeat this process until our Swarm meets our expectations and passes all test cases.
By following these steps, we will systematically build, test, and improve our Swarm until it reaches the Phase 3 level. This methodical approach will help us ensure that we create a reliable, high-performing, and scalable Swarm that can truly automate all digital activities.
Let's shape the future of digital automation together!

@ -0,0 +1,122 @@
# **Swarms Framework Development Strategy Checklist**
## **Introduction**
The development of the Swarms framework requires a systematic and granular approach to ensure that each component is robust and that the overall framework is efficient and scalable. This checklist will serve as a guide to building Swarms from the ground up, breaking down tasks into small, manageable pieces.
---
## **1. Agent Level Development**
### **1.1 Model Integration**
- [ ] Research the most suitable models (e.g., OpenAI's GPT).
- [ ] Design an API for the agent to call the model.
- [ ] Implement error handling when model calls fail.
- [ ] Test the model with sample data for accuracy and speed.
### **1.2 Vectorstore Implementation**
- [ ] Design the schema for the vector storage system.
- [ ] Implement storage methods to add, delete, and update vectors.
- [ ] Develop retrieval methods with optimization for speed.
- [ ] Create protocols for vector-based communication between agents.
- [ ] Conduct stress tests to ascertain storage and retrieval speed.
### **1.3 Tools & Utilities Integration**
- [ ] List out essential tools required for agent functionality.
- [ ] Develop or integrate APIs for each tool.
- [ ] Implement error handling and logging for tool interactions.
- [ ] Validate tools integration with unit tests.
---
## **2. Worker Infrastructure Level Development**
### **2.1 Human Input Integration**
- [ ] Design a UI/UX for human interaction with worker nodes.
- [ ] Create APIs for input collection.
- [ ] Implement input validation and error handling.
- [ ] Test human input methods for clarity and ease of use.
### **2.2 Unique Identifier System**
- [ ] Research optimal formats for unique ID generation.
- [ ] Develop methods for generating and assigning IDs to agents.
- [ ] Implement a tracking system to manage and monitor agents via IDs.
- [ ] Validate the uniqueness and reliability of the ID system.
### **2.3 Asynchronous Operation Tools**
- [ ] Incorporate libraries/frameworks to enable asynchrony.
- [ ] Ensure tasks within an agent can run in parallel without conflict.
- [ ] Test asynchronous operations for efficiency improvements.
---
## **3. Swarm Level Development**
### **3.1 Orchestrator Design & Development**
- [ ] Draft a blueprint of orchestrator functionalities.
- [ ] Implement methods for task distribution among worker nodes.
- [ ] Develop communication protocols for the orchestrator to monitor workers.
- [ ] Create feedback systems to detect and address worker node failures.
- [ ] Test orchestrator with a mock swarm to ensure efficient task allocation.
### **3.2 Communication Layer Development**
- [ ] Select a suitable communication protocol/framework (e.g., gRPC, WebSockets).
- [ ] Design the architecture for scalable, low-latency communication.
- [ ] Implement methods for sending, receiving, and broadcasting messages.
- [ ] Test communication layer for reliability, speed, and error handling.
### **3.3 Task Management Protocols**
- [ ] Develop a system to queue, prioritize, and allocate tasks.
- [ ] Implement methods for real-time task status tracking.
- [ ] Create a feedback loop for completed tasks.
- [ ] Test task distribution, execution, and feedback systems for efficiency.
---
## **4. Hivemind Level Development**
### **4.1 Hivemind Orchestrator Development**
- [ ] Extend swarm orchestrator functionalities to manage multiple swarms.
- [ ] Create inter-swarm communication protocols.
- [ ] Implement load balancing mechanisms to distribute tasks across swarms.
- [ ] Validate hivemind orchestrator functionalities with multi-swarm setups.
### **4.2 Inter-Swarm Communication Protocols**
- [ ] Design methods for swarms to exchange data.
- [ ] Implement data reconciliation methods for swarms working on shared tasks.
- [ ] Test inter-swarm communication for efficiency and data integrity.
---
## **5. Scalability & Performance Testing**
- [ ] Simulate heavy loads to test the limits of the framework.
- [ ] Identify and address bottlenecks in both communication and computation.
- [ ] Conduct speed tests under different conditions.
- [ ] Test the system's responsiveness under various levels of stress.
---
## **6. Documentation & User Guide**
- [ ] Develop detailed documentation covering architecture, setup, and usage.
- [ ] Create user guides with step-by-step instructions.
- [ ] Incorporate visual aids, diagrams, and flowcharts for clarity.
- [ ] Update documentation regularly with new features and improvements.
---
## **7. Continuous Integration & Deployment**
- [ ] Setup CI/CD pipelines for automated testing and deployment.
- [ ] Ensure automatic rollback in case of deployment failures.
- [ ] Integrate code quality and security checks in the pipeline.
- [ ] Document deployment strategies and best practices.
---
## **Conclusion**
The Swarms framework represents a monumental leap in agent-based computation. This checklist provides a thorough roadmap for the framework's development, ensuring that every facet is addressed in depth. Through diligent adherence to this guide, the Swarms vision can be realized as a powerful, scalable, and robust system ready to tackle the challenges of tomorrow.
(Note: This document, given the word limit, provides a high-level overview. A full 5000-word document would delve into even more intricate details, nuances, potential pitfalls, and include considerations for security, user experience, compatibility, etc.)

@ -0,0 +1,123 @@
# Contributing
Thank you for your interest in contributing to Swarms! We welcome contributions from the community to help improve usability and readability. By contributing, you can be a part of creating a dynamic and interactive AI system.
To get started, please follow the guidelines below.
## Optimization Priorities
To continuously improve Swarms, we prioritize the following design objectives:
1. **Usability**: Increase the ease of use and user-friendliness of the swarm system to facilitate adoption and interaction with basic input.
2. **Reliability**: Improve the swarm's ability to obtain the desired output even with basic and un-detailed input.
3. **Speed**: Reduce the time it takes for the swarm to accomplish tasks by improving the communication layer, critiquing, and self-alignment with meta prompting.
4. **Scalability**: Ensure that the system is asynchronous, concurrent, and self-healing to support scalability.
Our goal is to continuously improve Swarms by following this roadmap while also being adaptable to new needs and opportunities as they arise.
## Join the Swarms Community
Join the Swarms community on Discord to connect with other contributors, coordinate work, and receive support.
- [Join the Swarms Discord Server](https://discord.gg/qUtxnK2NMf)
## Report and Issue
The easiest way to contribute to our docs is through our public [issue tracker](https://github.com/kyegomez/swarms-docs/issues). Feel free to submit bugs, request features or changes, or contribute to the project directly.
## Pull Requests
Swarms docs are built using [MkDocs](https://squidfunk.github.io/mkdocs-material/getting-started/).
To directly contribute to Swarms documentation, first fork the [swarms-docs](https://github.com/kyegomez/swarms-docs) repository to your GitHub account. Then clone your repository to your local machine.
From inside the directory run:
```pip install -r requirements.txt```
To run `swarms-docs` locally run:
```mkdocs serve```
You should see something similar to the following:
```
INFO - Building documentation...
INFO - Cleaning site directory
INFO - Documentation built in 0.19 seconds
INFO - [09:28:33] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO - [09:28:33] Serving on http://127.0.0.1:8000/
INFO - [09:28:37] Browser connected: http://127.0.0.1:8000/
```
Follow the typical PR process to contribute changes.
* Create a feature branch.
* Commit changes.
* Submit a PR.
-------
---
## Taking on Tasks
We have a growing list of tasks and issues that you can contribute to. To get started, follow these steps:
1. Visit the [Swarms GitHub repository](https://github.com/kyegomez/swarms) and browse through the existing issues.
2. Find an issue that interests you and make a comment stating that you would like to work on it. Include a brief description of how you plan to solve the problem and any questions you may have.
3. Once a project coordinator assigns the issue to you, you can start working on it.
If you come across an issue that is unclear but still interests you, please post in the Discord server mentioned above. Someone from the community will be able to help clarify the issue in more detail.
We also welcome contributions to documentation, such as updating markdown files, adding docstrings, creating system architecture diagrams, and other related tasks.
## Submitting Your Work
To contribute your changes to Swarms, please follow these steps:
1. Fork the Swarms repository to your GitHub account. You can do this by clicking on the "Fork" button on the repository page.
2. Clone the forked repository to your local machine using the `git clone` command.
3. Before making any changes, make sure to sync your forked repository with the original repository to keep it up to date. You can do this by following the instructions [here](https://docs.github.com/en/github/collaborating-with-pull-requests/syncing-a-fork).
4. Create a new branch for your changes. This branch should have a descriptive name that reflects the task or issue you are working on.
5. Make your changes in the branch, focusing on a small, focused change that only affects a few files.
6. Run any necessary formatting or linting tools to ensure that your changes adhere to the project's coding standards.
7. Once your changes are ready, commit them to your branch with descriptive commit messages.
8. Push the branch to your forked repository.
9. Create a pull request (PR) from your branch to the main Swarms repository. Provide a clear and concise description of your changes in the PR.
10. Request a review from the project maintainers. They will review your changes, provide feedback, and suggest any necessary improvements.
11. Make any required updates or address any feedback provided during the review process.
12. Once your changes have been reviewed and approved, they will be merged into the main branch of the Swarms repository.
13. Congratulations! You have successfully contributed to Swarms.
Please note that during the review process, you may be asked to make changes or address certain issues. It is important to engage in open and constructive communication with the project maintainers to ensure the quality of your contributions.
## Developer Setup
If you are interested in setting up the Swarms development environment, please follow the instructions provided in the [developer setup guide](docs/developer-setup.md). This guide provides an overview of the different tools and technologies used in the project.
## Join the Agora Community
Swarms is brought to you by Agora, the open-source AI research organization. Join the Agora community to connect with other researchers and developers working on AI projects.
- [Join the Agora Discord Server](https://discord.gg/qUtxnK2NMf)
Thank you for your contributions and for being a part of the Swarms and Agora community! Together, we can advance Humanity through the power of AI.

@ -0,0 +1,9 @@
# Demo Ideas
* We could also try to create an AI influencer run by a swarm, let it create a whole identity and generate images, memes, and other content for Twitter, Reddit, etc.
* had a thought that we should have either a more general one of these or a swarm or both -- need something connecting all the calendars, events, and initiatives of all the AI communities, langchain, laion, eluther, lesswrong, gato, rob miles, chatgpt hackers, etc etc
* Swarm of AI influencers to spread marketing
* Delegation System to better organize teams: Start with a team of passionate humans and let them self-report their skills/strengths so the agent has a concept of who to delegate to, then feed the agent a huge task list (like the bullet list a few messages above) that it breaks down into actionable steps and "prompts" specific team members to complete tasks. Could even suggest breakout teams of a few people with complementary skills to tackle more complex tasks. There can also be a live board that updates each time a team member completes something, to encourage momentum and keep track of progress

@ -0,0 +1,152 @@
# Design Philosophy Document for Swarms
## Usable
### Objective
Our goal is to ensure that Swarms is intuitive and easy to use for all users, regardless of their level of technical expertise. This includes the developers who implement Swarms in their applications, as well as end users who interact with the implemented systems.
### Tactics
- Clear and Comprehensive Documentation: We will provide well-written and easily accessible documentation that guides users through using and understanding Swarms.
- User-Friendly APIs: We'll design clean and self-explanatory APIs that help developers to understand their purpose quickly.
- Prompt and Effective Support: We will ensure that support is readily available to assist users when they encounter problems or need help with Swarms.
## Reliable
### Objective
Swarms should be dependable and trustworthy. Users should be able to count on Swarms to perform consistently and without error or failure.
### Tactics
- Robust Error Handling: We will focus on error prevention, detection, and recovery to minimize failures in Swarms.
- Comprehensive Testing: We will apply various testing methodologies such as unit testing, integration testing, and stress testing to validate the reliability of our software.
- Continuous Integration/Continuous Delivery (CI/CD): We will use CI/CD pipelines to ensure that all changes are tested and validated before they're merged into the main branch.
## Fast
### Objective
Swarms should offer high performance and rapid response times. The system should be able to handle requests and tasks swiftly.
### Tactics
- Efficient Algorithms: We will focus on optimizing our algorithms and data structures to ensure they run as quickly as possible.
- Caching: Where appropriate, we will use caching techniques to speed up response times.
- Profiling and Performance Monitoring: We will regularly analyze the performance of Swarms to identify bottlenecks and opportunities for improvement.
## Scalable
### Objective
Swarms should be able to grow in capacity and complexity without compromising performance or reliability. It should be able to handle increased workloads gracefully.
### Tactics
- Modular Architecture: We will design Swarms using a modular architecture that allows for easy scaling and modification.
- Load Balancing: We will distribute tasks evenly across available resources to prevent overload and maximize throughput.
- Horizontal and Vertical Scaling: We will design Swarms to be capable of both horizontal (adding more machines) and vertical (adding more power to an existing machine) scaling.
### Philosophy
Swarms is designed with a philosophy of simplicity and reliability. We believe that software should be a tool that empowers users, not a hurdle that they need to overcome. Therefore, our focus is on usability, reliability, speed, and scalability. We want our users to find Swarms intuitive and dependable, fast and adaptable to their needs. This philosophy guides all of our design and development decisions.
# Swarm Architecture Design Document
## Overview
The goal of the Swarm Architecture is to provide a flexible and scalable system to build swarm intelligence models that can solve complex problems. This document details the proposed design to create a plug-and-play system, which makes it easy to create custom swarms, and provides pre-configured swarms with multi-modal agents.
## Design Principles
- **Modularity**: The system will be built in a modular fashion, allowing various components to be easily swapped or upgraded.
- **Interoperability**: Different swarm classes and components should be able to work together seamlessly.
- **Scalability**: The design should support the growth of the system by adding more components or swarms.
- **Ease of Use**: Users should be able to easily create their own swarms or use pre-configured ones with minimal configuration.
## Design Components
### AbstractSwarm
The AbstractSwarm is an abstract base class which defines the basic structure of a swarm and the methods that need to be implemented. Any new swarm should inherit from this class and implement the required methods.
### Swarm Classes
Various Swarm classes can be implemented inheriting from the AbstractSwarm class. Each swarm class should implement the required methods for initializing the components, worker nodes, and boss node, and running the swarm.
Pre-configured swarm classes with multi-modal agents can be provided for ease of use. These classes come with a default configuration of tools and agents, which can be used out of the box.
### Tools and Agents
Tools and agents are the components that provide the actual functionality to the swarms. They can be language models, AI assistants, vector stores, or any other components that can help in problem solving.
To make the system plug-and-play, a standard interface should be defined for these components. Any new tool or agent should implement this interface, so that it can be easily plugged into the system.
## Usage
Users can either use pre-configured swarms or create their own custom swarms.
To use a pre-configured swarm, they can simply instantiate the corresponding swarm class and call the run method with the required objective.
To create a custom swarm, they need to:
1. Define a new swarm class inheriting from AbstractSwarm.
2. Implement the required methods for the new swarm class.
3. Instantiate the swarm class and call the run method.
### Example
```python
# Using pre-configured swarm
swarm = PreConfiguredSwarm(openai_api_key)
swarm.run_swarms(objective)
# Creating custom swarm
class CustomSwarm(AbstractSwarm):
# Implement required methods
swarm = CustomSwarm(openai_api_key)
swarm.run_swarms(objective)
```
## Conclusion
This Swarm Architecture design provides a scalable and flexible system for building swarm intelligence models. The plug-and-play design allows users to easily use pre-configured swarms or create their own custom swarms.
# Swarming Architectures
Sure, below are five different swarm architectures with their base requirements and an abstract class that processes these components:
1. **Hierarchical Swarm**: This architecture is characterized by a boss/worker relationship. The boss node takes high-level decisions and delegates tasks to the worker nodes. The worker nodes perform tasks and report back to the boss node.
- Requirements: Boss node (can be a large language model), worker nodes (can be smaller language models), and a task queue for task management.
2. **Homogeneous Swarm**: In this architecture, all nodes in the swarm are identical and contribute equally to problem-solving. Each node has the same capabilities.
- Requirements: Homogeneous nodes (can be language models of the same size), communication protocol for nodes to share information.
3. **Heterogeneous Swarm**: This architecture contains different types of nodes, each with its specific capabilities. This diversity can lead to more robust problem-solving.
- Requirements: Different types of nodes (can be different types and sizes of language models), a communication protocol, and a mechanism to delegate tasks based on node capabilities.
4. **Competitive Swarm**: In this architecture, nodes compete with each other to find the best solution. The system may use a selection process to choose the best solutions.
- Requirements: Nodes (can be language models), a scoring mechanism to evaluate node performance, a selection mechanism.
5. **Cooperative Swarm**: In this architecture, nodes work together and share information to find solutions. The focus is on cooperation rather than competition.
- Requirements: Nodes (can be language models), a communication protocol, a consensus mechanism to agree on solutions.
6. **Grid-based Swarm**: This architecture positions agents on a grid, where they can only interact with their neighbors. This is useful for simulations, especially in fields like ecology or epidemiology.
- Requirements: Agents (can be language models), a grid structure, and a neighborhood definition (i.e., how to identify neighboring agents).
7. **Particle Swarm Optimization (PSO) Swarm**: In this architecture, each agent represents a potential solution to an optimization problem. Agents move in the solution space based on their own and their neighbors' past performance. PSO is especially useful for continuous numerical optimization problems.
- Requirements: Agents (each representing a solution), a definition of the solution space, an evaluation function to rate the solutions, a mechanism to adjust agent positions based on performance.
8. **Ant Colony Optimization (ACO) Swarm**: Inspired by ant behavior, this architecture has agents leave a pheromone trail that other agents follow, reinforcing the best paths. It's useful for problems like the traveling salesperson problem.
- Requirements: Agents (can be language models), a representation of the problem space, a pheromone updating mechanism.
9. **Genetic Algorithm (GA) Swarm**: In this architecture, agents represent potential solutions to a problem. They can 'breed' to create new solutions and can undergo 'mutations'. GA swarms are good for search and optimization problems.
- Requirements: Agents (each representing a potential solution), a fitness function to evaluate solutions, a crossover mechanism to breed solutions, and a mutation mechanism.
10. **Stigmergy-based Swarm**: In this architecture, agents communicate indirectly by modifying the environment, and other agents react to such modifications. It's a decentralized method of coordinating tasks.
- Requirements: Agents (can be language models), an environment that agents can modify, a mechanism for agents to perceive environment changes.
These architectures all have unique features and requirements, but they share the need for agents (often implemented as language models) and a mechanism for agents to communicate or interact, whether it's directly through messages, indirectly through the environment, or implicitly through a shared solution space. Some also require specific data structures, like a grid or problem space, and specific algorithms, like for evaluating solutions or updating agent positions.

@ -0,0 +1,469 @@
# Swarms Monetization Strategy
This strategy includes a variety of business models, potential revenue streams, cashflow structures, and customer identification methods. Let's explore these further.
## Business Models
1. **Platform as a Service (PaaS):** Provide the Swarms AI platform on a subscription basis, charged monthly or annually. This could be tiered based on usage and access to premium features.
2. **API Usage-based Pricing:** Charge customers based on their usage of the Swarms API. The more requests made, the higher the fee.
3. **Managed Services:** Offer complete end-to-end solutions where you manage the entire AI infrastructure for the clients. This could be on a contract basis with a recurring fee.
4. **Training and Certification:** Provide Swarms AI training and certification programs for interested developers and businesses. These could be monetized as separate courses or subscription-based access.
5. **Partnerships:** Collaborate with large enterprises and offer them dedicated Swarm AI services. These could be performance-based contracts, ensuring a mutually beneficial relationship.
6. **Data as a Service (DaaS):** Leverage the data generated by Swarms for insights and analytics, providing valuable business intelligence to clients.
## Potential Revenue Streams
1. **Subscription Fees:** This would be the main revenue stream from providing the Swarms platform as a service.
2. **Usage Fees:** Additional revenue can come from usage fees for businesses that have high demand for Swarms API.
3. **Contract Fees:** From offering managed services and bespoke solutions to businesses.
4. **Training Fees:** Revenue from providing training and certification programs to developers and businesses.
5. **Partnership Contracts:** Large-scale projects with enterprises, involving dedicated Swarm AI services, could provide substantial income.
6. **Data Insights:** Revenue from selling valuable business intelligence derived from Swarm's aggregated and anonymized data.
## Potential Customers
1. **Businesses Across Sectors:** Any business seeking to leverage AI for automation, efficiency, and data insights could be a potential customer. This includes sectors like finance, eCommerce, logistics, healthcare, and more.
2. **Developers:** Both freelance and those working in organizations could use Swarms to enhance their projects and services.
3. **Enterprises:** Large enterprises looking to automate and optimize their operations could greatly benefit from Swarms.
4. **Educational Institutions:** Universities and research institutions could leverage Swarms for research and teaching purposes.
## Roadmap
1. **Landing Page Creation:** Develop a dedicated product page on apac.ai for Swarms.
2. **Hosted Swarms API:** Launch a cloud-based Swarms API service. It should be highly reliable, with robust documentation to attract daily users.
3. **Consumer and Enterprise Subscription Service:** Launch a comprehensive subscription service on The Domain. This would provide users with access to a wide array of APIs and data streams.
4. **Dedicated Capacity Deals:** Partner with large enterprises to offer them dedicated Swarm AI solutions for automating their operations.
5. **Enterprise Partnerships:** Develop partnerships with large enterprises for extensive contract-based projects.
6. **Integration with Collaboration Platforms:** Develop Swarms bots for platforms like Discord and Slack, charging users a subscription fee for access.
7. **Personal Data Instances:** Offer users dedicated instances of all their data that the Swarm can query as needed.
8. **Browser Extension:** Develop a browser extension that integrates with the Swarms platform, offering users a more seamless experience.
Remember, customer satisfaction and a value-centric approach are at the core of any successful monetization strategy. It's essential to continuously iterate and improve the product based on customer feedback and evolving market needs.
----
# Other ideas
1. **Platform as a Service (PaaS):** Create a cloud-based platform that allows users to build, run, and manage applications without the complexity of maintaining the infrastructure. You could charge users a subscription fee for access to the platform and provide different pricing tiers based on usage levels. This could be an attractive solution for businesses that do not have the capacity to build or maintain their own swarm intelligence solutions.
2. **Professional Services:** Offer consultancy and implementation services to businesses looking to utilize the Swarm technology. This could include assisting with integration into existing systems, offering custom development services, or helping customers to build specific solutions using the framework.
3. **Education and Training:** Create a certification program for developers or companies looking to become proficient with the Swarms framework. This could be sold as standalone courses, or bundled with other services.
4. **Managed Services:** Some companies may prefer to outsource the management of their Swarm-based systems. A managed services solution could take care of all the technical aspects, from hosting the solution to ensuring it runs smoothly, allowing the customer to focus on their core business.
5. **Data Analysis and Insights:** Swarm intelligence can generate valuable data and insights. By anonymizing and aggregating this data, you could provide industry reports, trend analysis, and other valuable insights to businesses.
As for the type of platform, Swarms can be offered as a cloud-based solution given its scalability and flexibility. This would also allow you to apply a SaaS/PaaS type monetization model, which provides recurring revenue.
Potential customers could range from small to large enterprises in various sectors such as logistics, eCommerce, finance, and technology, who are interested in leveraging artificial intelligence and machine learning for complex problem solving, optimization, and decision-making.
**Product Brief Monetization Strategy:**
Product Name: Swarms.AI Platform
Product Description: A cloud-based AI and ML platform harnessing the power of swarm intelligence.
1. **Platform as a Service (PaaS):** Offer tiered subscription plans (Basic, Premium, Enterprise) to accommodate different usage levels and business sizes.
2. **Professional Services:** Offer consultancy and custom development services to tailor the Swarms solution to the specific needs of the business.
3. **Education and Training:** Launch an online Swarms.AI Academy with courses and certifications for developers and businesses.
4. **Managed Services:** Provide a premium, fully-managed service offering that includes hosting, maintenance, and 24/7 support.
5. **Data Analysis and Insights:** Offer industry reports and customized insights generated from aggregated and anonymized Swarm data.
Potential Customers: Enterprises in sectors such as logistics, eCommerce, finance, and technology. This can be sold globally, provided there's an internet connection.
Marketing Channels: Online marketing (SEO, Content Marketing, Social Media), Partnerships with tech companies, Direct Sales to Enterprises.
This strategy is designed to provide multiple revenue streams, while ensuring the Swarms.AI platform is accessible and useful to a range of potential customers.
1. **AI Solution as a Service:** By offering the Swarms framework as a service, businesses can access and utilize the power of multiple LLM agents without the need to maintain the infrastructure themselves. Subscription can be tiered based on usage and additional features.
2. **Integration and Custom Development:** Offer integration services to businesses wanting to incorporate the Swarms framework into their existing systems. Also, you could provide custom development for businesses with specific needs not met by the standard framework.
3. **Training and Certification:** Develop an educational platform offering courses, webinars, and certifications on using the Swarms framework. This can serve both developers seeking to broaden their skills and businesses aiming to train their in-house teams.
4. **Managed Swarms Solutions:** For businesses that prefer to outsource their AI needs, provide a complete solution which includes the development, maintenance, and continuous improvement of swarms-based applications.
5. **Data Analytics Services:** Leveraging the aggregated insights from the AI swarms, you could offer data analytics services. Businesses can use these insights to make informed decisions and predictions.
**Type of Platform:**
Cloud-based platform or Software as a Service (SaaS) will be a suitable model. It offers accessibility, scalability, and ease of updates.
**Target Customers:**
The technology can be beneficial for businesses across sectors like eCommerce, technology, logistics, finance, healthcare, and education, among others.
**Product Brief Monetization Strategy:**
Product Name: Swarms.AI
1. **AI Solution as a Service:** Offer different tiered subscriptions (Standard, Premium, and Enterprise) each with varying levels of usage and features.
2. **Integration and Custom Development:** Offer custom development and integration services, priced based on the scope and complexity of the project.
3. **Training and Certification:** Launch the Swarms.AI Academy with courses and certifications, available for a fee.
4. **Managed Swarms Solutions:** Offer fully managed solutions tailored to business needs, priced based on scope and service level agreements.
5. **Data Analytics Services:** Provide insightful reports and data analyses, which can be purchased on a one-off basis or through a subscription.
By offering a variety of services and payment models, Swarms.AI will be able to cater to a diverse range of business needs, from small start-ups to large enterprises. Marketing channels would include digital marketing, partnerships with technology companies, presence in tech events, and direct sales to targeted industries.
# Roadmap
* Create a landing page for swarms apac.ai/product/swarms
* Create Hosted Swarms API for anybody to just use without need for mega gpu infra, charge usage based pricing. Prerequisites for success => Swarms has to be extremely reliable + we need world class documentation and many daily users => how do we get many daily users? We provide a seamless and fluid experience, how do we create a seamless and fluid experience? We write good code that is modular, provides feedback to the user in times of distress, and ultimately accomplishes the user's tasks.
* Hosted consumer and enterprise subscription as a service on The Domain, where users can interact with 1000s of APIs and ingest 1000s of different data streams.
* Hosted dedicated capacity deals with mega enterprises on automating many operations with Swarms for monthly subscription 300,000+$
* Partnerships with enterprises, massive contracts with performance based fee
* Have discord bot and or slack bot with users personal data, charge subscription + browser extension
* each user gets a dedicated ocean instance of all their data so the swarm can query it as needed.
---
---
# Swarms Monetization Strategy: A Revolutionary AI-powered Future
Swarms is a powerful AI platform leveraging the transformative potential of Swarm Intelligence. Our ambition is to monetize this groundbreaking technology in ways that generate significant cashflow while providing extraordinary value to our customers.
Here we outline our strategic monetization pathways and provide a roadmap that plots our course to future success.
---
## I. Business Models
1. **Platform as a Service (PaaS):** We provide the Swarms platform as a service, billed on a monthly or annual basis. Subscriptions can range from $50 for basic access, to $500+ for premium features and extensive usage.
2. **API Usage-based Pricing:** Customers are billed according to their use of the Swarms API. Starting at $0.01 per request, this creates a cashflow model that rewards extensive platform usage.
3. **Managed Services:** We offer end-to-end solutions, managing clients' entire AI infrastructure. Contract fees start from $100,000 per month, offering both a sustainable cashflow and considerable savings for our clients.
4. **Training and Certification:** A Swarms AI training and certification program is available for developers and businesses. Course costs can range from $200 to $2,000, depending on course complexity and duration.
5. **Partnerships:** We forge collaborations with large enterprises, offering dedicated Swarm AI services. These performance-based contracts start from $1,000,000, creating a potentially lucrative cashflow stream.
6. **Data as a Service (DaaS):** Swarms generated data are mined for insights and analytics, with business intelligence reports offered from $500 each.
---
## II. Potential Revenue Streams
1. **Subscription Fees:** From $50 to $500+ per month for platform access.
2. **Usage Fees:** From $0.01 per API request, generating income from high platform usage.
3. **Contract Fees:** Starting from $100,000 per month for managed services.
4. **Training Fees:** From $200 to $2,000 for individual courses or subscription access.
5. **Partnership Contracts:** Contracts starting from $100,000, offering major income potential.
6. **Data Insights:** Business intelligence reports starting from $500.
---
## III. Potential Customers
1. **Businesses Across Sectors:** Our offerings cater to businesses across finance, eCommerce, logistics, healthcare, and more.
2. **Developers:** Both freelancers and organization-based developers can leverage Swarms for their projects.
3. **Enterprises:** Swarms offers large enterprises solutions for optimizing operations.
4. **Educational Institutions:** Universities and research institutions can use Swarms for research and teaching.
---
## IV. Roadmap
1. **Landing Page Creation:** Develop a dedicated Swarms product page on apac.ai.
2. **Hosted Swarms API:** Launch a reliable, well-documented cloud-based Swarms API service.
3. **Consumer and Enterprise Subscription Service:** Launch an extensive subscription service on The Domain, providing wide-ranging access to APIs and data streams.
4. **Dedicated Capacity Deals:** Offer large enterprises dedicated Swarm AI solutions, starting from $300,000 monthly subscription.
5. **Enterprise Partnerships:** Develop performance-based contracts with large enterprises.
6. **Integration with Collaboration Platforms:** Develop Swarms bots for platforms like Discord and Slack, charging a subscription fee for access.
7. **Personal Data Instances:** Offer users dedicated data instances that the Swarm can query as needed.
8. **Browser Extension:** Develop a browser extension that integrates with the Swarms platform for seamless user experience.
---
Our North Star remains customer satisfaction and value provision.
As we embark on this journey, we continuously refine our product based on customer feedback and evolving market needs, ensuring we lead in the age of AI-driven solutions.
## **Platform Distribution Strategy for Swarms**
*Note: This strategy aims to diversify the presence of 'Swarms' across various platforms and mediums while focusing on monetization and value creation for its users.
---
### **1. Framework:**
#### **Objective:**
To offer Swarms as an integrated solution within popular frameworks to ensure that developers and businesses can seamlessly incorporate its functionalities.
#### **Strategy:**
* **Language/Framework Integration:**
* Target popular frameworks like Django, Flask for Python, Express.js for Node, etc.
* Create SDKs or plugins for easy integration.
* **Monetization:**
* Freemium Model: Offer basic integration for free, and charge for additional features or advanced integrations.
* Licensing: Allow businesses to purchase licenses for enterprise-level integrations.
* **Promotion:**
* Engage in partnerships with popular online coding platforms like Udemy, Coursera, etc., offering courses and tutorials on integrating Swarms.
* Host webinars and write technical blogs to promote the integration benefits.
---
### **2. Paid API:**
#### **Objective:**
To provide a scalable solution for developers and businesses that want direct access to Swarms' functionalities without integrating the entire framework.
#### **Strategy:**
* **API Endpoints:**
* Offer various endpoints catering to different functionalities.
* Maintain robust documentation to ensure ease of use.
* **Monetization:**
* Usage-based Pricing: Charge based on the number of API calls.
* Subscription Tiers: Provide tiered packages based on usage limits and advanced features.
* **Promotion:**
* List on API marketplaces like RapidAPI.
* Engage in SEO to make the API documentation discoverable.
---
### **3. Domain Hosted:**
#### **Objective:**
To provide a centralized web platform where users can directly access and engage with Swarms' offerings.
#### **Strategy:**
* **User-Friendly Interface:**
* Ensure a seamless user experience with intuitive design.
* Incorporate features like real-time chat support, tutorials, and an FAQ section.
* **Monetization:**
* Subscription Model: Offer monthly/annual subscriptions for premium features.
* Affiliate Marketing: Partner with related tech products/services and earn through referrals.
* **Promotion:**
* Invest in PPC advertising on platforms like Google Ads.
* Engage in content marketing, targeting keywords related to Swarms' offerings.
---
### **4. Build Your Own (No-Code Platform):**
#### **Objective:**
To cater to the non-developer audience, allowing them to leverage Swarms' features without any coding expertise.
#### **Strategy:**
* **Drag-and-Drop Interface:**
* Offer customizable templates.
* Ensure integration with popular platforms and apps.
* **Monetization:**
* Freemium Model: Offer basic features for free, and charge for advanced functionalities.
* Marketplace for Plugins: Allow third-party developers to sell their plugins/extensions on the platform.
* **Promotion:**
* Partner with no-code communities and influencers.
* Offer promotions and discounts to early adopters.
---
### **5. Marketplace for the No-Code Platform:**
#### **Objective:**
To create an ecosystem where third-party developers can contribute, and users can enhance their Swarms experience.
#### **Strategy:**
* **Open API for Development:**
* Offer robust documentation and developer support.
* Ensure a strict quality check for marketplace additions.
* **Monetization:**
* Revenue Sharing: Take a percentage cut from third-party sales.
* Featured Listings: Charge developers for premium listings.
* **Promotion:**
* Host hackathons and competitions to boost developer engagement.
* Promote top plugins/extensions through email marketing and on the main platform.
---
### **Future Outlook & Expansion:**
* **Hosted Dedicated Capacity:** Hosted dedicated capacity deals for enterprises starting at 399,999$
* **Decentralized Free Peer to peer endpoint hosted on The Grid:** Hosted endpoint by the people for the people.
* **Browser Extenision:** Athena browser extension for deep browser automation, subscription, usage,
* **Mobile Application:** Develop a mobile app version for Swarms to tap into the vast mobile user base.
* **Global Expansion:** Localize the platform for non-English speaking regions to tap into global markets.
* **Continuous Learning:** Regularly collect user feedback and iterate on the product features.
---
### **50 Creative Distribution Platforms for Swarms**
1. **E-commerce Integrations:** Platforms like Shopify, WooCommerce, where Swarms can add value to sellers.
2. **Web Browser Extensions:** Chrome, Firefox, and Edge extensions that bring Swarms features directly to users.
3. **Podcasting Platforms:** Swarms-themed content on platforms like Spotify, Apple Podcasts to reach aural learners.
4. **Virtual Reality (VR) Platforms:** Integration with VR experiences on Oculus or Viveport.
5. **Gaming Platforms:** Tools or plugins for game developers on Steam, Epic Games.
6. **Decentralized Platforms:** Using blockchain, create decentralized apps (DApps) versions of Swarms.
7. **Chat Applications:** Integrate with popular messaging platforms like WhatsApp, Telegram, Slack.
8. **AI Assistants:** Integration with Siri, Alexa, Google Assistant to provide Swarms functionalities via voice commands.
9. **Freelancing Websites:** Offer tools or services for freelancers on platforms like Upwork, Fiverr.
10. **Online Forums:** Platforms like Reddit, Quora, where users can discuss or access Swarms.
11. **Educational Platforms:** Sites like Khan Academy, Udacity where Swarms can enhance learning experiences.
12. **Digital Art Platforms:** Integrate with platforms like DeviantArt, Behance.
13. **Open-source Repositories:** Hosting Swarms on GitHub, GitLab, Bitbucket with open-source plugins.
14. **Augmented Reality (AR) Apps:** Create AR experiences powered by Swarms.
15. **Smart Home Devices:** Integrate Swarms' functionalities into smart home devices.
16. **Newsletters:** Platforms like Substack, where Swarms insights can be shared.
17. **Interactive Kiosks:** In malls, airports, and other public places.
18. **IoT Devices:** Incorporate Swarms in devices like smart fridges, smartwatches.
19. **Collaboration Tools:** Platforms like Trello, Notion, offering Swarms-enhanced productivity.
20. **Dating Apps:** An AI-enhanced matching algorithm powered by Swarms.
21. **Music Platforms:** Integrate with Spotify, SoundCloud for music-related AI functionalities.
22. **Recipe Websites:** Platforms like AllRecipes, Tasty with AI-recommended recipes.
23. **Travel & Hospitality:** Integrate with platforms like Airbnb, Tripadvisor for AI-based recommendations.
24. **Language Learning Apps:** Duolingo, Rosetta Stone integrations.
25. **Virtual Events Platforms:** Websites like Hopin, Zoom where Swarms can enhance the virtual event experience.
26. **Social Media Management:** Tools like Buffer, Hootsuite with AI insights by Swarms.
27. **Fitness Apps:** Platforms like MyFitnessPal, Strava with AI fitness insights.
28. **Mental Health Apps:** Integration into apps like Calm, Headspace for AI-driven wellness.
29. **E-books Platforms:** Amazon Kindle, Audible with AI-enhanced reading experiences.
30. **Sports Analysis Tools:** Websites like ESPN, Sky Sports where Swarms can provide insights.
31. **Financial Tools:** Integration into platforms like Mint, Robinhood for AI-driven financial advice.
32. **Public Libraries:** Digital platforms of public libraries for enhanced reading experiences.
33. **3D Printing Platforms:** Websites like Thingiverse, Shapeways with AI customization.
34. **Meme Platforms:** Websites like Memedroid, 9GAG where Swarms can suggest memes.
35. **Astronomy Apps:** Platforms like Star Walk, NASA's Eyes with AI-driven space insights.
36. **Weather Apps:** Integration into Weather.com, AccuWeather for predictive analysis.
37. **Sustainability Platforms:** Websites like Ecosia, GoodGuide with AI-driven eco-tips.
38. **Fashion Apps:** Platforms like ASOS, Zara with AI-based style recommendations.
39. **Pet Care Apps:** Integration into PetSmart, Chewy for AI-driven pet care tips.
40. **Real Estate Platforms:** Websites like Zillow, Realtor with AI-enhanced property insights.
41. **DIY Platforms:** Websites like Instructables, DIY.org with AI project suggestions.
42. **Genealogy Platforms:** Ancestry, MyHeritage with AI-driven family tree insights.
43. **Car Rental & Sale Platforms:** Integration into AutoTrader, Turo for AI-driven vehicle suggestions.
44. **Wedding Planning Websites:** Platforms like Zola, The Knot with AI-driven planning.
45. **Craft Platforms:** Websites like Etsy, Craftsy with AI-driven craft suggestions.
46. **Gift Recommendation Platforms:** AI-driven gift suggestions for websites like Gifts.com.
47. **Study & Revision Platforms:** Websites like Chegg, Quizlet with AI-driven study guides.
48. **Local Business Directories:** Yelp, Yellow Pages with AI-enhanced reviews.
49. **Networking Platforms:** LinkedIn, Meetup with AI-driven connection suggestions.
50. **Lifestyle Magazines' Digital Platforms:** Websites like Vogue, GQ with AI-curated fashion and lifestyle insights.
---
*Endnote: Leveraging these diverse platforms ensures that Swarms becomes an integral part of multiple ecosystems, enhancing its visibility and user engagement.*

@ -0,0 +1,29 @@
To count tokens you can use Swarms events and the `TokenCounter` util:
```python
from swarms import utils
from swarms.events import (
StartPromptEvent, FinishPromptEvent,
)
from swarms.structures import Agent
token_counter = utils.TokenCounter()
agent = Agent(
event_listeners={
StartPromptEvent: [
lambda e: token_counter.add_tokens(e.token_count)
],
FinishPromptEvent: [
lambda e: token_counter.add_tokens(e.token_count)
],
}
)
agent.run("tell me about large language models")
agent.run("tell me about GPT")
print(f"total tokens: {token_counter.tokens}")
```

@ -0,0 +1,3 @@
This section of the documentation is dedicated to examples highlighting Swarms functionality.
We try to keep all examples up to date, but if you think there is a bug please [submit a pull request](https://github.com/kyegomez/swarms-docs/tree/main/docs/examples). We are also more than happy to include new examples :)

@ -0,0 +1,49 @@
```python
import hashlib
import json
from urllib.request import urlopen
from decouple import config
from swarms.drivers import PineconeVectorStoreDriver
def load_data(driver: PineconeVectorStoreDriver) -> None:
response = urlopen(
"https://raw.githubusercontent.com/wedeploy-examples/"
"supermarket-web-example/master/products.json"
)
for product in json.loads(response.read()):
driver.upsert_text(
product["description"],
vector_id=hashlib.md5(product["title"].encode()).hexdigest(),
meta={
"title": product["title"],
"description": product["description"],
"type": product["type"],
"price": product["price"],
"rating": product["rating"]
},
namespace="supermarket-products"
)
vector_driver = PineconeVectorStoreDriver(
api_key=config("PINECONE_API_KEY"),
environment=config("PINECONE_ENVIRONMENT"),
index_name=config("PINECONE_INDEX_NAME")
)
load_data(vector_driver)
result = vector_driver.query(
"fruit",
count=3,
filter={
"price": {"$lte": 15},
"rating": {"$gte": 4}
},
namespace="supermarket-products"
)
print(result)
```

@ -0,0 +1,51 @@
```python
from swarms import utils
from swarms.drivers import MarqoVectorStoreDriver
from swarms.engines import VectorQueryEngine
from swarms.loaders import WebLoader
from swarms.structures import Agent
from swarms.tools import KnowledgeBaseClient
import openai
from marqo import Client
# Set the OpenAI API key
openai.api_key_path = "../openai_api_key.txt"
# Define the namespace
namespace = "kyegomez"
# Initialize the vector store driver
vector_store = MarqoVectorStoreDriver(
api_key=openai.api_key_path,
url="http://localhost:8882",
index="chat2",
mq=Client(api_key="foobar", url="http://localhost:8882")
)
# Get a list of all indexes
#indexes = vector_store.get_indexes()
#print(indexes)
# Initialize the query engine
query_engine = VectorQueryEngine(vector_store_driver=vector_store)
# Initialize the knowledge base tool
kb_tool = KnowledgeBaseClient(
description="Contains information about the Swarms Framework from www.swarms.ai",
query_engine=query_engine,
namespace=namespace
)
# Load artifacts from the web
artifacts = WebLoader(max_tokens=200).load("https://www.swarms.ai")
# Upsert the artifacts into the vector store
vector_store.upsert_text_artifacts({namespace: artifacts,})
# Initialize the agent
agent = Agent(tools=[kb_tool])
# Start the chat
utils.Chat(agent).start()
```

@ -0,0 +1,23 @@
```python
from swarms.artifacts import BaseArtifact
from swarms.drivers import LocalVectorStoreDriver
from swarms.loaders import WebLoader
vector_store = LocalVectorStoreDriver()
[
vector_store.upsert_text_artifact(a, namespace="swarms")
for a in WebLoader(max_tokens=100).load("https://www.swarms.ai")
]
results = vector_store.query(
"creativity",
count=3,
namespace="swarms"
)
values = [BaseArtifact.from_json(r.meta["artifact"]).value for r in results]
print("\n\n".join(values))
```

@ -0,0 +1,47 @@
To store your conversation on DynamoDB you can use DynamoDbConversationMemoryDriver.
```python
from swarms.memory.structure import ConversationMemory
from swarms.memory.structure import ConversationMemoryElement, Turn, Message
from swarms.drivers import DynamoDbConversationMemoryDriver
# Instantiate DynamoDbConversationMemoryDriver
dynamo_driver = DynamoDbConversationMemoryDriver(
aws_region="us-east-1",
table_name="conversations",
partition_key="convo_id",
value_attribute_key="convo_data",
partition_key_value="convo1"
)
# Create a ConversationMemory structure
conv_mem = ConversationMemory(
turns=[
Turn(
turn_index=0,
system=Message("Hello"),
user=Message("Hi")
),
Turn(
turn_index=1,
system=Message("How can I assist you today?"),
user=Message("I need some information")
)
],
latest_turn=Turn(
turn_index=2,
system=Message("Sure, what information do you need?"),
user=None # user has not yet responded
),
driver=dynamo_driver # set the driver
)
# Store the conversation in DynamoDB
dynamo_driver.store(conv_mem)
# Load the conversation from DynamoDB
loaded_conv_mem = dynamo_driver.load()
# Display the loaded conversation
print(loaded_conv_mem.to_json())
```

@ -0,0 +1,37 @@
This example demonstrates how to vectorize a PDF of the [Attention Is All You Need](https://arxiv.org/pdf/1706.03762.pdf) paper and setup a Swarms agent with rules and the `KnowledgeBase` tool to use it during conversations.
```python
import io
import requests
from swarms.engines import VectorQueryEngine
from swarms.loaders import PdfLoader
from swarms.structures import Agent
from swarms.tools import KnowledgeBaseClient
from swarms.utils import Chat
namespace = "attention"
response = requests.get("https://arxiv.org/pdf/1706.03762.pdf")
engine = VectorQueryEngine()
engine.vector_store_driver.upsert_text_artifacts(
{
namespace: PdfLoader().load(
io.BytesIO(response.content)
)
}
)
kb_client = KnowledgeBaseClient(
description="Contains information about the Attention Is All You Need paper. "
"Use it to answer any related questions.",
query_engine=engine,
namespace=namespace
)
agent = Agent(
tools=[kb_client]
)
Chat(agent).start()
```

@ -0,0 +1,50 @@
This example demonstrates how to vectorize a webpage and setup a Swarms agent with rules and the `KnowledgeBase` tool to use it during conversations.
```python
from swarms.engines import VectorQueryEngine
from swarms.loaders import WebLoader
from swarms.rules import Ruleset, Rule
from swarms.structures import Agent
from swarms.tools import KnowledgeBaseClient
from swarms.utils import Chat
namespace = "physics-wiki"
engine = VectorQueryEngine()
artifacts = WebLoader().load(
"https://en.wikipedia.org/wiki/Physics"
)
engine.vector_store_driver.upsert_text_artifacts(
{namespace: artifacts}
)
kb_client = KnowledgeBaseClient(
description="Contains information about physics. "
"Use it to answer any physics-related questions.",
query_engine=engine,
namespace=namespace
)
agent = Agent(
rulesets=[
Ruleset(
name="Physics Tutor",
rules=[
Rule(
"Always introduce yourself as a physics tutor"
),
Rule(
"Be truthful. Only discuss physics."
)
]
)
],
tools=[kb_client]
)
Chat(agent).start()
```

@ -0,0 +1,46 @@
This example demonstrates how to build an agent that can dynamically query Amazon Redshift Serverless tables and store its contents on the local hard drive.
Let's build a support agent that uses GPT-4:
```python
import boto3
from swarms.drivers import AmazonRedshiftSqlDriver, OpenAiPromptDriver
from swarms.loaders import SqlLoader
from swarms.rules import Ruleset, Rule
from swarms.structures import Agent
from swarms.tools import SqlClient, FileManager
from swarms.utils import Chat
session = boto3.Session(region_name="REGION_NAME")
sql_loader = SqlLoader(
sql_driver=AmazonRedshiftSqlDriver(
database="DATABASE",
session=session,
workgroup_name="WORKGROUP_NAME"
)
)
sql_tool = SqlClient(
sql_loader=sql_loader,
table_name="people",
table_description="contains information about tech industry professionals",
engine_name="redshift"
)
agent = Agent(
tools=[sql_tool, FileManager())],
rulesets=[
Ruleset(
name="HumansOrg Agent",
rules=[
Rule("Act and introduce yourself as a HumansOrg, Inc. support agent"),
Rule("Your main objective is to help with finding information about people"),
Rule("Only use information about people from the sources available to you")
]
)
]
)
Chat(agent).start()
```

@ -0,0 +1,97 @@
This example demonstrates how to build an agent that can integrate with [Text Generation Web UI](https://github.com/oobabooga/text-generation-webui).
To be able to perform successful connection, run text gen with '--api' and if you running text gen not on the same host, add '--listen'. see more option [here](https://github.com/oobabooga/text-generation-webui)
Check out the bare API usage [example](https://github.com/oobabooga/text-generation-webui/blob/main/api-examples/api-example.py).
## Tokenizer
To match the tokenizer used in the text gen, one can use [PreTrainedTokenizerFast](https://huggingface.co/docs/transformers/fast_tokenizers#loading-from-a-json-file) to load tokenizer from saved json setting file.
Example:
Let's say you using [TheBloke/WizardLM-13B-V1-1-SuperHOT-8K-GPTQ](https://huggingface.co/TheBloke/WizardLM-13B-V1-1-SuperHOT-8K-GPTQ/tree/main) in text gen, you can get hold of 'tokenizer.json' file that can be used to setup a corresponding tokenizer.
## Code Snippets
Code snippet using a pre defined 'preset'.
'max_tokens' argument here need to be set with the same value as in the preset in text gen.
```shell
from swarms.structures import Agent
from swarms.drivers import TextGenPromptDriver
from swarms.tokenizers import TextGenTokenizer
from transformers import PreTrainedTokenizerFast
fast_tokenizer = PreTrainedTokenizerFast(tokenizer_file="tokenizer.json")
prompt_driver = TextGenPromptDriver(
preset="swarms",
tokenizer=TextGenTokenizer(max_tokens=300, tokenizer=fast_tokenizer)
)
agent = Agent(
prompt_driver=prompt_driver
)
agent.run(
"tell me what Swarms is"
)
```
Code snippet example using params, if params and preset is defined, preset will be used.
this params are overriding the current preset set in text gen, not all of them must be used.
```shell
from swarms.structures import Agent
from swarms.drivers import TextGenPromptDriver
from swarms.tokenizers import TextGenTokenizer
from transformers import PreTrainedTokenizerFast
params = {
'max_new_tokens': 250,
'do_sample': True,
'temperature': 0.7,
'top_p': 0.1,
'typical_p': 1,
'epsilon_cutoff': 0, # In units of 1e-4
'eta_cutoff': 0, # In units of 1e-4
'tfs': 1,
'top_a': 0,
'repetition_penalty': 1.18,
'repetition_penalty_range': 0,
'top_k': 40,
'min_length': 0,
'no_repeat_ngram_size': 0,
'num_beams': 1,
'penalty_alpha': 0,
'length_penalty': 1,
'early_stopping': False,
'mirostat_mode': 0,
'mirostat_tau': 5,
'mirostat_eta': 0.1,
'seed': 235245345,
'add_bos_token': True,
'truncation_length': 2048,
'ban_eos_token': False,
'skip_special_tokens': True,
'stopping_strings': []
}
fast_tokenizer = PreTrainedTokenizerFast(tokenizer_file="tokenizer.json")
prompt_driver = TextGenPromptDriver(
params=params,
tokenizer=TextGenTokenizer(max_tokens=params['max_new_tokens'], tokenizer=fast_tokenizer)
)
agent = Agent(
prompt_driver=prompt_driver
)
agent.run(
"tell me what Swarms is"
)
```

@ -0,0 +1,104 @@
# Failure Root Cause Analysis for Langchain
## 1. Introduction
Langchain is an open-source software that has gained massive popularity in the artificial intelligence ecosystem, serving as a tool for connecting different language models, especially GPT based models. However, despite its popularity and substantial investment, Langchain has shown several weaknesses that hinder its use in various projects, especially in complex and large-scale implementations. This document provides an analysis of the identified issues and proposes potential mitigation strategies.
## 2. Analysis of Weaknesses
### 2.1 Tool Lock-in
Langchain tends to enforce tool lock-in, which could prove detrimental for developers. Its design heavily relies on specific workflows and architectures, which greatly limits flexibility. Developers may find themselves restricted to certain methodologies, impeding their freedom to implement custom solutions or integrate alternative tools.
#### Mitigation
An ideal AI framework should not be restrictive but should instead offer flexibility for users to integrate any agent on any architecture. Adopting an open architecture that allows for seamless interaction between various agents and workflows can address this issue.
### 2.2 Outdated Workflows
Langchain's current workflows and prompt engineering, mainly based on InstructGPT, are out of date, especially compared to newer models like ChatGPT/GPT-4.
#### Mitigation
Keeping up with the latest AI models and workflows is crucial. The framework should have a mechanism for regular updates and seamless integration of up-to-date models and workflows.
### 2.3 Debugging Difficulties
Debugging in Langchain is reportedly very challenging, even with verbose output enabled, making it hard to determine what is happening under the hood.
#### Mitigation
The introduction of a robust debugging and logging system would help users understand the internals of the models, thus enabling them to pinpoint and rectify issues more effectively.
### 2.4 Limited Customization
Langchain makes it extremely hard to deviate from documented workflows. This becomes a challenge when developers need custom workflows for their specific use-cases.
#### Mitigation
An ideal framework should support custom workflows and allow developers to hack and adjust the framework according to their needs.
### 2.5 Documentation
Langchain's documentation is reportedly missing relevant details, making it difficult for users to understand the differences between various agent types, among other things.
#### Mitigation
Providing detailed and comprehensive documentation, including examples, FAQs, and best practices, is crucial. This will help users understand the intricacies of the framework, making it easier for them to implement it in their projects.
### 2.6 Negative Influence on AI Ecosystem
The extreme popularity of Langchain seems to be warping the AI ecosystem to the point of causing harm, with other AI entities shifting their operations to align with Langchain's 'magic AI' approach.
#### Mitigation
It's essential for any widely adopted framework to promote healthy practices in the broader ecosystem. One approach could be promoting open dialogue, inviting criticism, and being open to change based on feedback.
## 3. Conclusion
While Langchain has made significant contributions to the AI landscape, these challenges hinder its potential. Addressing these issues will not only improve Langchain but also foster a healthier AI ecosystem. It's important to note that criticism, when approached constructively, can be a powerful tool for growth and innovation.
# List of weaknesses in gLangchain and Potential Mitigations
1. **Tool Lock-in**: Langchain encourages the use of specific tools, creating a lock-in problem with minimal benefits for developers.
*Mitigation Strategy*: Langchain should consider designing the architecture to be more versatile and allow for the inclusion of a variety of tools. An open architecture will provide developers with more freedom and customization options.
2. **Outdated Workflow**: The current workflow and prompt engineering of Langchain rely on outdated models like InstructGPT, which fall short compared to newer alternatives such as ChatGPT/GPT-4.
*Mitigation Strategy*: Regular updates and adaptation of more recent models should be integrated into the Langchain framework.
3. **Debugging Difficulty**: Debugging a Langchain error is a complicated task, even with verbose=True, leading to a discouraging developer experience.
*Mitigation Strategy*: Develop a comprehensive debugging tool or improve current debugging processes for clearer and more accessible error detection and resolution.
4. **Lack of Customizability**: Customizing workflows that are not documented in Langchain is quite challenging.
*Mitigation Strategy*: Improve documentation and provide guides on how to customize workflows to enhance developer flexibility.
5. **Poor Documentation**: Langchain's documentation misses key details that developers have to manually search for in the codebase.
*Mitigation Strategy*: Enhance and improve the documentation of Langchain to provide clarity for developers and make navigation easier.
6. **Harmful Ecosystem Influence**: Langchain's extreme popularity is influencing the AI ecosystem towards the workflows, potentially harming development and code clarity.
*Mitigation Strategy*: Encourage diverse and balanced adoption of AI tools in the ecosystem.
7. **Suboptimal Performances**: Langchain's performance is sometimes underwhelming, and there are no clear benefits in terms of performance or abstraction.
*Mitigation Strategy*: Enhance the performance optimization of Langchain. Benchmarking against other tools can also provide performance improvement insights.
8. **Rigid General Interface**: Langchain tries to do too many things, resulting in a rigid interface not suitable for practical use, especially in production.
*Mitigation Strategy*: Focus on core features and allow greater flexibility in the interface. Adopting a modular approach where developers can pick and choose the features they want could also be helpful.
9. **Leaky Abstraction Problem**: Langchains full-on framework approach has created a leaky abstraction problem leading to a disappointing developer experience.
*Mitigation Strategy*: Adopt a more balanced approach between a library and a framework. Provide a solid core feature set with the possibility to extend it according to the developers' needs.
10. **Excessive Focus on Third-party Services**: Langchain overly focuses on supporting every single third-party service at the expense of customizability and fine-tuning for actual applications.
*Mitigation Strategy*: Prioritize fine-tuning and customizability for developers, limiting the focus on third-party services unless they provide substantial value.
Remember, any mitigation strategy will need to be tailored to Langchain's particular circumstances and developer feedback. It's also important to consider potential trade-offs and unintended consequences when implementing these strategies.

@ -0,0 +1,7 @@
This page summarizes questions we were asked on [Discord](https://discord.gg/gnWRz88eym), Hacker News, and Reddit. Feel free to post a question to [Discord](https://discord.gg/gnWRz88eym) or open a discussion on our [Github Page](https://github.com/kyegomez) or hit us up directly: [kye@apac.ai](mailto:hello@swarms.ai).
## 1. How is Swarms different from LangChain?
Swarms is an open source alternative to LangChain and differs in its approach to creating LLM pipelines and DAGs. In addition to agents, it uses more general-purpose DAGs and pipelines. A close proxy might be *Airflow for LLMs*. Swarms still implements chain of thought logic for prompt tasks that use "tools" but it also supports any type of input / output (images, audio, etc.).

@ -0,0 +1,61 @@
## **Join the Swarm Revolution: Advancing Humanity & Prosperity Together!**
### **The Next Chapter of Humanity's Story Begins Here...**
At Swarms, our mission transcends mere technological advancement. We envision a world where every individual can leverage the power of AI to uplift their lives, communities, and our shared future. If you are driven by the passion to revolutionize industries, to scale the heights of innovation, and believe in earning your fair share for every ounce of your dedication you might be the one we're looking for.
---
### **Why Swarms?**
#### **For the Ambitious Spirit**:
- **Opportunity Beyond Boundaries**: Just as Fuller believed in the infinite opportunities of America, we believe in the limitless potential of raw Humantiy.
#### **For the Maverick**:
- **Unprecedented Independence**: Like the Fuller salesmen, our team members have the autonomy to sculpt their roles, timelines, and outcomes. Here, youre the captain of your ship.
#### **For the Avid Learner**:
- **Continuous Learning & Growth**: Dive deep into the realms of AI, distributed systems, and customer success methodologies. We offer training, mentorship, and a platform to sharpen your skills.
#### **For the High Achiever**:
- **Rewarding Compensation**: While the sky is the limit for your innovations, so is your earning potential. Prosper with performance-based rewards that reflect your dedication.
#### **For the Community Builder**:
- **Culture of Unity & Innovation**: At Swarms, youre not just an employee; youre a pivotal part of our mission. Experience camaraderie, collaboration, and a shared purpose that binds us together.
#### **For the Visionary**:
- **Work on the Cutting-Edge**: Be at the forefront of AI and technology. Shape solutions that will define the next era of human history.
---
### **Benefits of Joining Swarms**:
1. **Advance Humanity**: Play an instrumental role in democratizing technology for all.
2. **Financial Prosperity**: Harness a compensation structure that grows with your achievements.
3. **Flexible Work Environment**: Customize your workspace, schedule, and workstyle.
4. **Global Network**: Collaborate with some of the brightest minds spanning continents.
5. **Personal Development**: Regular workshops, courses, and seminars to fuel your growth.
6. **Health & Wellness**: Comprehensive health benefits and well-being programs.
7. **Ownership & Equity**: As we grow, so does your stake and impact in our organization.
8. **Retreats & Team Building**: Forge bonds beyond work in exotic locations globally.
9. **Customer Success Impact**: Directly experience the joy of solving real-world challenges for our users.
---
### **Positions Open**:
- **Customer Success Professionals**: Be the bridge between our revolutionary tech and its real-world impact.
- **AI & Swarm Engineers**: Architect, design, and optimize the swarm systems powering global innovations.
---
### **Your Invitation to the Future**:
If you resonate with our vision of blending technological marvels with human brilliance, of creating a prosperous world where every dream has the wings of AI we invite you to join us on this extraordinary journey.
**Are you ready to create history with Swarms?**
---
**Apply Now and Lets Push Our People Further!**
---

@ -0,0 +1,25 @@
# Swarms Docs
Welcome to Swarm's Documentation!
Swarms is a modular framework that enables reliable and useful multi-agent collaboration at scale to automate real-world tasks.
Swarms is transforming the landscape of AI from siloed AI agents to a unified 'swarm' of intelligence. Through relentless iteration and the power of collective insight from our 1500+ Agora researchers, we're developing a groundbreaking framework for AI collaboration. Our mission is to catalyze a paradigm shift, advancing Humanity with the power of unified autonomous AI agent swarms.
This documentation covers the fundamentals of the **Swarms** framework and describes how to use **Swarms Tools**.
## Swarms
The Swarms framework provides developers with the ability to create AI systems that operate across two dimensions: predictability and creativity. For predictability, Swarms enforces structures like sequential pipelines, DAG-based workflows, and long-term memory. To facilitate creativity, Swarms safely prompts LLMs with [tools](https://github.com/kyegomez/swarms-tools) and short-term memory connecting them to external APIs and data stores. The framework allows developers to transition between those two dimensions effortlessly based on their use case.
Swarms not only helps developers harness the potential of LLMs but also enforces trust boundaries, schema validation, and tool activity-level permissions. By doing so, Swarms maximizes LLMs reasoning while adhering to strict policies regarding their capabilities.
[Learn more about swarms →](swarms/)
## Examples
Check out Swarms examples for building agents, data retrieval, and more.
[Checkout Swarms examples →](examples/)

@ -0,0 +1,9 @@
{% extends "base.html" %}
<!--https://squidfunk.github.io/mkdocs-material/customization/#overriding-blocks-->
{% block announce %}
<div style="text-align:center">
<a href="https://github.com/kyegomez/swarms">Star and contribute</a> to Swarms on GitHub!
</div>
{% endblock %}

@ -0,0 +1,82 @@
# Research Lists
A compilation of projects, papers, blogs in autonomous agents.
## Table of Contents
- [Introduction](#introduction)
- [Projects](#projects)
- [Articles](#articles)
- [Talks](#talks)
## Projects
### Developer tools
- [2023/8/10] [ModelScope-Agent](https://github.com/modelscope/modelscope-agent) - An Agent Framework Connecting Models in ModelScope with the World
- [2023/05/25] [Gorilla](https://github.com/ShishirPatil/gorilla) - An API store for LLMs
- [2023/03/31] [BMTools](https://github.com/OpenBMB/BMTools) - Tool Learning for Big Models, Open-Source Solutions of ChatGPT-Plugins
- [2023/03/09] [LMQL](https://github.com/eth-sri/lmql) - A query language for programming (large) language models.
- [2022/10/25] [Langchain](https://github.com/hwchase17/langchain) - ⚡ Building applications with LLMs through composability ⚡
### Applications
- [2023/07/08] [ShortGPT](https://github.com/RayVentura/ShortGPT) - 🚀🎬 ShortGPT - An experimental AI framework for automated short/video content creation. Enables creators to rapidly produce, manage, and deliver content using AI and automation.
- [2023/07/05] [gpt-researcher](https://github.com/assafelovic/gpt-researcher) - GPT based autonomous agent that does online comprehensive research on any given topic
- [2023/07/04] [DemoGPT](https://github.com/melih-unsal/DemoGPT) - 🧩DemoGPT enables you to create quick demos by just using prompts. [[demo]](demogpt.io)
- [2023/06/30] [MetaGPT](https://github.com/geekan/MetaGPT) - 🌟 The Multi-Agent Framework: Given one line Requirement, return PRD, Design, Tasks, Repo
- [2023/06/11] [gpt-engineer](https://github.com/AntonOsika/gpt-engineer) - Specify what you want it to build, the AI asks for clarification, and then builds it.
- [2023/05/16] [SuperAGI](https://github.com/TransformerOptimus/SuperAGI) - <⚡️> SuperAGI - A dev-first open source autonomous AI agent framework. Enabling developers to build, manage & run useful autonomous agents quickly and reliably.
- [2023/05/13] [Developer](https://github.com/smol-ai/developer) - Human-centric & Coherent Whole Program Synthesis aka your own personal junior developer
- [2023/04/07] [AgentGPT](https://github.com/reworkd/AgentGPT) - 🤖 Assemble, configure, and deploy autonomous AI Agents in your browser. [[demo]](agentgpt.reworkd.ai)
- [2023/04/03] [BabyAGI](https://github.com/yoheinakajima/babyagi) - an example of an AI-powered task management system
- [2023/03/30] [AutoGPT](https://github.com/Significant-Gravitas/Auto-GPT) - An experimental open-source attempt to make GPT-4 fully autonomous.
### Benchmarks
- [2023/08/07] [AgentBench](https://github.com/THUDM/AgentBench) - A Comprehensive Benchmark to Evaluate LLMs as Agents. [paper](https://arxiv.org/abs/2308.03688)
- [2023/06/18] [Auto-GPT-Benchmarks](https://github.com/Significant-Gravitas/Auto-GPT-Benchmarks) - A repo built for the purpose of benchmarking the performance of agents, regardless of how they are set up and how they work.
- [2023/05/28] [ToolBench](https://github.com/OpenBMB/ToolBench) - An open platform for training, serving, and evaluating large language model for tool learning.
## Articles
### Research Papers
- [2023/08/11] [BOLAA: Benchmarking and Orchestrating LLM-Augmented Autonomous Agents](https://arxiv.org/pdf/2308.05960v1.pdf), Zhiwei Liu, et al.
- [2023/07/31] [ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs](https://arxiv.org/abs/2307.16789), Yujia Qin, et al.
- [2023/07/16] [Communicative Agents for Software Development](https://arxiv.org/abs/2307.07924), Chen Qian, et al.
- [2023/06/09] [Mind2Web: Towards a Generalist Agent for the Web](https://arxiv.org/pdf/2306.06070.pdf), Xiang Deng, et al. [[code]](https://github.com/OSU-NLP-Group/Mind2Web) [[demo]](https://osu-nlp-group.github.io/Mind2Web/)
- [2023/06/05] [Orca: Progressive Learning from Complex Explanation Traces of GPT-4](https://arxiv.org/pdf/2306.02707.pdf), Subhabrata Mukherjee et al.
- [2023/05/25] [Voyager: An Open-Ended Embodied Agent with Large Language Models](https://arxiv.org/pdf/2305.16291.pdf), Guanzhi Wang, et al. [[code]](https://github.com/MineDojo/Voyager) [[website]](https://voyager.minedojo.org/)
- [2023/05/23] [ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models](https://arxiv.org/pdf/2305.18323.pdf), Binfeng Xu, et al. [[code]](https://github.com/billxbf/ReWOO)
- [2023/05/17] [Tree of Thoughts: Deliberate Problem Solving with Large Language Models](https://arxiv.org/abs/2305.10601), Shunyu Yao, et al.[[code]](https://github.com/kyegomez/tree-of-thoughts) [[code-orig]](https://github.com/ysymyth/tree-of-thought-llm)
- [2023/05/12] [MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers](https://arxiv.org/abs/2305.07185), Lili Yu, et al.
- [2023/05/19] [FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance](https://arxiv.org/abs/2305.05176), Lingjiao Chen, et al.
- [2023/05/06] [Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models](https://arxiv.org/abs/2305.04091), Lei Wang, et al.
- [2023/05/01] [Learning to Reason and Memorize with Self-Notes](https://arxiv.org/abs/2305.00833), Jack Lanchantin, et al.
- [2023/04/24] [WizardLM: Empowering Large Language Models to Follow Complex Instructions](https://arxiv.org/abs/2304.12244), Can Xu, et al.
- [2023/04/22] [LLM+P: Empowering Large Language Models with Optimal Planning Proficiency](https://arxiv.org/abs/2304.11477), Bo Liu, et al.
- [2023/04/07] [Generative Agents: Interactive Simulacra of Human Behavior](https://arxiv.org/abs/2304.03442), Joon Sung Park, et al. [[code]](https://github.com/mkturkcan/generative-agents)
- [2023/03/30] [Self-Refine: Iterative Refinement with Self-Feedback](https://arxiv.org/abs/2303.17651), Aman Madaan, et al.[[code]](https://github.com/madaan/self-refine)
- [2023/03/30] [HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in HuggingFace](https://arxiv.org/pdf/2303.17580.pdf), Yongliang Shen, et al. [[code]](https://github.com/microsoft/JARVIS) [[demo]](https://huggingface.co/spaces/microsoft/HuggingGPT)
- [2023/03/20] [Reflexion: Language Agents with Verbal Reinforcement Learning](https://arxiv.org/pdf/2303.11366.pdf), Noah Shinn, et al. [[code]](https://github.com/noahshinn024/reflexion)
- [2023/03/04] [Towards A Unified Agent with Foundation Models](https://openreview.net/pdf?id=JK_B1tB6p-), Norman Di Palo et al.
- [2023/02/23] [Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection](https://arxiv.org/abs/2302.12173), Sahar Abdelnab, et al.
- [2023/02/09] [Toolformer: Language Models Can Teach Themselves to Use Tools](https://arxiv.org/pdf/2302.04761.pdf), Timo Schick, et al. [[code]](https://github.com/lucidrains/toolformer-pytorch)
- [2022/12/12] [LMQL: Prompting Is Programming: A Query Language for Large Language Models](https://arxiv.org/abs/2212.06094), Luca Beurer-Kellner, et al.
- [2022/10/06] [ReAct: Synergizing Reasoning and Acting in Language Models](https://arxiv.org/pdf/2210.03629.pdf), Shunyu Yao, et al. [[code]](https://github.com/ysymyth/ReAct)
- [2022/07/20] [Inner Monologue: Embodied Reasoning through Planning with Language Models](https://arxiv.org/pdf/2207.05608.pdf), Wenlong Huang, et al. [[demo]](https://innermonologue.github.io/)
- [2022/04/04] [Do As I Can, Not As I Say: Grounding Language in Robotic Affordances](), Michael Ahn, e al. [[demo]](https://say-can.github.io/)
- [2021/12/17] [WebGPT: Browser-assisted question-answering with human feedback](https://arxiv.org/pdf/2112.09332.pdf), Reiichiro Nakano, et al.
- [2021/06/17] [LoRA: Low-Rank Adaptation of Large Language Models](https://arxiv.org/abs/2106.09685), Edward J. Hu, et al.
### Blog Articles
- [2023/08/14] [A Roadmap of AI Agents(Chinese)](https://zhuanlan.zhihu.com/p/649916692) By Haojie Pan
- [2023/06/23] [LLM Powered Autonomous Agents](https://lilianweng.github.io/posts/2023-06-23-agent/) By Lilian Weng
- [2023/06/11] [A CRITICAL LOOK AT AI-GENERATED SOFTWARE](https://spectrum.ieee.org/ai-software) By JAIDEEP VAIDYAHAFIZ ASIF
- [2023/04/29] [AUTO-GPT: UNLEASHING THE POWER OF AUTONOMOUS AI AGENTS](https://www.leewayhertz.com/autogpt/) By Akash Takyar
- [2023/04/20] [Conscious Machines: Experiments, Theory, and Implementations(Chinese)](https://pattern.swarma.org/article/230) By Jiang Zhang
- [2023/04/18] [Autonomous Agents & Agent Simulations](https://blog.langchain.dev/agents-round/) By Langchain
- [2023/04/16] [4 Autonomous AI Agents you need to know](https://towardsdatascience.com/4-autonomous-ai-agents-you-need-to-know-d612a643fa92) By Sophia Yang
- [2023/03/31] [ChatGPT that learns to use tools(Chinese)](https://zhuanlan.zhihu.com/p/618448188) By Haojie Pan
### Talks
- [2023/06/05] [Two Paths to Intelligence](https://www.youtube.com/watch?v=rGgGOccMEiY&t=1497s) by Geoffrey Hinton
- [2023/05/24] [State of GPT](https://www.youtube.com/watch?v=bZQun8Y4L2A) by Andrej Karpathy | OpenAI

@ -0,0 +1,13 @@
## The Plan
### Phase 1: Building the Foundation
In the first phase, our focus is on building the basic infrastructure of Swarms. This includes developing key components like the Swarms class, integrating essential tools, and establishing task completion and evaluation logic. We'll also start developing our testing and evaluation framework during this phase. If you're interested in foundational work and have a knack for building robust, scalable systems, this phase is for you.
### Phase 2: Optimizing the System
In the second phase, we'll focus on optimizng Swarms by integrating more advanced features, improving the system's efficiency, and refining our testing and evaluation framework. This phase involves more complex tasks, so if you enjoy tackling challenging problems and contributing to the development of innovative features, this is the phase for you.
### Phase 3: Towards Super-Intelligence
The third phase of our bounty program is the most exciting - this is where we aim to achieve super-intelligence. In this phase, we'll be working on improving the swarm's capabilities, expanding its skills, and fine-tuning the system based on real-world testing and feedback. If you're excited about the future of AI and want to contribute to a project that could potentially transform the digital world, this is the phase for you.
Remember, our roadmap is a guide, and we encourage you to bring your own ideas and creativity to the table. We believe that every contribution, no matter how small, can make a difference. So join us on this exciting journey and help us create the future of Swarms.

@ -0,0 +1,191 @@
The Swarms framework provides developers with the ability to create AI systems that operate across two dimensions: **predictability** and **creativity**.
For **predictability**, Swarms enforces structures like sequential pipelines, DAG-based workflows, and long-term memory. To facilitate creativity, Swarms safely prompts LLMs with tools and short-term memory connecting them to external APIs and data stores. The framework allows developers to transition between those two dimensions effortlessly based on their use case.
Swarms not only helps developers harness the potential of LLMs but also enforces trust boundaries, schema validation, and tool activity-level permissions. By doing so, Swarms maximizes LLMs reasoning while adhering to strict policies regarding their capabilities.
Swarmss design philosophy is based on the following tenets:
1. **Modularity and composability**: All framework primitives are useful and usable on their own in addition to being easy to plug into each other.
2. **Technology-agnostic**: Swarms is designed to work with any capable LLM, data store, and backend through the abstraction of drivers.
3. **Keep data off prompt by default**: When working with data through loaders and tools, Swarms aims to keep it off prompt by default, making it easy to work with big data securely and with low latency.
4. **Minimal prompt engineering**: Its much easier to reason about code written in Python, not natural languages. Swarms aims to default to Python in most cases unless absolutely necessary.
## Installation
There are 2 methods, one is through `git clone` and the other is by `pip install swarms`. Check out the [DOCUMENTATION](DOCS/DOCUMENTATION.md) for more information on the classes.
* Pip install `pip3 install swarms`
* Create new python file and unleash superintelligence
```python
from swarms import Worker
node = Worker(
openai_api_key="",
ai_name="Optimus Prime",
)
task = "What were the winning boston marathon times for the past 5 years (ending in 2022)? Generate a table of the year, name, country of origin, and times."
response = node.run(task)
print(response)
```
---
## Usage
```python
from swarms import HuggingFaceLLM
hugging_face_model = HuggingFaceLLM(model_id="Voicelab/trurl-2-13b")
generated_text = hugging_face_model.generate("In a world where AI")
```
---
# Documentation
For documentation, go here, [the docs folder in the root diectory](https://swarms.apac.ai)
**NOTE: We need help building the documentation**
-----
# Docker Setup
The docker file is located in the docker folder in the `infra` folder, [click here and navigate here in your environment](/infra/Docker)
* Build the Docker image
* You can build the Docker image using the provided Dockerfile. Navigate to the infra/Docker directory where the Dockerfiles are located.
* For the CPU version, use:
```bash
docker build -t swarms-api:latest -f Dockerfile.cpu .
```
For the GPU version, use:
```bash
docker build -t swarms-api:gpu -f Dockerfile.gpu .
```
### Run the Docker container
After building the Docker image, you can run the Swarms API in a Docker container. Replace your_redis_host and your_redis_port with your actual Redis host and port.
For the CPU version:
```bash
docker run -p 8000:8000 -e REDIS_HOST=your_redis_host -e REDIS_PORT=your_redis_port swarms-api:latest
```
## For the GPU version:
```bash
docker run --gpus all -p 8000:8000 -e REDIS_HOST=your_redis_host -e REDIS_PORT=your_redis_port swarms-api:gpu
```
## Access the Swarms API
* The Swarms API will be accessible at http://localhost:8000. You can use tools like curl or Postman to send requests to the API.
Here's an example curl command to send a POST request to the /chat endpoint:
```bash
curl -X POST -H "Content-Type: application/json" -d '{"api_key": "your_openai_api_key", "objective": "your_objective"}' http://localhost:8000/chat
```
Replace your_openai_api_key and your_objective with your actual OpenAI API key and objective.
----
# ✨ Features
* Easy to use Base LLMs, `OpenAI` `Palm` `Anthropic` `HuggingFace`
* Enterprise Grade, Production Ready with robust Error Handling
* Multi-Modality Native with Multi-Modal LLMs as tools
* Infinite Memory Processing: Store infinite sequences of infinite Multi-Modal data, text, images, videos, audio
* Usability: Extreme emphasis on useability, code is at it's theortical minimum simplicity factor to use
* Reliability: Outputs that accomplish tasks and activities you wish to execute.
* Fluidity: A seamless all-around experience to build production grade workflows
* Speed: Lower the time to automate tasks by 90%.
* Simplicity: Swarms is extremely simple to use, if not thee simplest agent framework of all time
* Powerful: Swarms is capable of building entire software apps, to large scale data analysis, and handling chaotic situations
---
# Roadmap
Please checkout our [Roadmap](DOCS/ROADMAP.md) and consider contributing to make the dream of Swarms real to advance Humanity.
## Optimization Priorities
1. **Reliability**: Increase the reliability of the swarm - obtaining the desired output with a basic and un-detailed input.
2. **Speed**: Reduce the time it takes for the swarm to accomplish tasks by improving the communication layer, critiquing, and self-alignment with meta prompting.
3. **Scalability**: Ensure that the system is asynchronous, concurrent, and self-healing to support scalability.
Our goal is to continuously improve Swarms by following this roadmap, while also being adaptable to new needs and opportunities as they arise.
---
# Bounty Program
Our bounty program is an exciting opportunity for contributors to help us build the future of Swarms. By participating, you can earn rewards while contributing to a project that aims to revolutionize digital activity.
Here's how it works:
1. **Check out our Roadmap**: We've shared our roadmap detailing our short and long-term goals. These are the areas where we're seeking contributions.
2. **Pick a Task**: Choose a task from the roadmap that aligns with your skills and interests. If you're unsure, you can reach out to our team for guidance.
3. **Get to Work**: Once you've chosen a task, start working on it. Remember, quality is key. We're looking for contributions that truly make a difference.
4. **Submit your Contribution**: Once your work is complete, submit it for review. We'll evaluate your contribution based on its quality, relevance, and the value it brings to Swarms.
5. **Earn Rewards**: If your contribution is approved, you'll earn a bounty. The amount of the bounty depends on the complexity of the task, the quality of your work, and the value it brings to Swarms.
---
## The Plan
### Phase 1: Building the Foundation
In the first phase, our focus is on building the basic infrastructure of Swarms. This includes developing key components like the Swarms class, integrating essential tools, and establishing task completion and evaluation logic. We'll also start developing our testing and evaluation framework during this phase. If you're interested in foundational work and have a knack for building robust, scalable systems, this phase is for you.
### Phase 2: Optimizing the System
In the second phase, we'll focus on optimizng Swarms by integrating more advanced features, improving the system's efficiency, and refining our testing and evaluation framework. This phase involves more complex tasks, so if you enjoy tackling challenging problems and contributing to the development of innovative features, this is the phase for you.
### Phase 3: Towards Super-Intelligence
The third phase of our bounty program is the most exciting - this is where we aim to achieve super-intelligence. In this phase, we'll be working on improving the swarm's capabilities, expanding its skills, and fine-tuning the system based on real-world testing and feedback. If you're excited about the future of AI and want to contribute to a project that could potentially transform the digital world, this is the phase for you.
Remember, our roadmap is a guide, and we encourage you to bring your own ideas and creativity to the table. We believe that every contribution, no matter how small, can make a difference. So join us on this exciting journey and help us create the future of Swarms.
---
# EcoSystem
* [The-Compiler, compile natural language into serene, reliable, and secure programs](https://github.com/kyegomez/the-compiler)
*[The Replicator, an autonomous swarm that conducts Multi-Modal AI research by creating new underlying mathematical operations and models](https://github.com/kyegomez/The-Replicator)
* Make a swarm that checks arxviv for papers -> checks if there is a github link -> then implements them and checks them
* [SwarmLogic, where a swarm is your API, database, and backend!](https://github.com/kyegomez/SwarmLogic)
---
# Demos
![Swarms Demo](images/Screenshot_48.png)
## Swarm Video Demo {Click for more}
[![Watch the swarm video](https://img.youtube.com/vi/Br62cDMYXgc/maxresdefault.jpg)](https://youtu.be/Br62cDMYXgc)
---
# Contact
For enterprise and production ready deployments, allow us to discover more about you and your story, [book a call with us here](https://www.apac.ai/Setup-Call)

@ -0,0 +1,110 @@
# **Documentation for the `Anthropic` Class**
## **Overview and Introduction**
The `Anthropic` class provides an interface to interact with the Anthropic large language models. This class encapsulates the necessary functionality to request completions from the Anthropic API based on a provided prompt and other configurable parameters.
### **Key Concepts and Terminology**
- **Anthropic**: A large language model, akin to GPT-3 and its successors.
- **Prompt**: A piece of text that serves as the starting point for model completions.
- **Stop Sequences**: Specific tokens or sequences to indicate when the model should stop generating.
- **Tokens**: Discrete pieces of information in a text. For example, in English, a token can be as short as one character or as long as one word.
## **Class Definition**
### `Anthropic`
```python
class Anthropic:
"""Anthropic large language models."""
```
### Parameters:
- `model (str)`: The name of the model to use for completions. Default is "claude-2".
- `max_tokens_to_sample (int)`: Maximum number of tokens to generate in the output. Default is 256.
- `temperature (float, optional)`: Sampling temperature. A higher value will make the output more random, while a lower value will make it more deterministic.
- `top_k (int, optional)`: Sample from the top-k most probable next tokens. Setting this parameter can reduce randomness in the output.
- `top_p (float, optional)`: Sample from the smallest set of tokens such that their cumulative probability exceeds the specified value. Used in nucleus sampling to provide a balance between randomness and determinism.
- `streaming (bool)`: Whether to stream the output or not. Default is False.
- `default_request_timeout (int, optional)`: Default timeout in seconds for API requests. Default is 600.
### **Methods and their Functionality**
#### `_default_params(self) -> dict`
- Provides the default parameters for calling the Anthropic API.
- **Returns**: A dictionary containing the default parameters.
#### `generate(self, prompt: str, stop: list[str] = None) -> str`
- Calls out to Anthropic's completion endpoint to generate text based on the given prompt.
- **Parameters**:
- `prompt (str)`: The input text to provide context for the generated text.
- `stop (list[str], optional)`: Sequences to indicate when the model should stop generating.
- **Returns**: A string containing the model's generated completion based on the prompt.
#### `__call__(self, prompt: str, stop: list[str] = None) -> str`
- An alternative to the `generate` method that allows calling the class instance directly.
- **Parameters**:
- `prompt (str)`: The input text to provide context for the generated text.
- `stop (list[str], optional)`: Sequences to indicate when the model should stop generating.
- **Returns**: A string containing the model's generated completion based on the prompt.
## **Usage Examples**
```python
# Import necessary modules and classes
from swarms.models import Anthropic
import torch
# Initialize an instance of the Anthropic class
anthropic_instance = Anthropic()
# Using the generate method
completion_1 = anthropic_instance.generate("What is the capital of France?")
print(completion_1)
# Using the __call__ method
completion_2 = anthropic_instance("How far is the moon from the earth?", stop=["miles", "km"])
print(completion_2)
```
## **Mathematical Formula**
The underlying operations of the `Anthropic` class involve probabilistic sampling based on token logits from the Anthropic model. Mathematically, the process of generating a token \( t \) from the given logits \( l \) can be described by the softmax function:
\[ P(t) = \frac{e^{l_t}}{\sum_{i} e^{l_i}} \]
Where:
- \( P(t) \) is the probability of token \( t \).
- \( l_t \) is the logit corresponding to token \( t \).
- The summation runs over all possible tokens.
The temperature, top-k, and top-p parameters are further used to modulate the probabilities.
## **Additional Information and Tips**
- Ensure you have a valid `ANTHROPIC_API_KEY` set as an environment variable or passed during class instantiation.
- Always handle exceptions that may arise from API timeouts or invalid prompts.
## **References and Resources**
- [Anthropic's official documentation](https://www.anthropic.com/docs)
- [Token-based sampling in Language Models](https://arxiv.org/abs/1904.09751) for a deeper understanding of token sampling.

@ -0,0 +1,91 @@
# HuggingFaceLLM
## Overview & Introduction
The `HuggingFaceLLM` class in the Zeta library provides a simple and easy-to-use interface to harness the power of Hugging Face's transformer-based language models, specifically for causal language modeling. This enables developers to generate coherent and contextually relevant sentences or paragraphs given a prompt, without delving deep into the intricate details of the underlying model or the tokenization process.
Causal Language Modeling (CLM) is a task where given a series of tokens (or words), the model predicts the next token in the sequence. This functionality is central to many natural language processing tasks, including chatbots, story generation, and code autocompletion.
---
## Class Definition
```python
class HuggingFaceLLM:
```
### Parameters:
- `model_id (str)`: Identifier for the pre-trained model on the Hugging Face model hub. Examples include "gpt2-medium", "openai-gpt", etc.
- `device (str, optional)`: The device on which to load and run the model. Defaults to 'cuda' if GPU is available, else 'cpu'.
- `max_length (int, optional)`: Maximum length of the generated sequence. Defaults to 20.
- `quantization_config (dict, optional)`: Configuration dictionary for model quantization (if applicable). Default is `None`.
---
## Functionality & Usage
### Initialization:
```python
llm = HuggingFaceLLM(model_id="gpt2-medium")
```
Upon initialization, the specified pre-trained model and tokenizer are loaded from Hugging Face's model hub. The model is then moved to the designated device. If there's an issue loading either the model or the tokenizer, an error will be logged.
### Generation:
The main functionality of this class is text generation. The class provides two methods for this: `__call__` and `generate`. Both methods take in a prompt text and an optional `max_length` parameter and return the generated text.
Usage:
```python
from swarms import HuggingFaceLLM
# Initialize
llm = HuggingFaceLLM(model_id="gpt2-medium")
# Generate text using __call__ method
result = llm("Once upon a time,")
print(result)
# Alternatively, using the generate method
result = llm.generate("The future of AI is")
print(result)
```
---
## Mathematical Explanation:
Given a sequence of tokens \( x_1, x_2, ..., x_n \), a causal language model aims to maximize the likelihood of the next token \( x_{n+1} \) in the sequence. Formally, it tries to optimize:
\[ P(x_{n+1} | x_1, x_2, ..., x_n) \]
Where \( P \) is the probability distribution over all possible tokens in the vocabulary.
The model takes the tokenized input sequence, feeds it through several transformer blocks, and finally through a linear layer to produce logits for each token in the vocabulary. The token with the highest logit value is typically chosen as the next token in the sequence.
---
## Additional Information & Tips:
- Ensure you have an active internet connection when initializing the class for the first time, as the models and tokenizers are fetched from Hugging Face's servers.
- Although the default `max_length` is set to 20, it's advisable to adjust this parameter based on the context of the problem.
- Keep an eye on GPU memory when using large models or generating long sequences.
---
## References & Resources:
- Hugging Face Model Hub: [https://huggingface.co/models](https://huggingface.co/models)
- Introduction to Transformers: [https://huggingface.co/transformers/introduction.html](https://huggingface.co/transformers/introduction.html)
- Causal Language Modeling: Vaswani, A., et al. (2017). Attention is All You Need. [arXiv:1706.03762](https://arxiv.org/abs/1706.03762)
Note: This documentation template provides a comprehensive overview of the `HuggingFaceLLM` class. Developers can follow similar structures when documenting other classes or functionalities.

@ -0,0 +1,174 @@
## LLMs in Swarms Documentation
Welcome to the documentation for the llm section of the swarms package, designed to facilitate seamless integration with various AI language models and APIs. This package empowers developers, end-users, and system administrators to interact with AI models from different providers, such as OpenAI, Hugging Face, Google PaLM, and Anthropic.
### Table of Contents
1. [OpenAI](#openai)
2. [HuggingFace](#huggingface)
3. [Google PaLM](#google-palm)
4. [Anthropic](#anthropic)
### 1. OpenAI (swarms.agents.models.OpenAI)
The OpenAI class provides an interface to interact with OpenAI's language models. It allows both synchronous and asynchronous interactions.
**Constructor:**
```python
OpenAI(api_key: str, system: str = None, console: bool = True, model: str = None, params: dict = None, save_messages: bool = True)
```
**Attributes:**
- `api_key` (str): Your OpenAI API key.
- `system` (str, optional): A system message to be used in conversations.
- `console` (bool, default=True): Display console logs.
- `model` (str, optional): Name of the language model to use.
- `params` (dict, optional): Additional parameters for model interactions.
- `save_messages` (bool, default=True): Save conversation messages.
**Methods:**
- `generate(message: str, **kwargs) -> str`: Generate a response using the OpenAI model.
- `generate_async(message: str, **kwargs) -> str`: Generate a response asynchronously.
- `ask_multiple(ids: List[str], question_template: str) -> List[str]`: Query multiple IDs simultaneously.
- `stream_multiple(ids: List[str], question_template: str) -> List[str]`: Stream multiple responses.
**Usage Example:**
```python
from swarms import OpenAI
import asyncio
chat = OpenAI(api_key="YOUR_OPENAI_API_KEY")
response = chat.generate("Hello, how can I assist you?")
print(response)
ids = ["id1", "id2", "id3"]
async_responses = asyncio.run(chat.ask_multiple(ids, "How is {id}?"))
print(async_responses)
```
### 2. HuggingFace (swarms.agents.models.HuggingFaceLLM)
The HuggingFaceLLM class allows interaction with language models from Hugging Face.
**Constructor:**
```python
HuggingFaceLLM(model_id: str, device: str = None, max_length: int = 20, quantize: bool = False, quantization_config: dict = None)
```
**Attributes:**
- `model_id` (str): ID or name of the Hugging Face model.
- `device` (str, optional): Device to run the model on (e.g., 'cuda', 'cpu').
- `max_length` (int, default=20): Maximum length of generated text.
- `quantize` (bool, default=False): Apply model quantization.
- `quantization_config` (dict, optional): Configuration for quantization.
**Methods:**
- `generate(prompt_text: str, max_length: int = None) -> str`: Generate text based on a prompt.
**Usage Example:**
```python
from swarms import HuggingFaceLLM
model_id = "gpt2"
hugging_face_model = HuggingFaceLLM(model_id=model_id)
prompt = "Once upon a time"
generated_text = hugging_face_model.generate(prompt)
print(generated_text)
```
### 3. Google PaLM (swarms.agents.models.GooglePalm)
The GooglePalm class provides an interface for Google's PaLM Chat API.
**Constructor:**
```python
GooglePalm(model_name: str = "models/chat-bison-001", google_api_key: str = None, temperature: float = None, top_p: float = None, top_k: int = None, n: int = 1)
```
**Attributes:**
- `model_name` (str): Name of the Google PaLM model.
- `google_api_key` (str, optional): Google API key.
- `temperature` (float, optional): Temperature for text generation.
- `top_p` (float, optional): Top-p sampling value.
- `top_k` (int, optional): Top-k sampling value.
- `n` (int, default=1): Number of candidate completions.
**Methods:**
- `generate(messages: List[Dict[str, Any]], stop: List[str] = None, **kwargs) -> Dict[str, Any]`: Generate text based on a list of messages.
- `__call__(messages: List[Dict[str, Any]], stop: List[str] = None, **kwargs) -> Dict[str, Any]`: Generate text using the call syntax.
**Usage Example:**
```python
from swarms import GooglePalm
google_palm = GooglePalm()
messages = [{"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": "Tell me a joke"}]
response = google_palm.generate(messages)
print(response["choices"][0]["text"])
```
### 4. Anthropic (swarms.agents.models.Anthropic)
The Anthropic class enables interaction with Anthropic's large language models.
**Constructor:**
```python
Anthropic(model: str = "claude-2", max_tokens_to_sample: int = 256, temperature: float = None, top_k: int = None, top_p: float = None, streaming: bool = False, default_request_timeout: int = None)
```
**Attributes:**
- `model` (str): Name of the Anthropic model.
- `max_tokens_to_sample` (int, default=256): Maximum tokens to sample.
- `temperature` (float, optional): Temperature for text generation.
- `top_k` (int, optional): Top-k sampling value.
- `top_p` (float, optional): Top-p sampling value.
- `streaming` (bool, default=False): Enable streaming mode.
- `default_request_timeout` (int, optional): Default request timeout.
**Methods:**
- `generate(prompt: str, stop: List[str] = None) -> str`: Generate text based on a prompt.
**Usage Example:**
```python
from swarms import Anthropic
anthropic = Anthropic()
prompt = "Once upon a time"
generated_text = anthropic.generate(prompt)
print(generated_text)
```
This concludes the documentation for the "models" folder, providing you with tools to seamlessly integrate with various language models and APIs. Happy coding!

@ -0,0 +1,175 @@
### Enterprise Grade Documentation
---
## AutoScaler Class from `swarms` Package
The `AutoScaler` class, part of the `swarms` package, provides a dynamic mechanism to handle agents depending on the workload. This document outlines how to use it, complete with import statements and examples.
---
### Importing the AutoScaler Class
Before you can use the `AutoScaler` class, you must import it from the `swarms` package:
```python
from swarms import AutoScaler
```
---
### Constructor: `AutoScaler.__init__()`
**Description**:
Initializes the `AutoScaler` with a predefined number of agents and sets up configurations for scaling.
**Parameters**:
- `initial_agents (int)`: Initial number of agents. Default is 10.
- `scale_up_factor (int)`: Multiplicative factor to scale up the number of agents. Default is 2.
- `idle_threshold (float)`: Threshold below which agents are considered idle. Expressed as a ratio (0-1). Default is 0.2.
- `busy_threshold (float)`: Threshold above which agents are considered busy. Expressed as a ratio (0-1). Default is 0.7.
**Returns**:
- None
**Example Usage**:
```python
from swarms import AutoScaler
scaler = AutoScaler(initial_agents=5, scale_up_factor=3, idle_threshold=0.1, busy_threshold=0.8)
```
---
### Method: `AutoScaler.add_task(task)`
**Description**:
Enqueues the specified task into the task queue.
**Parameters**:
- `task`: The task to be added to the queue.
**Returns**:
- None
**Example Usage**:
```python
task_data = "Process dataset X"
scaler.add_task(task_data)
```
---
### Method: `AutoScaler.scale_up()`
**Description**:
Scales up the number of agents based on the specified scale-up factor.
**Parameters**:
- None
**Returns**:
- None
**Example Usage**:
```python
# Called internally but can be manually invoked if necessary
scaler.scale_up()
```
---
### Method: `AutoScaler.scale_down()`
**Description**:
Scales down the number of agents, ensuring a minimum is always present.
**Parameters**:
- None
**Returns**:
- None
**Example Usage**:
```python
# Called internally but can be manually invoked if necessary
scaler.scale_down()
```
---
### Method: `AutoScaler.monitor_and_scale()`
**Description**:
Continuously monitors the task queue and agent utilization to decide on scaling.
**Parameters**:
- None
**Returns**:
- None
**Example Usage**:
```python
# This method is internally used as a thread and does not require manual invocation in most scenarios.
```
---
### Method: `AutoScaler.start()`
**Description**:
Initiates the monitoring process and starts processing tasks from the queue.
**Parameters**:
- None
**Returns**:
- None
**Example Usage**:
```python
scaler.start()
```
---
### Full Usage
```python
from swarms import AutoScaler
# Initialize the scaler
auto_scaler = AutoScaler(initial_agents=15, scale_up_factor=2, idle_threshold=0.2, busy_threshold=0.7)
# Start the monitoring and task processing
auto_scaler.start()
# Simulate the addition of tasks
for i in range(100):
auto_scaler.add_task(f"Task {i}")
```
### Pass in Custom Agent
You can pass any agent class that adheres to the required interface (like having a run() method). If no class is passed, it defaults to using AutoBot. This makes the AutoScaler more flexible and able to handle a wider range of agent implementations.
```python
from swarms import AutoScaler
auto_scaler = AutoScaler(agent=YourCustomAgent)
auto_scaler.start()
for i in range(100): # Adding tasks
auto_scaler.add_task(f"Task {i}")
```
---
**Notes**:
1. Adjust the thresholds and scaling factors as per your specific requirements and nature of the tasks.
2. The provided implementation is a baseline. Depending on your production environment, you may need additional features, error-handling, and optimizations.
3. Ensure that the `swarms` package and its dependencies are installed in your environment.
---

@ -0,0 +1,97 @@
# Module Name: Worker
The `Worker` class encapsulates the idea of a semi-autonomous agent that utilizes a large language model to execute tasks. The module provides a unified interface for AI-driven task execution while combining a series of tools and utilities. It sets up memory storage and retrieval mechanisms for contextual recall and offers an option for human involvement, making it a versatile and adaptive agent for diverse applications.
## **Class Definition**:
```python
class Worker:
```
### **Parameters**:
- `model_name` (str, default: "gpt-4"): Name of the language model.
- `openai_api_key` (str, Optional): API key for accessing OpenAI's models.
- `ai_name` (str, default: "Autobot Swarm Worker"): Name of the AI agent.
- `ai_role` (str, default: "Worker in a swarm"): Role description of the AI agent.
- `external_tools` (list, Optional): A list of external tool objects to be used.
- `human_in_the_loop` (bool, default: False): If set to `True`, it indicates that human intervention may be required.
- `temperature` (float, default: 0.5): Sampling temperature for the language model's output. Higher values make the output more random, and lower values make it more deterministic.
### **Methods**:
#### `__init__`:
Initializes the Worker class.
#### `setup_tools`:
Sets up the tools available to the worker. Default tools include reading and writing files, processing CSV data, querying websites, and taking human input. Additional tools can be appended through the `external_tools` parameter.
#### `setup_memory`:
Initializes memory systems using embeddings and a vector store for the worker.
#### `setup_agent`:
Sets up the primary agent using the initialized tools, memory, and language model.
#### `run`:
Executes a given task using the agent.
#### `__call__`:
Makes the Worker class callable. When an instance of the class is called, it will execute the provided task using the agent.
## **Usage Examples**:
### **Example 1**: Basic usage with default parameters:
```python
from swarms import Worker
worker = Worker(model_name="gpt-4", openai_api_key="YOUR_API_KEY")
result = worker.run("Summarize the document.")
```
### **Example 2**: Usage with custom tools:
```python
from swarms import Worker, MyCustomTool
worker = Worker(model_name="gpt-4", openai_api_key="YOUR_API_KEY", external_tools=[MyCustomTool()])
result = worker.run("Perform a custom operation on the document.")
```
### **Example 3**: Usage with human in the loop:
```python
from swarms import Worker
worker = Worker(model_name="gpt-4", openai_api_key="YOUR_API_KEY", human_in_the_loop=True)
result = worker.run("Translate this complex document, and ask for help if needed.")
```
## **Mathematical Description**:
Conceptually, the `Worker` class can be seen as a function:
\[ W(t, M, K, T, H, \theta) \rightarrow R \]
Where:
- \( W \) = Worker function
- \( t \) = task to be performed
- \( M \) = Model (e.g., "gpt-4")
- \( K \) = OpenAI API key
- \( T \) = Set of Tools available
- \( H \) = Human involvement flag (True/False)
- \( \theta \) = Temperature parameter
- \( R \) = Result of the task
This mathematical abstraction provides a simple view of the `Worker` class's capability to transform a task input into a desired output using a combination of AI and toolsets.
## **Notes**:
The Worker class acts as a bridge between raw tasks and the tools & AI required to accomplish them. The setup ensures flexibility and versatility. The decorators used in the methods (e.g., log_decorator, error_decorator) emphasize the importance of logging, error handling, and performance measurement, essential for real-world applications.

@ -0,0 +1,106 @@
site_name: Swarms Docs
plugins:
- glightbox
- search
copyright: "&copy; APAC Corp, Inc."
extra_css:
- docs/assets/css/extra.css
extra:
# analytics:
# provider: google
# property: G-QM8EDPSCB6
social:
- icon: fontawesome/solid/house
link: assets/img/SwarmsLogoIcon.png
- icon: fontawesome/brands/discord
link: https://discord.gg/qUtxnK2NMf
- icon: fontawesome/brands/github
link: https://github.com/kyegomez/Swarms/
- icon: fontawesome/brands/python
link: https://pypi.org/project/Swarms/
theme:
name: material
custom_dir: docs/overrides
logo: assets/img/SwarmsLogoIcon.png
palette:
# Palette toggle for light mode
- scheme: default
primary: black
toggle:
icon: material/brightness-7
name: Switch to dark mode
# Palette toggle for dark mode
- scheme: slate
primary: black
toggle:
icon: material/brightness-4
name: Switch to light mode
features:
- content.code.copy
- content.code.annotate
- navigation.tabs
- navigation.sections
- navigation.expand
- navigation.top
- announce.dismiss
markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- admonition
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.details
- pymdownx.tabbed
- tables
- def_list
- footnotes
nav:
- Home:
- Overview: "index.md"
- Contributing: "contributing.md"
- FAQ: "faq.md"
- Purpose: "purpose.md"
- Roadmap: "roadmap.md"
- Weaknesses: "failures.md"
- Design: "design.md"
- Flywheel: "flywheel.md"
- Bounties: "bounties.md"
- Metric: "metric.md"
- Distribution: "distribution"
- Research: "research.md"
- Demos: "demos.md"
- Architecture: "architecture.md"
- Checklist: "checklist.md"
- Hiring: "hiring.md"
- Swarms:
- Overview: "swarms/index.md"
- AutoScaler: "swarms/swarms/autoscaler.md"
- Workers:
- Overview: "swarms/workers/index.md"
- Agents:
- Base Models:
- Overview: "swarms/models/index.md"
- HuggingFaceLLM: "swarms/models/hf.md"
- Anthropic: "swarms/models/anthropic.md"
- Examples:
- Overview: "examples/index.md"
- Agents:
- Talk to Redshift: "examples/talk-to-redshift.md"
- Talk to a Webpage: "examples/talk-to-a-webpage.md"
- Talk to a PDF: "examples/talk-to-a-pdf.md"
- Data:
- Load and Query Pinecone: "examples/load-and-query-pinecone.md"
- Load and Query Marqo: "examples/load-query-and-chat-marqo.md"
- Query a Webpage: "examples/query-webpage.md"
- Misc:
- Count Tokens: "examples/count-tokens.md"
- Using Text Generation Web UI: "examples/using-text-generation-web-ui.md"
- Storing Conversation Memory in DynamoDB: "examples/store-conversation-memory-in-dynamodb.md"
- Applications:
- CustomerSupport:
- Overview: "applications/customer_support.md"
- Marketing:
- Overview: "applications/marketing_agencies.md"

@ -0,0 +1,101 @@
# The Swarms Flywheel
1. **Building a Supportive Community:** Initiate by establishing an engaging and inclusive open-source community for both developers and sales freelancers around Swarms. Regular online meetups, webinars, tutorials, and sales training can make them feel welcome and encourage contributions and sales efforts.
2. **Increased Contributions and Sales Efforts:** The more engaged the community, the more developers will contribute to Swarms and the more effort sales freelancers will put into selling Swarms.
3. **Improvement in Quality and Market Reach:** More developer contributions mean better quality, reliability, and feature offerings from Swarms. Simultaneously, increased sales efforts from freelancers boost Swarms' market penetration and visibility.
4. **Rise in User Base:** As Swarms becomes more robust and more well-known, the user base grows, driving more revenue.
5. **Greater Financial Incentives:** Increased revenue can be redirected to offer more significant financial incentives to both developers and salespeople. Developers can be incentivized based on their contribution to Swarms, and salespeople can be rewarded with higher commissions.
6. **Attract More Developers and Salespeople:** These financial incentives, coupled with the recognition and experience from participating in a successful project, attract more developers and salespeople to the community.
7. **Wider Adoption of Swarms:** An ever-improving product, a growing user base, and an increasing number of passionate salespeople accelerate the adoption of Swarms.
8. **Return to Step 1:** As the community, user base, and sales network continue to grow, the cycle repeats, each time speeding up the flywheel.
```markdown
+---------------------+
| Building a |
| Supportive | <--+
| Community | |
+--------+-----------+ |
| |
v |
+--------+-----------+ |
| Increased | |
| Contributions & | |
| Sales Efforts | |
+--------+-----------+ |
| |
v |
+--------+-----------+ |
| Improvement in | |
| Quality & Market | |
| Reach | |
+--------+-----------+ |
| |
v |
+--------+-----------+ |
| Rise in User | |
| Base | |
+--------+-----------+ |
| |
v |
+--------+-----------+ |
| Greater Financial | |
| Incentives | |
+--------+-----------+ |
| |
v |
+--------+-----------+ |
| Attract More | |
| Developers & | |
| Salespeople | |
+--------+-----------+ |
| |
v |
+--------+-----------+ |
| Wider Adoption of | |
| Swarms |----+
+---------------------+
```
# Potential Risks and Mitigations:
1. **Insufficient Contributions or Quality of Work**: Open-source efforts rely on individuals being willing and able to spend time contributing. If not enough people participate, or the work they produce is of poor quality, the product development could stall.
* **Mitigation**: Create a robust community with clear guidelines, support, and resources. Provide incentives for quality contributions, such as a reputation system, swag, or financial rewards. Conduct thorough code reviews to ensure the quality of contributions.
2. **Lack of Sales Results**: Commission-based salespeople will only continue to sell the product if they're successful. If they aren't making enough sales, they may lose motivation and cease their efforts.
* **Mitigation**: Provide adequate sales training and resources. Ensure the product-market fit is strong, and adjust messaging or sales tactics as necessary. Consider implementing a minimum commission or base pay to reduce risk for salespeople.
3. **Poor User Experience or User Adoption**: If users don't find the product useful or easy to use, they won't adopt it, and the user base won't grow. This could also discourage salespeople and contributors.
* **Mitigation**: Prioritize user experience in the product development process. Regularly gather and incorporate user feedback. Ensure robust user support is in place.
4. **Inadequate Financial Incentives**: If the financial rewards don't justify the time and effort contributors and salespeople are putting in, they will likely disengage.
* **Mitigation**: Regularly review and adjust financial incentives as needed. Ensure that the method for calculating and distributing rewards is transparent and fair.
5. **Security and Compliance Risks**: As the user base grows and the software becomes more complex, the risk of security issues increases. Moreover, as contributors from various regions join, compliance with various international laws could become an issue.
* **Mitigation**: Establish strong security practices from the start. Regularly conduct security audits. Seek legal counsel to understand and adhere to international laws and regulations.
## Activation Plan for the Flywheel:
1. **Community Building**: Begin by fostering a supportive community around Swarms. Encourage early adopters to contribute and provide feedback. Create comprehensive documentation, community guidelines, and a forum for discussion and support.
2. **Sales and Development Training**: Provide resources and training for salespeople and developers. Make sure they understand the product, its value, and how to effectively contribute or sell.
3. **Increase Contributions and Sales Efforts**: Encourage increased participation by highlighting successful contributions and sales, rewarding top contributors and salespeople, and regularly communicating about the project's progress and impact.
4. **Iterate and Improve**: Continually gather and implement feedback to improve Swarms and its market reach. The better the product and its alignment with the market, the more the user base will grow.
5. **Expand User Base**: As the product improves and sales efforts continue, the user base should grow. Ensure you have the infrastructure to support this growth and maintain a positive user experience.
6. **Increase Financial Incentives**: As the user base and product grow, so too should the financial incentives. Make sure rewards continue to be competitive and attractive.
7. **Attract More Contributors and Salespeople**: As the financial incentives and success of the product increase, this should attract more contributors and salespeople, further feeding the flywheel.
Throughout this process, it's important to regularly reassess and adjust your strategy as necessary. Stay flexible and responsive to changes in the market, user feedback, and the evolving needs of the community.

@ -0,0 +1,14 @@
## Purpose
Artificial Intelligence has grown at an exponential rate over the past decade. Yet, we are far from fully harnessing its potential. Today's AI operates in isolation, each working separately in their corner. But life doesn't work like that. The world doesn't work like that. Success isn't built in silos; it's built in teams.
Imagine a world where AI models work in unison. Where they can collaborate, interact, and pool their collective intelligence to achieve more than any single model could. This is the future we envision. But today, we lack a framework for AI to collaborate effectively, to form a true swarm of intelligent agents.
This is a difficult problem, one that has eluded solution. It requires sophisticated systems that can allow individual models to not just communicate but also understand each other, pool knowledge and resources, and create collective intelligence. This is the next frontier of AI.
But here at Swarms, we have a secret sauce. It's not just a technology or a breakthrough invention. It's a way of thinking - the philosophy of rapid iteration. With each cycle, we make massive progress. We experiment, we learn, and we grow. We have developed a pioneering framework that can enable AI models to work together as a swarm, combining their strengths to create richer, more powerful outputs.
We are uniquely positioned to take on this challenge with 1,500+ devoted researchers in Agora. We have assembled a team of world-class experts, experienced and driven, united by a shared vision. Our commitment to breaking barriers, pushing boundaries, and our belief in the power of collective intelligence makes us the best team to usher in this future to fundamentally advance our species, Humanity.
---

@ -0,0 +1,225 @@
# The Golden Metric: 95% User-Task-Completion-Satisfaction Rate
In the world of Swarms, theres one metric that stands above the rest: the User-Task-Completion-Satisfaction (UTCS) rate. This metric is the heart of our system, the pulse that keeps us moving forward. Its not just a number; its a reflection of our commitment to our users and a measure of our success.
## What is the UTCS Rate?
The UTCS rate is a measure of how reliably and quickly Swarms can satisfy a user demand. Its calculated by dividing the number of tasks completed to the users satisfaction by the total number of tasks. Multiply that by 100, and youve got your UTCS rate.
But what does it mean to complete a task to the users satisfaction? It means that the task is not only completed, but completed in a way that meets or exceeds the users expectations. Its about quality, speed, and reliability.
## Why is the UTCS Rate Important?
The UTCS rate is a direct reflection of the user experience. A high UTCS rate means that users are getting what they need from Swarms, and theyre getting it quickly and reliably. It means that Swarms is doing its job, and doing it well.
But the UTCS rate is not just about user satisfaction. Its also a measure of Swarms efficiency and effectiveness. A high UTCS rate means that Swarms is able to complete tasks quickly and accurately, with minimal errors or delays. Its a sign of a well-oiled machine.
## How Do We Achieve a 95% UTCS Rate?
Achieving a 95% UTCS rate is no small feat. It requires a deep understanding of our users and their needs, a robust and reliable system, and a commitment to continuous improvement.
### Here are some strategies were implementing to reach our goal:
* Understanding User Needs: We must have agents that gain an understanding of the user's objective and break it up into it's most fundamental building blocks
* Improving System Reliability: Were working to make Swarms more reliable, reducing errors and improving the accuracy of task completion. This includes improving our algorithms, refining our processes, and investing in quality assurance.
* Optimizing for Speed: Were optimizing Swarms to complete tasks as quickly as possible, without sacrificing quality. This includes improving our infrastructure, streamlining our workflows, and implementing performance optimizations.
*Iterating and Improving: Were committed to continuous improvement. Were constantly monitoring our UTCS rate and other key metrics, and were always looking for ways to improve. Were not afraid to experiment, iterate, and learn from our mistakes.
Achieving a 95% UTCS rate is a challenging goal, but its a goal worth striving for. Its a goal that will drive us to improve, innovate, and deliver the best possible experience for our users. And in the end, thats what Swarms is all about.
# Your Feedback Matters: Help Us Optimize the UTCS Rate
As we initiate the journey of Swarms, we seek your feedback to better guide our growth and development. Your opinions and suggestions are crucial for us, helping to mold our product, pricing, branding, and a host of other facets that influence your experience.
## Your Insights on the UTCS Rate
Our goal is to maintain a UTCS (User-Task-Completion-Satisfaction) rate of 95%. This metric is integral to the success of Swarms, indicating the efficiency and effectiveness with which we satisfy user requests. However, it's a metric that we can't optimize alone - we need your help.
Here's what we want to understand from you:
1. **Satisfaction:** What does a "satisfactorily completed task" mean to you? Are there specific elements that contribute to a task being carried out to your satisfaction?
2. **Timeliness:** How important is speed in the completion of a task? What would you consider a reasonable timeframe for a task to be completed?
3. **Usability:** How intuitive and user-friendly do you find the Swarms platform? Are there any aspects of the platform that you believe could be enhanced?
4. **Reliability:** How much does consistency in performance matter to you? Can you share any experiences where Swarms either met or fell short of your expectations?
5. **Value for Money:** How do you perceive our pricing? Does the value Swarms provides align with the costs?
We invite you to share your experiences, thoughts, and ideas. Whether it's a simple suggestion or an in-depth critique, we appreciate and value your input.
## Your Feedback: The Backbone of our Growth
Your feedback is the backbone of Swarms' evolution. It drives us to refine our strategies, fuels our innovative spirit, and, most importantly, enables us to serve you better.
As we launch, we open the conversation around these key aspects of Swarms, and we look forward to understanding your expectations, your needs, and how we can deliver the best experience for you.
So, let's start this conversation - how can we make Swarms work best for you?
Guide Our Growth: Help Optimize Swarms
As we launch Swarms, your feedback is critical for enhancing our product, pricing, and branding. A key aim for us is a User-Task-Completion-Satisfaction (UTCS) rate of 95% - indicating our efficiency and effectiveness in meeting user needs. However, we need your insights to optimize this.
Here's what we're keen to understand:
Satisfaction: Your interpretation of a "satisfactorily completed task".
Timeliness: The importance of speed in task completion for you.
Usability: Your experiences with our platforms intuitiveness and user-friendliness.
Reliability: The significance of consistent performance to you.
Value for Money: Your thoughts on our pricing and value proposition.
We welcome your thoughts, experiences, and suggestions. Your feedback fuels our evolution, driving us to refine strategies, boost innovation, and enhance your experience.
Let's start the conversation - how can we make Swarms work best for you?
--------
**The Golden Metric Analysis: The Ultimate UTCS Paradigm for Swarms**
### Introduction
In our ongoing journey to perfect Swarms, understanding how our product fares in the eyes of the end-users is paramount. Enter the User-Task-Completion-Satisfaction (UTCS) rate - our primary metric that gauges how reliably and swiftly Swarms can meet user demands. As we steer Swarms towards achieving a UTCS rate of 95%, understanding this metric's core and how to refine it becomes vital.
### Decoding UTCS: An Analytical Overview
The UTCS rate is not merely about task completion; it's about the comprehensive experience. Therefore, its foundations lie in:
1. **Quality**: Ensuring tasks are executed flawlessly.
2. **Speed**: Delivering results in the shortest possible time.
3. **Reliability**: Consistency in quality and speed across all tasks.
We can represent the UTCS rate with the following equation:
```latex
\[ UTCS Rate = \frac{(Completed Tasks \times User Satisfaction)}{(Total Tasks)} \times 100 \]
```
Where:
- Completed Tasks refer to the number of tasks Swarms executes without errors.
- User Satisfaction is the subjective component, gauged through feedback mechanisms. This could be on a scale of 1-10 (or a percentage).
- Total Tasks refer to all tasks processed by Swarms, regardless of the outcome.
### The Golden Metric: Swarm Efficiency Index (SEI)
However, this basic representation doesn't factor in a critical component: system performance. Thus, we introduce the Swarm Efficiency Index (SEI). The SEI encapsulates not just the UTCS rate but also system metrics like memory consumption, number of tasks, and time taken. By blending these elements, we aim to present a comprehensive view of Swarm's prowess.
Heres the formula:
```latex
\[ SEI = \frac{UTCS Rate}{(Memory Consumption + Time Window + Task Complexity)} \]
```
Where:
- Memory Consumption signifies the system resources used to accomplish tasks.
- Time Window is the timeframe in which the tasks were executed.
- Task Complexity could be a normalized scale that defines how intricate a task is (e.g., 1-5, with 5 being the most complex).
Rationale:
- **Incorporating Memory Consumption**: A system that uses less memory but delivers results is more efficient. By inverting memory consumption in the formula, we emphasize that as memory usage goes down, SEI goes up.
- **Considering Time**: Time is of the essence. The faster the results without compromising quality, the better. By adding the Time Window, we emphasize that reduced task execution time increases the SEI.
- **Factoring in Task Complexity**: Not all tasks are equal. A system that effortlessly completes intricate tasks is more valuable. By integrating task complexity, we can normalize the SEI according to the task's nature.
### Implementing SEI & Improving UTCS
Using feedback from elder-plinius, we can better understand and improve SEI and UTCS:
1. **Feedback Across Skill Levels**: By gathering feedback from users with different skill levels, we can refine our metrics, ensuring Swarms caters to all.
2. **Simplifying Setup**: Detailed guides can help newcomers swiftly get on board, thus enhancing user satisfaction.
3. **Enhancing Workspace and Agent Management**: A clearer view of the Swarm's internal structure, combined with on-the-go adjustments, can improve both the speed and quality of results.
4. **Introducing System Suggestions**: A proactive Swarms that provides real-time insights and recommendations can drastically enhance user satisfaction, thus pushing up the UTCS rate.
### Conclusion
The UTCS rate is undeniably a pivotal metric for Swarms. However, with the introduction of the Swarm Efficiency Index (SEI), we have an opportunity to encapsulate a broader spectrum of performance indicators, leading to a more holistic understanding of Swarms' efficiency. By consistently optimizing for SEI, we can ensure that Swarms not only meets user expectations but also operates at peak system efficiency.
----------------
**Research Analysis: Tracking and Ensuring Reliability of Swarm Metrics at Scale**
### 1. Introduction
In our pursuit to optimize the User-Task-Completion-Satisfaction (UTCS) rate and Swarm Efficiency Index (SEI), reliable tracking of these metrics at scale becomes paramount. This research analysis delves into methodologies, technologies, and practices that can be employed to monitor these metrics accurately and efficiently across vast data sets.
### 2. Why Tracking at Scale is Challenging
The primary challenges include:
- **Volume of Data**: As Swarms grows, the data generated multiplies exponentially.
- **Variability of Data**: Diverse user inputs lead to myriad output scenarios.
- **System Heterogeneity**: Different configurations and deployments can yield variable results.
### 3. Strategies for Scalable Tracking
#### 3.1. Distributed Monitoring Systems
**Recommendation**: Implement distributed systems like Prometheus or InfluxDB.
**Rationale**:
- Ability to collect metrics from various Swarm instances concurrently.
- Scalable and can handle vast data influxes.
#### 3.2. Real-time Data Processing
**Recommendation**: Use stream processing systems like Apache Kafka or Apache Flink.
**Rationale**:
- Enables real-time metric calculation.
- Can handle high throughput and low-latency requirements.
#### 3.3. Data Sampling
**Recommendation**: Random or stratified sampling of user sessions.
**Rationale**:
- Reduces the data volume to be processed.
- Maintains representativeness of overall user experience.
### 4. Ensuring Reliability in Data Collection
#### 4.1. Redundancy
**Recommendation**: Integrate redundancy into data collection nodes.
**Rationale**:
- Ensures no single point of failure.
- Data loss prevention in case of system malfunctions.
#### 4.2. Anomaly Detection
**Recommendation**: Implement AI-driven anomaly detection systems.
**Rationale**:
- Identifies outliers or aberrations in metric calculations.
- Ensures consistent and reliable data interpretation.
#### 4.3. Data Validation
**Recommendation**: Establish automated validation checks.
**Rationale**:
- Ensures only accurate and relevant data is considered.
- Eliminates inconsistencies arising from corrupted or irrelevant data.
### 5. Feedback Loops and Continuous Refinement
#### 5.1. User Feedback Integration
**Recommendation**: Develop an in-built user feedback mechanism.
**Rationale**:
- Helps validate the perceived vs. actual performance.
- Allows for continuous refining of tracking metrics and methodologies.
#### 5.2. A/B Testing
**Recommendation**: Regularly conduct A/B tests for new tracking methods or adjustments.
**Rationale**:
- Determines the most effective methods for data collection.
- Validates new tracking techniques against established ones.
### 6. Conclusion
To successfully and reliably track the UTCS rate and SEI at scale, it's essential to combine robust monitoring tools, data processing methodologies, and validation techniques. By doing so, Swarms can ensure that the metrics collected offer a genuine reflection of system performance and user satisfaction. Regular feedback and iterative refinement, rooted in a culture of continuous improvement, will further enhance the accuracy and reliability of these essential metrics.

@ -6,4 +6,7 @@ class AbstractModel(ABC):
def generate(self, prompt):
#generate text using language model
pass
def chat(self, prompt, history):
pass
Loading…
Cancel
Save