The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework
<a href="https://pypi.org/project/swarms/" target="_blank">
<img alt="Python" src="https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54" />
<img alt="Version" src="https://img.shields.io/pypi/v/swarms?style=for-the-badge&color=3670A0">
</a>
🐦 Twitter • 📢 Discord • Swarms Platform • 📙 Documentation
| Category | Features | Benefits |
|---|---|---|
| 🏢 Enterprise Architecture | • Production-Ready Infrastructure |
• High Reliability Systems
• Modular Design
• Comprehensive Logging | • Reduced downtime
• Easier maintenance
• Better debugging
• Enhanced monitoring | | 🤖 Agent Orchestration | • Hierarchical Swarms
• Parallel Processing
• Sequential Workflows
• Graph-based Workflows
• Dynamic Agent Rearrangement | • Complex task handling
• Improved performance
• Flexible workflows
• Optimized execution | | 🔄 Integration Capabilities | • Multi-Model Support
• Custom Agent Creation
• Extensive Tool Library
• Multiple Memory Systems | • Provider flexibility
• Custom solutions
• Extended functionality
• Enhanced memory management | | 📈 Scalability | • Concurrent Processing
• Resource Management
• Load Balancing
• Horizontal Scaling | • Higher throughput
• Efficient resource use
• Better performance
• Easy scaling | | 🛠️ Developer Tools | • Simple API
• Extensive Documentation
• Active Community
• CLI Tools | • Faster development
• Easy learning curve
• Community support
• Quick deployment | | 🔐 Security Features | • Error Handling
• Rate Limiting
• Monitoring Integration
• Audit Logging | • Improved reliability
• API protection
• Better monitoring
• Enhanced tracking | | 📊 Advanced Features | • SpreadsheetSwarm
• Group Chat
• Agent Registry
• Mixture of Agents | • Mass agent management
• Collaborative AI
• Centralized control
• Complex solutions | | 🔌 Provider Support | • OpenAI
• Anthropic
• ChromaDB
• Custom Providers | • Provider flexibility
• Storage options
• Custom integration
• Vendor independence | | 💪 Production Features | • Automatic Retries
• Async Support
• Environment Management
• Type Safety | • Better reliability
• Improved performance
• Easy configuration
• Safer code | | 🎯 Use Case Support | • Task-Specific Agents
• Custom Workflows
• Industry Solutions
• Extensible Framework | • Quick deployment
• Flexible solutions
• Industry readiness
• Easy customization |
python3.10 or above!$ pip install -U swarms And, don't forget to install swarms!.env file with API keys from your providers like OPENAI_API_KEY, ANTHROPIC_API_KEY.env Variable with your desired workspace dir: WORKSPACE_DIR="agent_workspace" or do it in your terminal with export WORKSPACE_DIR="agent_workspace"swarms onboarding to get you started.Refer to our documentation for production grade implementation details.
| Section | Links |
|---|---|
| Installation | Installation |
| Quickstart | Get Started |
| Agent Internal Mechanisms | Agent Architecture |
| Agent API | Agent API |
| Integrating External Agents Griptape, Autogen, etc | Integrating External APIs |
| Creating Agents from YAML | Creating Agents from YAML |
| Why You Need Swarms | Why MultiAgent Collaboration is Necessary |
| Swarm Architectures Analysis | Swarm Architectures |
| Choosing the Right Swarm for Your Business Problem¶ | CLICK HERE |
| AgentRearrange Docs | CLICK HERE |
Install the following packages with copy and paste
$ pip3 install -U swarms swarm-models swarms-memory
Now that you have downloaded swarms with pip3 install -U swarms, we get access to the CLI. Get Onboarded with CLI Now with:
swarms onboarding
You can also run this command for help:
swarms help
For more documentation on the CLI CLICK HERE
Here are some example scripts to get you started. For more comprehensive documentation, visit our docs.
| Example Name | Description | Type of Examples | Link |
|---|---|---|---|
| Swarms Examples | A collection of simple examples to demonstrate Swarms capabilities. | Basic Usage | https://github.com/The-Swarm-Corporation/swarms-examples?tab=readme-ov-file |
| Cookbook | A comprehensive guide with recipes for various use cases and scenarios. | Advanced Usage | https://github.com/The-Swarm-Corporation/Cookbook |
Agent ClassThe Agent class is a fundamental component of the Swarms framework, designed to execute tasks autonomously. It fuses llms, tools and long-term memory capabilities to create a full stack agent. The Agent class is highly customizable, allowing for fine-grained control over its behavior and interactions.
run MethodThe run method is the primary entry point for executing tasks with an Agent instance. It accepts a task string as the main input task and processes it according to the agent's configuration. And, it can also accept an img parameter such as img="image_filepath.png to process images if you have a VLM attached such as GPT4VisionAPI
from swarms import Agent
agent = Agent(
agent_name="Stock-Analysis-Agent",
model_name="gpt-4o-mini",
max_loops="auto",
interactive=True,
streaming_on=True,
)
agent.run("What is the current market trend for tech stocks?")
The Agent class offers a range of settings to tailor its behavior to specific needs. Some key settings include:
| Setting | Description | Default Value |
|---|---|---|
agent_name |
The name of the agent. | "DefaultAgent" |
system_prompt |
The system prompt to use for the agent. | "Default system prompt." |
llm |
The language model to use for processing tasks. | OpenAIChat instance |
max_loops |
The maximum number of loops to execute for a task. | 1 |
autosave |
Enables or disables autosaving of the agent's state. | False |
dashboard |
Enables or disables the dashboard for the agent. | False |
verbose |
Controls the verbosity of the agent's output. | False |
dynamic_temperature_enabled |
Enables or disables dynamic temperature adjustment for the language model. | False |
saved_state_path |
The path to save the agent's state. | "agent_state.json" |
user_name |
The username associated with the agent. | "default_user" |
retry_attempts |
The number of retry attempts for failed tasks. | 1 |
context_length |
The maximum length of the context to consider for tasks. | 200000 |
return_step_meta |
Controls whether to return step metadata in the output. | False |
output_type |
The type of output to return (e.g., "json", "string"). | "string" |
import os
from swarms import Agent
from swarms.prompts.finance_agent_sys_prompt import (
FINANCIAL_AGENT_SYS_PROMPT,
)
# Initialize the agent
agent = Agent(
agent_name="Financial-Analysis-Agent",
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
model_name="gpt-4o-mini",
max_loops=1,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="finance_agent.json",
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
return_step_meta=False,
output_type="string",
streaming_on=False,
)
agent.run(
"How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria"
)
Agent equipped with quasi-infinite long term memory using RAG (Relational Agent Graph) for advanced document understanding, analysis, and retrieval capabilities.
Mermaid Diagram for RAG Integration
graph TD
A[Initialize Agent with RAG] --> B[Receive Task]
B --> C[Query Long-Term Memory]
C --> D[Process Task with Context]
D --> E[Generate Response]
E --> F[Update Long-Term Memory]
F --> G[Return Output]
```python from swarms import Agent from swarms.prompts.finance_agent_sys_prompt import ( FINANCIAL_AGENT_SYS_PROMPT, ) import os
from swarms_memory import ChromaDB
chromadb = ChromaDB( metric="cosine", # Metric for similarity measurement output_dir="finance_agent_rag", # Directory for storing RAG data # docs_folder="artifacts", # Uncomment and specify the folder containing yo
$ claude mcp add swarms \
-- python -m otcore.mcp_server <graph>