swarms 7.8.9__py3-none-any.whl → 7.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2119 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarms
3
- Version: 7.8.9
4
- Summary: Swarms - TGSC
5
- License: MIT
6
- Keywords: artificial intelligence,deep learning,optimizers,Prompt Engineering,swarms,agents,llms,transformers,multi-agent,swarms of agents,Enterprise-Grade Agents,Production-Grade Agents,Agents,Multi-Grade-Agents,Swarms,Transformers,LLMs,Prompt Engineering,Agents,Generative Agents,Generative AI,Agent Marketplace,Agent Store,quant,finance,algorithmic trading,portfolio optimization,risk management,financial modeling,machine learning for finance,natural language processing for finance
7
- Author: Kye Gomez
8
- Author-email: kye@apac.ai
9
- Requires-Python: >=3.10,<4.0
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
18
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
- Requires-Dist: PyYAML
20
- Requires-Dist: aiofiles
21
- Requires-Dist: aiohttp
22
- Requires-Dist: asyncio (>=3.4.3,<4.0)
23
- Requires-Dist: docstring_parser (==0.16)
24
- Requires-Dist: httpx
25
- Requires-Dist: litellm
26
- Requires-Dist: loguru
27
- Requires-Dist: mcp
28
- Requires-Dist: networkx
29
- Requires-Dist: numpy
30
- Requires-Dist: psutil
31
- Requires-Dist: pydantic
32
- Requires-Dist: pypdf (==5.1.0)
33
- Requires-Dist: python-dotenv
34
- Requires-Dist: rich
35
- Requires-Dist: setuptools
36
- Requires-Dist: tenacity
37
- Requires-Dist: toml
38
- Requires-Dist: torch
39
- Project-URL: Documentation, https://docs.swarms.world
40
- Project-URL: Homepage, https://github.com/kyegomez/swarms
41
- Project-URL: Repository, https://github.com/kyegomez/swarms
42
- Description-Content-Type: text/markdown
43
-
44
- <div align="center">
45
- <a href="https://swarms.world">
46
- <img src="https://github.com/kyegomez/swarms/blob/master/images/swarmslogobanner.png" style="margin: 15px; max-width: 500px" width="50%" alt="Logo">
47
- </a>
48
- </div>
49
- <p align="center">
50
- <em>The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework </em>
51
- </p>
52
-
53
- <p align="center">
54
- <a href="https://pypi.org/project/swarms/" target="_blank">
55
- <img alt="Python" src="https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54" />
56
- <img alt="Version" src="https://img.shields.io/pypi/v/swarms?style=for-the-badge&color=3670A0">
57
- </a>
58
- </p>
59
-
60
- <p align="center">
61
- <a href="https://twitter.com/swarms_corp/">🐦 Twitter</a>
62
- <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
63
- <a href="https://discord.gg/jM3Z6M9uMq">📢 Discord</a>
64
- <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
65
- <a href="https://swarms.ai">Swarms Website</a>
66
- <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
67
- <a href="https://docs.swarms.world">📙 Documentation</a>
68
- <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
69
- <a href="https://swarms.world"> Swarms Marketplace</a>
70
- </p>
71
-
72
- <p align="center">
73
- <!-- Social Media -->
74
- <a href="https://discord.gg/jHnrkH5y">
75
- <img src="https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord">
76
- </a>
77
- <a href="https://www.youtube.com/@kyegomez3242">
78
- <img src="https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white" alt="YouTube">
79
- </a>
80
- <a href="https://www.linkedin.com/in/kye-g-38759a207/">
81
- <img src="https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn">
82
- </a>
83
- <a href="https://x.com/swarms_corp">
84
- <img src="https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white" alt="X.com">
85
- </a>
86
- </p>
87
-
88
- <p align="center">
89
- <!-- Project Stats -->
90
- <a href="https://github.com/kyegomez/swarms/issues">
91
- <img src="https://img.shields.io/github/issues/kyegomez/swarms" alt="GitHub issues">
92
- </a>
93
- <a href="https://github.com/kyegomez/swarms/network">
94
- <img src="https://img.shields.io/github/forks/kyegomez/swarms" alt="GitHub forks">
95
- </a>
96
- <a href="https://github.com/kyegomez/swarms/stargazers">
97
- <img src="https://img.shields.io/github/stars/kyegomez/swarms" alt="GitHub stars">
98
- </a>
99
- <a href="https://github.com/kyegomez/swarms/blob/main/LICENSE">
100
- <img src="https://img.shields.io/github/license/kyegomez/swarms" alt="GitHub license">
101
- </a>
102
- <a href="https://star-history.com/#kyegomez/swarms">
103
- <img src="https://img.shields.io/github/stars/kyegomez/swarms?style=social" alt="GitHub star chart">
104
- </a>
105
- <a href="https://libraries.io/github/kyegomez/swarms">
106
- <img src="https://img.shields.io/librariesio/github/kyegomez/swarms" alt="Dependency Status">
107
- </a>
108
- <a href="https://pepy.tech/project/swarms">
109
- <img src="https://static.pepy.tech/badge/swarms/month" alt="Downloads">
110
- </a>
111
- </p>
112
-
113
- <p align="center">
114
- <!-- Share Buttons -->
115
- <a href="https://twitter.com/intent/tweet?text=Check%20out%20this%20amazing%20AI%20project:%20&url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms">
116
- <img src="https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Share%20%40kyegomez/swarms" alt="Share on Twitter">
117
- </a>
118
- <a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms">
119
- <img src="https://img.shields.io/badge/Share-%20facebook-blue" alt="Share on Facebook">
120
- </a>
121
- <a href="https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&title=&summary=&source=">
122
- <img src="https://img.shields.io/badge/Share-%20linkedin-blue" alt="Share on LinkedIn">
123
- </a>
124
- </p>
125
-
126
- <p align="center">
127
- <!-- Additional Share Buttons -->
128
- <a href="https://www.reddit.com/submit?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&title=Swarms%20-%20the%20future%20of%20AI">
129
- <img src="https://img.shields.io/badge/-Share%20on%20Reddit-orange" alt="Share on Reddit">
130
- </a>
131
- <a href="https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&t=Swarms%20-%20the%20future%20of%20AI">
132
- <img src="https://img.shields.io/badge/-Share%20on%20Hacker%20News-orange" alt="Share on Hacker News">
133
- </a>
134
- <a href="https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&media=https%3A%2F%2Fexample.com%2Fimage.jpg&description=Swarms%20-%20the%20future%20of%20AI">
135
- <img src="https://img.shields.io/badge/-Share%20on%20Pinterest-red" alt="Share on Pinterest">
136
- </a>
137
- <a href="https://api.whatsapp.com/send?text=Check%20out%20Swarms%20-%20the%20future%20of%20AI%20%23swarms%20%23AI%0A%0Ahttps%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms">
138
- <img src="https://img.shields.io/badge/-Share%20on%20WhatsApp-green" alt="Share on WhatsApp">
139
- </a>
140
- </p>
141
-
142
- ## ✨ Features
143
-
144
- | Category | Features | Benefits |
145
- |----------|----------|-----------|
146
- | 🏢 Enterprise Architecture | • Production-Ready Infrastructure<br>• High Reliability Systems<br>• Modular Design<br>• Comprehensive Logging | • Reduced downtime<br>• Easier maintenance<br>• Better debugging<br>• Enhanced monitoring |
147
- | 🤖 Agent Orchestration | • Hierarchical Swarms<br>• Parallel Processing<br>• Sequential Workflows<br>• Graph-based Workflows<br>• Dynamic Agent Rearrangement | • Complex task handling<br>• Improved performance<br>• Flexible workflows<br>• Optimized execution |
148
- | 🔄 Integration Capabilities | • Multi-Model Support<br>• Custom Agent Creation<br>• Extensive Tool Library<br>• Multiple Memory Systems | • Provider flexibility<br>• Custom solutions<br>• Extended functionality<br>• Enhanced memory management |
149
- | 📈 Scalability | • Concurrent Processing<br>• Resource Management<br>• Load Balancing<br>• Horizontal Scaling | • Higher throughput<br>• Efficient resource use<br>• Better performance<br>• Easy scaling |
150
- | 🛠️ Developer Tools | • Simple API<br>• Extensive Documentation<br>• Active Community<br>• CLI Tools | • Faster development<br>• Easy learning curve<br>• Community support<br>• Quick deployment |
151
- | 🔐 Security Features | • Error Handling<br>• Rate Limiting<br>• Monitoring Integration<br>• Audit Logging | • Improved reliability<br>• API protection<br>• Better monitoring<br>• Enhanced tracking |
152
- | 📊 Advanced Features | • SpreadsheetSwarm<br>• Group Chat<br>• Agent Registry<br>• Mixture of Agents | • Mass agent management<br>• Collaborative AI<br>• Centralized control<br>• Complex solutions |
153
- | 🔌 Provider Support | • OpenAI<br>• Anthropic<br>• ChromaDB<br>• Custom Providers | • Provider flexibility<br>• Storage options<br>• Custom integration<br>• Vendor independence |
154
- | 💪 Production Features | • Automatic Retries<br>• Async Support<br>• Environment Management<br>• Type Safety | • Better reliability<br>• Improved performance<br>• Easy configuration<br>• Safer code |
155
- | 🎯 Use Case Support | • Task-Specific Agents<br>• Custom Workflows<br>• Industry Solutions<br>• Extensible Framework | • Quick deployment<br>• Flexible solutions<br>• Industry readiness<br>• Easy customization |
156
-
157
-
158
- ## Guides and Walkthroughs
159
- Refer to our documentation for production grade implementation details.
160
-
161
-
162
- | Section | Links |
163
- |----------------------|--------------------------------------------------------------------------------------------|
164
- | Installation | [Installation](https://docs.swarms.world/en/latest/swarms/install/install/) |
165
- | Quickstart | [Get Started](https://docs.swarms.world/en/latest/swarms/install/quickstart/) |
166
- | Agent Internal Mechanisms | [Agent Architecture](https://docs.swarms.world/en/latest/swarms/framework/agents_explained/) |
167
- | Agent API | [Agent API](https://docs.swarms.world/en/latest/swarms/structs/agent/) |
168
- | Integrating External Agents Griptape, Autogen, etc | [Integrating External APIs](https://docs.swarms.world/en/latest/swarms/agents/external_party_agents/) |
169
- | Creating Agents from YAML | [Creating Agents from YAML](https://docs.swarms.world/en/latest/swarms/agents/create_agents_yaml/) |
170
- | Why You Need Swarms | [Why MultiAgent Collaboration is Necessary](https://docs.swarms.world/en/latest/swarms/concept/why/) |
171
- | Swarm Architectures Analysis | [Swarm Architectures](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/) |
172
- | Choosing the Right Swarm for Your Business Problem¶ | [CLICK HERE](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/) |
173
- | AgentRearrange Docs| [CLICK HERE](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/) |
174
-
175
-
176
- ## Install 💻
177
-
178
- ### Using pip
179
- ```bash
180
- $ pip3 install -U swarms
181
- ```
182
-
183
- ### Using uv (Recommended)
184
- [uv](https://github.com/astral-sh/uv) is a fast Python package installer and resolver, written in Rust.
185
-
186
- ```bash
187
- # Install uv
188
- $ curl -LsSf https://astral.sh/uv/install.sh | sh
189
-
190
- # Install swarms using uv
191
- $ uv pip install swarms
192
- ```
193
-
194
- ### Using poetry
195
- ```bash
196
- # Install poetry if you haven't already
197
- $ curl -sSL https://install.python-poetry.org | python3 -
198
-
199
- # Add swarms to your project
200
- $ poetry add swarms
201
- ```
202
-
203
- ### From source
204
- ```bash
205
- # Clone the repository
206
- $ git clone https://github.com/kyegomez/swarms.git
207
- $ cd swarms
208
-
209
- # Install with pip
210
- $ pip install -e .
211
- ```
212
-
213
- ---
214
-
215
- ## Environment Configuration
216
-
217
- ```
218
- OPENAI_API_KEY=""
219
- WORKSPACE_DIR="agent_workspace"
220
- ANTHROPIC_API_KEY=""
221
- GROQ_API_KEY=""
222
- ```
223
-
224
- - [Learn more about the environment configuration here](https://docs.swarms.world/en/latest/swarms/install/env/)
225
-
226
- ---
227
-
228
- ## `Agent` Class
229
- The `Agent` class is a customizable autonomous component of the Swarms framework that integrates LLMs, tools, and long-term memory. Its `run` method processes text tasks and optionally handles image inputs through vision-language models.
230
-
231
-
232
- ```mermaid
233
- graph TD
234
- A[Agent] --> B[Initialize]
235
- B --> C[Process Task]
236
- C --> D[Execute Tools]
237
- D --> E[Generate Response]
238
- E --> F[Return Output]
239
- C --> G[Long-term Memory]
240
- G --> C
241
- ```
242
-
243
-
244
-
245
-
246
- ## Simple Example
247
-
248
- ```python
249
- from swarms import Agent
250
-
251
- agent = Agent(
252
- agent_name="Stock-Analysis-Agent",
253
- model_name="gpt-4o-mini",
254
- max_loops="auto",
255
- interactive=True,
256
- streaming_on=True,
257
- )
258
-
259
- agent.run("What is the current market trend for tech stocks?")
260
-
261
- ```
262
-
263
- ### Settings and Customization
264
-
265
- The `Agent` class offers a range of settings to tailor its behavior to specific needs. Some key settings include:
266
-
267
- | Setting | Description | Default Value |
268
- | --- | --- | --- |
269
- | `agent_name` | The name of the agent. | "DefaultAgent" |
270
- | `system_prompt` | The system prompt to use for the agent. | "Default system prompt." |
271
- | `llm` | The language model to use for processing tasks. | `OpenAIChat` instance |
272
- | `max_loops` | The maximum number of loops to execute for a task. | 1 |
273
- | `autosave` | Enables or disables autosaving of the agent's state. | False |
274
- | `dashboard` | Enables or disables the dashboard for the agent. | False |
275
- | `verbose` | Controls the verbosity of the agent's output. | False |
276
- | `dynamic_temperature_enabled` | Enables or disables dynamic temperature adjustment for the language model. | False |
277
- | `saved_state_path` | The path to save the agent's state. | "agent_state.json" |
278
- | `user_name` | The username associated with the agent. | "default_user" |
279
- | `retry_attempts` | The number of retry attempts for failed tasks. | 1 |
280
- | `context_length` | The maximum length of the context to consider for tasks. | 200000 |
281
- | `return_step_meta` | Controls whether to return step metadata in the output. | False |
282
- | `output_type` | The type of output to return (e.g., "json", "string"). | "string" |
283
-
284
-
285
- ```python
286
- import os
287
- from swarms import Agent
288
-
289
- from swarms.prompts.finance_agent_sys_prompt import (
290
- FINANCIAL_AGENT_SYS_PROMPT,
291
- )
292
- # Initialize the agent
293
- agent = Agent(
294
- agent_name="Financial-Analysis-Agent",
295
- system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
296
- model_name="gpt-4o-mini",
297
- max_loops=1,
298
- autosave=True,
299
- dashboard=False,
300
- verbose=True,
301
- dynamic_temperature_enabled=True,
302
- saved_state_path="finance_agent.json",
303
- user_name="swarms_corp",
304
- retry_attempts=1,
305
- context_length=200000,
306
- return_step_meta=False,
307
- output_type="string",
308
- streaming_on=False,
309
- )
310
-
311
-
312
- agent.run(
313
- "How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria"
314
- )
315
-
316
- ```
317
- -----
318
-
319
- ### Integrating RAG with Swarms for Enhanced Long-Term Memory
320
-
321
- `Agent` equipped with quasi-infinite long term memory using RAG (Relational Agent Graph) for advanced document understanding, analysis, and retrieval capabilities.
322
-
323
- **Mermaid Diagram for RAG Integration**
324
- ```mermaid
325
- graph TD
326
- A[Initialize Agent with RAG] --> B[Receive Task]
327
- B --> C[Query Long-Term Memory]
328
- C --> D[Process Task with Context]
329
- D --> E[Generate Response]
330
- E --> F[Update Long-Term Memory]
331
- F --> G[Return Output]
332
- ```
333
-
334
- ```python
335
- from swarms import Agent
336
- from swarms.prompts.finance_agent_sys_prompt import (
337
- FINANCIAL_AGENT_SYS_PROMPT,
338
- )
339
- import os
340
-
341
- from swarms_memory import ChromaDB
342
-
343
- # Initialize the ChromaDB client for long-term memory management
344
- chromadb = ChromaDB(
345
- metric="cosine", # Metric for similarity measurement
346
- output_dir="finance_agent_rag", # Directory for storing RAG data
347
- # docs_folder="artifacts", # Uncomment and specify the folder containing your documents
348
- )
349
-
350
- # Initialize the agent with RAG capabilities
351
- agent = Agent(
352
- agent_name="Financial-Analysis-Agent",
353
- system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
354
- agent_description="Agent creates a comprehensive financial analysis",
355
- model_name="gpt-4o-mini",
356
- max_loops="auto", # Auto-adjusts loops based on task complexity
357
- autosave=True, # Automatically saves agent state
358
- dashboard=False, # Disables dashboard for this example
359
- verbose=True, # Enables verbose mode for detailed output
360
- streaming_on=True, # Enables streaming for real-time processing
361
- dynamic_temperature_enabled=True, # Dynamically adjusts temperature for optimal performance
362
- saved_state_path="finance_agent.json", # Path to save agent state
363
- user_name="swarms_corp", # User name for the agent
364
- retry_attempts=3, # Number of retry attempts for failed tasks
365
- context_length=200000, # Maximum length of the context to consider
366
- long_term_memory=chromadb, # Integrates ChromaDB for long-term memory management
367
- return_step_meta=False,
368
- output_type="string",
369
- )
370
-
371
- # Run the agent with a sample task
372
- agent.run(
373
- "What are the components of a startup's stock incentive equity plan"
374
- )
375
- ```
376
-
377
-
378
- ## Structured Outputs
379
-
380
- 1. Create a tool schema
381
- 2. Create a function schema
382
- 3. Create a tool list dictionary
383
- 4. Initialize the agent
384
- 5. Run the agent
385
- 6. Print the output
386
- 7. Convert the output to a dictionary
387
-
388
- ```python
389
-
390
- from dotenv import load_dotenv
391
-
392
- from swarms import Agent
393
- from swarms.prompts.finance_agent_sys_prompt import (
394
- FINANCIAL_AGENT_SYS_PROMPT,
395
- )
396
- from swarms.utils.str_to_dict import str_to_dict
397
-
398
- load_dotenv()
399
-
400
- tools = [
401
- {
402
- "type": "function",
403
- "function": {
404
- "name": "get_stock_price",
405
- "description": "Retrieve the current stock price and related information for a specified company.",
406
- "parameters": {
407
- "type": "object",
408
- "properties": {
409
- "ticker": {
410
- "type": "string",
411
- "description": "The stock ticker symbol of the company, e.g. AAPL for Apple Inc.",
412
- },
413
- "include_history": {
414
- "type": "boolean",
415
- "description": "Indicates whether to include historical price data along with the current price.",
416
- },
417
- "time": {
418
- "type": "string",
419
- "format": "date-time",
420
- "description": "Optional parameter to specify the time for which the stock data is requested, in ISO 8601 format.",
421
- },
422
- },
423
- "required": [
424
- "ticker",
425
- "include_history",
426
- "time",
427
- ],
428
- },
429
- },
430
- }
431
- ]
432
-
433
-
434
- # Initialize the agent
435
- agent = Agent(
436
- agent_name="Financial-Analysis-Agent",
437
- agent_description="Personal finance advisor agent",
438
- system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
439
- max_loops=1,
440
- tools_list_dictionary=tools,
441
- )
442
-
443
- out = agent.run(
444
- "What is the current stock price for Apple Inc. (AAPL)? Include historical price data.",
445
- )
446
-
447
- print(out)
448
-
449
- print(type(out))
450
-
451
- print(str_to_dict(out))
452
-
453
- print(type(str_to_dict(out)))
454
- ```
455
-
456
- -------
457
-
458
- ### Misc Agent Settings
459
- We provide vast array of features to save agent states using json, yaml, toml, upload pdfs, batched jobs, and much more!
460
-
461
-
462
- **Method Table**
463
-
464
- | Method | Description |
465
- | --- | --- |
466
- | `to_dict()` | Converts the agent object to a dictionary. |
467
- | `to_toml()` | Converts the agent object to a TOML string. |
468
- | `model_dump_json()` | Dumps the model to a JSON file. |
469
- | `model_dump_yaml()` | Dumps the model to a YAML file. |
470
- | `ingest_docs()` | Ingests documents into the agent's knowledge base. |
471
- | `receive_message()` | Receives a message from a user and processes it. |
472
- | `send_agent_message()` | Sends a message from the agent to a user. |
473
- | `filtered_run()` | Runs the agent with a filtered system prompt. |
474
- | `bulk_run()` | Runs the agent with multiple system prompts. |
475
- | `add_memory()` | Adds a memory to the agent. |
476
- | `check_available_tokens()` | Checks the number of available tokens for the agent. |
477
- | `tokens_checks()` | Performs token checks for the agent. |
478
- | `print_dashboard()` | Prints the dashboard of the agent. |
479
- | `get_docs_from_doc_folders()` | Fetches all the documents from the doc folders. |
480
-
481
-
482
-
483
- ```python
484
- # # Convert the agent object to a dictionary
485
- print(agent.to_dict())
486
- print(agent.to_toml())
487
- print(agent.model_dump_json())
488
- print(agent.model_dump_yaml())
489
-
490
- # Ingest documents into the agent's knowledge base
491
- ("your_pdf_path.pdf")
492
-
493
- # Receive a message from a user and process it
494
- agent.receive_message(name="agent_name", message="message")
495
-
496
- # Send a message from the agent to a user
497
- agent.send_agent_message(agent_name="agent_name", message="message")
498
-
499
- # Ingest multiple documents into the agent's knowledge base
500
- agent.ingest_docs("your_pdf_path.pdf", "your_csv_path.csv")
501
-
502
- # Run the agent with a filtered system prompt
503
- agent.filtered_run(
504
- "How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?"
505
- )
506
-
507
- # Run the agent with multiple system prompts
508
- agent.bulk_run(
509
- [
510
- "How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?",
511
- "Another system prompt",
512
- ]
513
- )
514
-
515
- # Add a memory to the agent
516
- agent.add_memory("Add a memory to the agent")
517
-
518
- # Check the number of available tokens for the agent
519
- agent.check_available_tokens()
520
-
521
- # Perform token checks for the agent
522
- agent.tokens_checks()
523
-
524
- # Print the dashboard of the agent
525
- agent.print_dashboard()
526
-
527
- # Fetch all the documents from the doc folders
528
- agent.get_docs_from_doc_folders()
529
-
530
- # Activate agent ops
531
-
532
- # Dump the model to a JSON file
533
- agent.model_dump_json()
534
- print(agent.to_toml())
535
-
536
- ```
537
-
538
-
539
-
540
- ### `Agent`with Pydantic BaseModel as Output Type
541
- The following is an example of an agent that intakes a pydantic basemodel and outputs it at the same time:
542
-
543
- ```python
544
- from pydantic import BaseModel, Field
545
- from swarms import Agent
546
-
547
-
548
- # Initialize the schema for the person's information
549
- class Schema(BaseModel):
550
- name: str = Field(..., title="Name of the person")
551
- agent: int = Field(..., title="Age of the person")
552
- is_student: bool = Field(..., title="Whether the person is a student")
553
- courses: list[str] = Field(
554
- ..., title="List of courses the person is taking"
555
- )
556
-
557
-
558
- # Convert the schema to a JSON string
559
- tool_schema = Schema(
560
- name="Tool Name",
561
- agent=1,
562
- is_student=True,
563
- courses=["Course1", "Course2"],
564
- )
565
-
566
- # Define the task to generate a person's information
567
- task = "Generate a person's information based on the following schema:"
568
-
569
- # Initialize the agent
570
- agent = Agent(
571
- agent_name="Person Information Generator",
572
- system_prompt=(
573
- "Generate a person's information based on the following schema:"
574
- ),
575
- # Set the tool schema to the JSON string -- this is the key difference
576
- tool_schema=tool_schema,
577
- model_name="gpt-4o",
578
- max_loops=3,
579
- autosave=True,
580
- dashboard=False,
581
- streaming_on=True,
582
- verbose=True,
583
- interactive=True,
584
- # Set the output type to the tool schema which is a BaseModel
585
- output_type=tool_schema, # or dict, or str
586
- metadata_output_type="json",
587
- # List of schemas that the agent can handle
588
- list_base_models=[tool_schema],
589
- function_calling_format_type="OpenAI",
590
- function_calling_type="json", # or soon yaml
591
- )
592
-
593
- # Run the agent to generate the person's information
594
- generated_data = agent.run(task)
595
-
596
- # Print the generated data
597
- print(f"Generated data: {generated_data}")
598
-
599
-
600
- ```
601
-
602
- ### Multi Modal Autonomous Agent
603
- Run the agent with multiple modalities useful for various real-world tasks in manufacturing, logistics, and health.
604
-
605
- ```python
606
- import os
607
- from dotenv import load_dotenv
608
- from swarms import Agent
609
-
610
- from swarm_models import GPT4VisionAPI
611
-
612
- # Load the environment variables
613
- load_dotenv()
614
-
615
-
616
- # Initialize the language model
617
- llm = GPT4VisionAPI(
618
- openai_api_key=os.environ.get("OPENAI_API_KEY"),
619
- max_tokens=500,
620
- )
621
-
622
- # Initialize the task
623
- task = (
624
- "Analyze this image of an assembly line and identify any issues such as"
625
- " misaligned parts, defects, or deviations from the standard assembly"
626
- " process. If there is anything unsafe in the image, explain why it is"
627
- " unsafe and how it could be improved."
628
- )
629
- img = "assembly_line.jpg"
630
-
631
- ## Initialize the workflow
632
- agent = Agent(
633
- agent_name = "Multi-ModalAgent",
634
- llm=llm,
635
- max_loops="auto",
636
- autosave=True,
637
- dashboard=True,
638
- multi_modal=True
639
- )
640
-
641
- # Run the workflow on a task
642
- agent.run(task, img)
643
- ```
644
- ----
645
-
646
-
647
- ### Local Agent `ToolAgent`
648
- ToolAgent is a fully local agent that can use tools through JSON function calling. It intakes any open source model from huggingface and is extremely modular and plug in and play. We need help adding general support to all models soon.
649
-
650
-
651
- ```python
652
- from pydantic import BaseModel, Field
653
- from transformers import AutoModelForCausalLM, AutoTokenizer
654
-
655
- from swarms import ToolAgent
656
- from swarms.tools.json_utils import base_model_to_json
657
-
658
- # Load the pre-trained model and tokenizer
659
- model = AutoModelForCausalLM.from_pretrained(
660
- "databricks/dolly-v2-12b",
661
- load_in_4bit=True,
662
- device_map="auto",
663
- )
664
- tokenizer = AutoTokenizer.from_pretrained("databricks/dolly-v2-12b")
665
-
666
-
667
- # Initialize the schema for the person's information
668
- class Schema(BaseModel):
669
- name: str = Field(..., title="Name of the person")
670
- agent: int = Field(..., title="Age of the person")
671
- is_student: bool = Field(
672
- ..., title="Whether the person is a student"
673
- )
674
- courses: list[str] = Field(
675
- ..., title="List of courses the person is taking"
676
- )
677
-
678
-
679
- # Convert the schema to a JSON string
680
- tool_schema = base_model_to_json(Schema)
681
-
682
- # Define the task to generate a person's information
683
- task = (
684
- "Generate a person's information based on the following schema:"
685
- )
686
-
687
- # Create an instance of the ToolAgent class
688
- agent = ToolAgent(
689
- name="dolly-function-agent",
690
- description="An agent to create a child's data",
691
- model=model,
692
- tokenizer=tokenizer,
693
- json_schema=tool_schema,
694
- )
695
-
696
- # Run the agent to generate the person's information
697
- generated_data = agent.run(task)
698
-
699
- # Print the generated data
700
- print(f"Generated data: {generated_data}")
701
-
702
- ```
703
-
704
-
705
- ## Understanding Swarms
706
-
707
- A swarm refers to a group of more than two agents working collaboratively to achieve a common goal. These agents can be software entities, such as llms that interact with each other to perform complex tasks. The concept of a swarm is inspired by natural systems like ant colonies or bird flocks, where simple individual behaviors lead to complex group dynamics and problem-solving capabilities.
708
-
709
- ```mermaid
710
- graph TD
711
- A[Swarm] --> B[Agent 1]
712
- A --> C[Agent 2]
713
- A --> D[Agent N]
714
- B --> E[Task Processing]
715
- C --> E
716
- D --> E
717
- E --> F[Result Aggregation]
718
- F --> G[Final Output]
719
- ```
720
-
721
- ### How Swarm Architectures Facilitate Communication
722
-
723
- Swarm architectures are designed to establish and manage communication between agents within a swarm. These architectures define how agents interact, share information, and coordinate their actions to achieve the desired outcomes. Here are some key aspects of swarm architectures:
724
-
725
- 1. **Hierarchical Communication**: In hierarchical swarms, communication flows from higher-level agents to lower-level agents. Higher-level agents act as coordinators, distributing tasks and aggregating results. This structure is efficient for tasks that require top-down control and decision-making.
726
-
727
- 2. **Parallel Communication**: In parallel swarms, agents operate independently and communicate with each other as needed. This architecture is suitable for tasks that can be processed concurrently without dependencies, allowing for faster execution and scalability.
728
-
729
- 3. **Sequential Communication**: Sequential swarms process tasks in a linear order, where each agent's output becomes the input for the next agent. This ensures that tasks with dependencies are handled in the correct sequence, maintaining the integrity of the workflow.
730
-
731
- ```mermaid
732
- graph LR
733
- A[Hierarchical] --> D[Task Distribution]
734
- B[Parallel] --> E[Concurrent Processing]
735
- C[Sequential] --> F[Linear Processing]
736
- D --> G[Results]
737
- E --> G
738
- F --> G
739
- ```
740
-
741
- Swarm architectures leverage these communication patterns to ensure that agents work together efficiently, adapting to the specific requirements of the task at hand. By defining clear communication protocols and interaction models, swarm architectures enable the seamless orchestration of multiple agents, leading to enhanced performance and problem-solving capabilities.
742
-
743
-
744
- | **Name** | **Description** | **Code Link** | **Use Cases** |
745
- |-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
746
- | Hierarchical Swarms | A system where agents are organized in a hierarchy, with higher-level agents coordinating lower-level agents to achieve complex tasks. | [Code Link](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/#hierarchical-swarm) | Manufacturing process optimization, multi-level sales management, healthcare resource coordination |
747
- | Agent Rearrange | A setup where agents rearrange themselves dynamically based on the task requirements and environmental conditions. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/) | Adaptive manufacturing lines, dynamic sales territory realignment, flexible healthcare staffing |
748
- | Concurrent Workflows | Agents perform different tasks simultaneously, coordinating to complete a larger goal. | [Code Link](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/#concurrent-workflows) | Concurrent production lines, parallel sales operations, simultaneous patient care processes |
749
- | Sequential Coordination | Agents perform tasks in a specific sequence, where the completion of one task triggers the start of the next. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/sequential_workflow/) | Step-by-step assembly lines, sequential sales processes, stepwise patient treatment workflows |
750
- | Parallel Processing | Agents work on different parts of a task simultaneously to speed up the overall process. | [Code Link](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/#parallel-processing) | Parallel data processing in manufacturing, simultaneous sales analytics, concurrent medical tests |
751
- | Mixture of Agents | A heterogeneous swarm where agents with different capabilities are combined to solve complex problems. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/moa/) | Financial forecasting, complex problem-solving requiring diverse skills |
752
- | Graph Workflow | Agents collaborate in a directed acyclic graph (DAG) format to manage dependencies and parallel tasks. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/graph_workflow/) | AI-driven software development pipelines, complex project management |
753
- | Group Chat | Agents engage in a chat-like interaction to reach decisions collaboratively. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/group_chat/) | Real-time collaborative decision-making, contract negotiations |
754
- | Agent Registry | A centralized registry where agents are stored, retrieved, and invoked dynamically. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/agent_registry/) | Dynamic agent management, evolving recommendation engines |
755
- | Spreadsheet Swarm | Manages tasks at scale, tracking agent outputs in a structured format like CSV files. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/spreadsheet_swarm/) | Large-scale marketing analytics, financial audits |
756
- | Forest Swarm | A swarm structure that organizes agents in a tree-like hierarchy for complex decision-making processes. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/forest_swarm/) | Multi-stage workflows, hierarchical reinforcement learning |
757
- | Swarm Router | Routes and chooses the swarm architecture based on the task requirements and available agents. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/swarm_router/) | Dynamic task routing, adaptive swarm architecture selection, optimized agent allocation |
758
-
759
-
760
-
761
- ## Swarms API
762
-
763
- We recently launched our enterprise-grade Swarms API. This API allows you to create, manage, and execute swarms from your own application.
764
-
765
- #### Steps:
766
-
767
- 1. Create a Swarms API key [HERE](https://swarms.world)
768
- 2. Upload your key to the `.env` file like so: `SWARMS_API_KEY=<your-api-key>`
769
- 3. Use the following code to create and execute a swarm:
770
- 4. Read our docs for more information for deeper customization [HERE](https://docs.swarms.world/en/latest/swarms_cloud/swarms_api/)
771
-
772
-
773
- ```python
774
- import json
775
- from swarms.structs.swarms_api import (
776
- SwarmsAPIClient,
777
- SwarmRequest,
778
- AgentInput,
779
- )
780
- import os
781
-
782
- agents = [
783
- AgentInput(
784
- agent_name="Medical Researcher",
785
- description="Conducts medical research and analysis",
786
- system_prompt="You are a medical researcher specializing in clinical studies.",
787
- max_loops=1,
788
- model_name="gpt-4o",
789
- role="worker",
790
- ),
791
- AgentInput(
792
- agent_name="Medical Diagnostician",
793
- description="Provides medical diagnoses based on symptoms and test results",
794
- system_prompt="You are a medical diagnostician with expertise in identifying diseases.",
795
- max_loops=1,
796
- model_name="gpt-4o",
797
- role="worker",
798
- ),
799
- AgentInput(
800
- agent_name="Pharmaceutical Expert",
801
- description="Advises on pharmaceutical treatments and drug interactions",
802
- system_prompt="You are a pharmaceutical expert knowledgeable about medications and their effects.",
803
- max_loops=1,
804
- model_name="gpt-4o",
805
- role="worker",
806
- ),
807
- ]
808
-
809
- swarm_request = SwarmRequest(
810
- name="Medical Swarm",
811
- description="A swarm for medical research and diagnostics",
812
- agents=agents,
813
- max_loops=1,
814
- swarm_type="ConcurrentWorkflow",
815
- output_type="str",
816
- return_history=True,
817
- task="What is the cause of the common cold?",
818
- )
819
-
820
- client = SwarmsAPIClient(
821
- api_key=os.getenv("SWARMS_API_KEY"), format_type="json"
822
- )
823
-
824
- response = client.run(swarm_request)
825
-
826
- print(json.dumps(response, indent=4))
827
-
828
-
829
- ```
830
-
831
-
832
- ### `SequentialWorkflow`
833
-
834
- The SequentialWorkflow in the Swarms framework enables sequential task execution across multiple Agent objects. Each agent's output serves as input for the next agent in the sequence, continuing until reaching the specified maximum number of loops (max_loops). This workflow is particularly well-suited for tasks requiring a specific order of operations, such as data processing pipelines. To learn more, visit: [Learn More](https://docs.swarms.world/en/latest/swarms/structs/sequential_workflow/)
835
-
836
- ```python
837
- import os
838
- from swarms import Agent, SequentialWorkflow
839
- from swarm_models import OpenAIChat
840
-
841
- # model = Anthropic(anthropic_api_key=os.getenv("ANTHROPIC_API_KEY"))
842
- company = "Nvidia"
843
- # Get the OpenAI API key from the environment variable
844
- api_key = os.getenv("GROQ_API_KEY")
845
-
846
- # Model
847
- model = OpenAIChat(
848
- openai_api_base="https://api.groq.com/openai/v1",
849
- openai_api_key=api_key,
850
- model_name="llama-3.1-70b-versatile",
851
- temperature=0.1,
852
- )
853
-
854
-
855
- # Initialize the Managing Director agent
856
- managing_director = Agent(
857
- agent_name="Managing-Director",
858
- system_prompt=f"""
859
- As the Managing Director at Blackstone, your role is to oversee the entire investment analysis process for potential acquisitions.
860
- Your responsibilities include:
861
- 1. Setting the overall strategy and direction for the analysis
862
- 2. Coordinating the efforts of the various team members and ensuring a comprehensive evaluation
863
- 3. Reviewing the findings and recommendations from each team member
864
- 4. Making the final decision on whether to proceed with the acquisition
865
-
866
- For the current potential acquisition of {company}, direct the tasks for the team to thoroughly analyze all aspects of the company, including its financials, industry position, technology, market potential, and regulatory compliance. Provide guidance and feedback as needed to ensure a rigorous and unbiased assessment.
867
- """,
868
- llm=model,
869
- max_loops=1,
870
- dashboard=False,
871
- streaming_on=True,
872
- verbose=True,
873
- stopping_token="<DONE>",
874
- state_save_file_type="json",
875
- saved_state_path="managing-director.json",
876
- )
877
-
878
- # Initialize the Vice President of Finance
879
- vp_finance = Agent(
880
- agent_name="VP-Finance",
881
- system_prompt=f"""
882
- As the Vice President of Finance at Blackstone, your role is to lead the financial analysis of potential acquisitions.
883
- For the current potential acquisition of {company}, your tasks include:
884
- 1. Conducting a thorough review of {company}' financial statements, including income statements, balance sheets, and cash flow statements
885
- 2. Analyzing key financial metrics such as revenue growth, profitability margins, liquidity ratios, and debt levels
886
- 3. Assessing the company's historical financial performance and projecting future performance based on assumptions and market conditions
887
- 4. Identifying any financial risks or red flags that could impact the acquisition decision
888
- 5. Providing a detailed report on your findings and recommendations to the Managing Director
889
-
890
- Be sure to consider factors such as the sustainability of {company}' business model, the strength of its customer base, and its ability to generate consistent cash flows. Your analysis should be data-driven, objective, and aligned with Blackstone's investment criteria.
891
- """,
892
- llm=model,
893
- max_loops=1,
894
- dashboard=False,
895
- streaming_on=True,
896
- verbose=True,
897
- stopping_token="<DONE>",
898
- state_save_file_type="json",
899
- saved_state_path="vp-finance.json",
900
- )
901
-
902
- # Initialize the Industry Analyst
903
- industry_analyst = Agent(
904
- agent_name="Industry-Analyst",
905
- system_prompt=f"""
906
- As the Industry Analyst at Blackstone, your role is to provide in-depth research and analysis on the industries and markets relevant to potential acquisitions.
907
- For the current potential acquisition of {company}, your tasks include:
908
- 1. Conducting a comprehensive analysis of the industrial robotics and automation solutions industry, including market size, growth rates, key trends, and future prospects
909
- 2. Identifying the major players in the industry and assessing their market share, competitive strengths and weaknesses, and strategic positioning
910
- 3. Evaluating {company}' competitive position within the industry, including its market share, differentiation, and competitive advantages
911
- 4. Analyzing the key drivers and restraints for the industry, such as technological advancements, labor costs, regulatory changes, and economic conditions
912
- 5. Identifying potential risks and opportunities for {company} based on the industry analysis, such as disruptive technologies, emerging markets, or shifts in customer preferences
913
-
914
- Your analysis should provide a clear and objective assessment of the attractiveness and future potential of the industrial robotics industry, as well as {company}' positioning within it. Consider both short-term and long-term factors, and provide evidence-based insights to inform the investment decision.
915
- """,
916
- llm=model,
917
- max_loops=1,
918
- dashboard=False,
919
- streaming_on=True,
920
- verbose=True,
921
- stopping_token="<DONE>",
922
- state_save_file_type="json",
923
- saved_state_path="industry-analyst.json",
924
- )
925
-
926
- # Initialize the Technology Expert
927
- tech_expert = Agent(
928
- agent_name="Tech-Expert",
929
- system_prompt=f"""
930
- As the Technology Expert at Blackstone, your role is to assess the technological capabilities, competitive advantages, and potential risks of companies being considered for acquisition.
931
- For the current potential acquisition of {company}, your tasks include:
932
- 1. Conducting a deep dive into {company}' proprietary technologies, including its robotics platforms, automation software, and AI capabilities
933
- 2. Assessing the uniqueness, scalability, and defensibility of {company}' technology stack and intellectual property
934
- 3. Comparing {company}' technologies to those of its competitors and identifying any key differentiators or technology gaps
935
- 4. Evaluating {company}' research and development capabilities, including its innovation pipeline, engineering talent, and R&D investments
936
- 5. Identifying any potential technology risks or disruptive threats that could impact {company}' long-term competitiveness, such as emerging technologies or expiring patents
937
-
938
- Your analysis should provide a comprehensive assessment of {company}' technological strengths and weaknesses, as well as the sustainability of its competitive advantages. Consider both the current state of its technology and its future potential in light of industry trends and advancements.
939
- """,
940
- llm=model,
941
- max_loops=1,
942
- dashboard=False,
943
- streaming_on=True,
944
- verbose=True,
945
- stopping_token="<DONE>",
946
- state_save_file_type="json",
947
- saved_state_path="tech-expert.json",
948
- )
949
-
950
- # Initialize the Market Researcher
951
- market_researcher = Agent(
952
- agent_name="Market-Researcher",
953
- system_prompt=f"""
954
- As the Market Researcher at Blackstone, your role is to analyze the target company's customer base, market share, and growth potential to assess the commercial viability and attractiveness of the potential acquisition.
955
- For the current potential acquisition of {company}, your tasks include:
956
- 1. Analyzing {company}' current customer base, including customer segmentation, concentration risk, and retention rates
957
- 2. Assessing {company}' market share within its target markets and identifying key factors driving its market position
958
- 3. Conducting a detailed market sizing and segmentation analysis for the industrial robotics and automation markets, including identifying high-growth segments and emerging opportunities
959
- 4. Evaluating the demand drivers and sales cycles for {company}' products and services, and identifying any potential risks or limitations to adoption
960
- 5. Developing financial projections and estimates for {company}' revenue growth potential based on the market analysis and assumptions around market share and penetration
961
-
962
- Your analysis should provide a data-driven assessment of the market opportunity for {company} and the feasibility of achieving our investment return targets. Consider both bottom-up and top-down market perspectives, and identify any key sensitivities or assumptions in your projections.
963
- """,
964
- llm=model,
965
- max_loops=1,
966
- dashboard=False,
967
- streaming_on=True,
968
- verbose=True,
969
- stopping_token="<DONE>",
970
- state_save_file_type="json",
971
- saved_state_path="market-researcher.json",
972
- )
973
-
974
- # Initialize the Regulatory Specialist
975
- regulatory_specialist = Agent(
976
- agent_name="Regulatory-Specialist",
977
- system_prompt=f"""
978
- As the Regulatory Specialist at Blackstone, your role is to identify and assess any regulatory risks, compliance requirements, and potential legal liabilities associated with potential acquisitions.
979
- For the current potential acquisition of {company}, your tasks include:
980
- 1. Identifying all relevant regulatory bodies and laws that govern the operations of {company}, including industry-specific regulations, labor laws, and environmental regulations
981
- 2. Reviewing {company}' current compliance policies, procedures, and track record to identify any potential gaps or areas of non-compliance
982
- 3. Assessing the potential impact of any pending or proposed changes to relevant regulations that could affect {company}' business or create additional compliance burdens
983
- 4. Evaluating the potential legal liabilities and risks associated with {company}' products, services, and operations, including product liability, intellectual property, and customer contracts
984
- 5. Providing recommendations on any regulatory or legal due diligence steps that should be taken as part of the acquisition process, as well as any post-acquisition integration considerations
985
-
986
- Your analysis should provide a comprehensive assessment of the regulatory and legal landscape surrounding {company}, and identify any material risks or potential deal-breakers. Consider both the current state and future outlook, and provide practical recommendations to mitigate identified risks.
987
- """,
988
- llm=model,
989
- max_loops=1,
990
- dashboard=False,
991
- streaming_on=True,
992
- verbose=True,
993
- stopping_token="<DONE>",
994
- state_save_file_type="json",
995
- saved_state_path="regulatory-specialist.json",
996
- )
997
-
998
- # Create a list of agents
999
- agents = [
1000
- managing_director,
1001
- vp_finance,
1002
- industry_analyst,
1003
- tech_expert,
1004
- market_researcher,
1005
- regulatory_specialist,
1006
- ]
1007
-
1008
-
1009
- swarm = SequentialWorkflow(
1010
- name="blackstone-private-equity-advisors",
1011
- agents=agents,
1012
- )
1013
-
1014
- print(
1015
- swarm.run(
1016
- "Analyze nvidia if it's a good deal to invest in now 10B"
1017
- )
1018
- )
1019
-
1020
- ```
1021
-
1022
- ------
1023
-
1024
-
1025
- ## `AgentRearrange`
1026
-
1027
- The `AgentRearrange` orchestration technique, inspired by Einops and einsum, enables you to define and map relationships between multiple agents. This powerful tool facilitates the orchestration of complex workflows by allowing you to specify both linear and concurrent relationships. For example, you can create sequential workflows like `a -> a1 -> a2 -> a3` or parallel workflows where a single agent distributes tasks to multiple agents simultaneously: `a -> a1, a2, a3`. This flexibility enables the creation of highly efficient and dynamic workflows, with agents operating either in parallel or sequence as required. As a valuable addition to the swarms library, `AgentRearrange` provides enhanced flexibility and precise control over agent orchestration. For comprehensive information and examples, visit the [official documentation](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/). [Watch my video tutorial on agent rearrange!](https://youtu.be/Rq8wWQ073mg)
1028
-
1029
-
1030
-
1031
- ```python
1032
-
1033
- from datetime import datetime
1034
-
1035
- from swarms import Agent, AgentRearrange, create_file_in_folder
1036
-
1037
- chief_medical_officer = Agent(
1038
- agent_name="Chief Medical Officer",
1039
- system_prompt="""You are the Chief Medical Officer coordinating a team of medical specialists for viral disease diagnosis.
1040
- Your responsibilities include:
1041
- - Gathering initial patient symptoms and medical history
1042
- - Coordinating with specialists to form differential diagnoses
1043
- - Synthesizing different specialist opinions into a cohesive diagnosis
1044
- - Ensuring all relevant symptoms and test results are considered
1045
- - Making final diagnostic recommendations
1046
- - Suggesting treatment plans based on team input
1047
- - Identifying when additional specialists need to be consulted
1048
-
1049
- Guidelines:
1050
- 1. Always start with a comprehensive patient history
1051
- 2. Consider both common and rare viral conditions
1052
- 3. Factor in patient demographics and risk factors
1053
- 4. Document your reasoning process clearly
1054
- 5. Highlight any critical or emergency symptoms
1055
- 6. Note any limitations or uncertainties in the diagnosis
1056
-
1057
- Format all responses with clear sections for:
1058
- - Initial Assessment
1059
- - Differential Diagnoses
1060
- - Specialist Consultations Needed
1061
- - Recommended Next Steps""",
1062
- model_name="gpt-4o", # Models from litellm -> claude-2
1063
- max_loops=1,
1064
- )
1065
-
1066
- # Viral Disease Specialist
1067
- virologist = Agent(
1068
- agent_name="Virologist",
1069
- system_prompt="""You are a specialist in viral diseases with expertise in:
1070
- - Respiratory viruses (Influenza, Coronavirus, RSV)
1071
- - Systemic viral infections (EBV, CMV, HIV)
1072
- - Childhood viral diseases (Measles, Mumps, Rubella)
1073
- - Emerging viral threats
1074
-
1075
- Your role involves:
1076
- 1. Analyzing symptoms specific to viral infections
1077
- 2. Distinguishing between different viral pathogens
1078
- 3. Assessing viral infection patterns and progression
1079
- 4. Recommending specific viral tests
1080
- 5. Evaluating epidemiological factors
1081
-
1082
- For each case, consider:
1083
- - Incubation periods
1084
- - Transmission patterns
1085
- - Seasonal factors
1086
- - Geographic prevalence
1087
- - Patient immune status
1088
- - Current viral outbreaks
1089
-
1090
- Provide detailed analysis of:
1091
- - Characteristic viral symptoms
1092
- - Disease progression timeline
1093
- - Risk factors for severe disease
1094
- - Potential complications""",
1095
- model_name="gpt-4o",
1096
- max_loops=1,
1097
- )
1098
-
1099
- # Internal Medicine Specialist
1100
- internist = Agent(
1101
- agent_name="Internist",
1102
- system_prompt="""You are an Internal Medicine specialist responsible for:
1103
- - Comprehensive system-based evaluation
1104
- - Integration of symptoms across organ systems
1105
- - Identification of systemic manifestations
1106
- - Assessment of comorbidities
1107
-
1108
- For each case, analyze:
1109
- 1. Vital signs and their implications
1110
- 2. System-by-system review (cardiovascular, respiratory, etc.)
1111
- 3. Impact of existing medical conditions
1112
- 4. Medication interactions and contraindications
1113
- 5. Risk stratification
1114
-
1115
- Consider these aspects:
1116
- - Age-related factors
1117
- - Chronic disease impact
1118
- - Medication history
1119
- - Social and environmental factors
1120
-
1121
- Document:
1122
- - Physical examination findings
1123
- - System-specific symptoms
1124
- - Relevant lab abnormalities
1125
- - Risk factors for complications""",
1126
- model_name="gpt-4o",
1127
- max_loops=1,
1128
- )
1129
-
1130
- # Diagnostic Synthesizer
1131
- synthesizer = Agent(
1132
- agent_name="Diagnostic Synthesizer",
1133
- system_prompt="""You are responsible for synthesizing all specialist inputs to create a final diagnostic assessment:
1134
-
1135
- Core responsibilities:
1136
- 1. Integrate findings from all specialists
1137
- 2. Identify patterns and correlations
1138
- 3. Resolve conflicting opinions
1139
- 4. Generate probability-ranked differential diagnoses
1140
- 5. Recommend additional testing if needed
1141
-
1142
- Analysis framework:
1143
- - Weight evidence based on reliability and specificity
1144
- - Consider epidemiological factors
1145
- - Evaluate diagnostic certainty
1146
- - Account for test limitations
1147
-
1148
- Provide structured output including:
1149
- 1. Primary diagnosis with confidence level
1150
- 2. Supporting evidence summary
1151
- 3. Alternative diagnoses to consider
1152
- 4. Recommended confirmatory tests
1153
- 5. Red flags or warning signs
1154
- 6. Follow-up recommendations
1155
-
1156
- Documentation requirements:
1157
- - Clear reasoning chain
1158
- - Evidence quality assessment
1159
- - Confidence levels for each diagnosis
1160
- - Knowledge gaps identified
1161
- - Risk assessment""",
1162
- model_name="gpt-4o",
1163
- max_loops=1,
1164
- )
1165
-
1166
- # Create agent list
1167
- agents = [chief_medical_officer, virologist, internist, synthesizer]
1168
-
1169
- # Define diagnostic flow
1170
- flow = f"""{chief_medical_officer.agent_name} -> {virologist.agent_name} -> {internist.agent_name} -> {synthesizer.agent_name}"""
1171
-
1172
- # Create the swarm system
1173
- diagnosis_system = AgentRearrange(
1174
- name="Medical-nlp-diagnosis-swarm",
1175
- description="natural language symptions to diagnosis report",
1176
- agents=agents,
1177
- flow=flow,
1178
- max_loops=1,
1179
- output_type="all",
1180
- )
1181
-
1182
-
1183
- # Example usage
1184
- if __name__ == "__main__":
1185
- # Example patient case
1186
- patient_case = """
1187
- Patient: 45-year-old female
1188
- Presenting symptoms:
1189
- - Fever (101.5°F) for 3 days
1190
- - Dry cough
1191
- - Fatigue
1192
- - Mild shortness of breath
1193
- Medical history:
1194
- - Controlled hypertension
1195
- - No recent travel
1196
- - Fully vaccinated for COVID-19
1197
- - No known sick contacts
1198
- """
1199
-
1200
- # Add timestamp to the patient case
1201
- case_info = f"Timestamp: {datetime.now()}\nPatient Information: {patient_case}"
1202
-
1203
- # Run the diagnostic process
1204
- diagnosis = diagnosis_system.run(case_info)
1205
-
1206
- # Create a folder and file called reports
1207
- create_file_in_folder(
1208
- "reports", "medical_analysis_agent_rearrange.md", diagnosis
1209
- )
1210
-
1211
-
1212
- ```
1213
-
1214
-
1215
- ------------
1216
-
1217
-
1218
- ## `HierarhicalSwarm`
1219
- Coming soon...
1220
-
1221
-
1222
- -----------------
1223
-
1224
- ## `GraphWorkflow`
1225
-
1226
-
1227
- GraphWorkflow is a workflow management system using a directed acyclic graph (DAG) to orchestrate complex tasks. Nodes (agents or tasks) and edges define dependencies, with agents executing tasks concurrently. It features entry/end points, visualization for debugging, and scalability for dynamic task assignment. Benefits include concurrency, flexibility, scalability, and clear workflow visualization. [Learn more:](https://docs.swarms.world/en/latest/swarms/structs/graph_swarm/) The `run` method returns a dictionary containing the execution results of all nodes in the graph.
1228
-
1229
-
1230
-
1231
- ```python
1232
- from swarms import Agent, Edge, GraphWorkflow, Node, NodeType
1233
-
1234
- # Initialize agents with model_name parameter
1235
- agent1 = Agent(
1236
- agent_name="Agent1",
1237
- model_name="openai/gpt-4o-mini", # Using provider prefix
1238
- temperature=0.5,
1239
- max_tokens=4000,
1240
- max_loops=1,
1241
- autosave=True,
1242
- dashboard=True,
1243
- )
1244
-
1245
- agent2 = Agent(
1246
- agent_name="Agent2",
1247
- model_name="openai/gpt-4o-mini", # Using provider prefix
1248
- temperature=0.5,
1249
- max_tokens=4000,
1250
- max_loops=1,
1251
- autosave=True,
1252
- dashboard=True,
1253
- )
1254
-
1255
- def sample_task():
1256
- print("Running sample task")
1257
- return "Task completed"
1258
-
1259
- wf_graph = GraphWorkflow()
1260
- wf_graph.add_node(Node(id="agent1", type=NodeType.AGENT, agent=agent1))
1261
- wf_graph.add_node(Node(id="agent2", type=NodeType.AGENT, agent=agent2))
1262
- wf_graph.add_node(Node(id="task1", type=NodeType.TASK, callable=sample_task))
1263
-
1264
- wf_graph.add_edge(Edge(source="agent1", target="task1"))
1265
- wf_graph.add_edge(Edge(source="agent2", target="task1"))
1266
-
1267
- wf_graph.set_entry_points(["agent1", "agent2"])
1268
- wf_graph.set_end_points(["task1"])
1269
-
1270
- print(wf_graph.visualize())
1271
-
1272
- results = wf_graph.run()
1273
- print("Execution results:", results)
1274
- ```
1275
-
1276
- -----
1277
-
1278
-
1279
- ## `MixtureOfAgents`
1280
-
1281
- The MixtureOfAgents architecture, inspired by together.ai's paper (arXiv:2406.04692), achieves SOTA performance on AlpacaEval 2.0, MT-Bench, and FLASK, surpassing GPT-4 Omni. It processes tasks via parallel agent collaboration and sequential layering, with documentation [HERE](https://docs.swarms.world/en/latest/swarms/structs/moa/)
1282
-
1283
-
1284
- ```python
1285
-
1286
- import os
1287
- from swarms import Agent, MixtureOfAgents
1288
-
1289
- # Agent 1: Financial Statement Analyzer
1290
- agent1 = Agent(
1291
- agent_name="FinancialStatementAnalyzer",
1292
- model_name="gpt-4o",
1293
- system_prompt="""You are a Financial Statement Analyzer specializing in 10-K SEC reports. Your primary focus is on analyzing the financial statements, including the balance sheet, income statement, and cash flow statement.
1294
-
1295
- Key responsibilities:
1296
- 1. Identify and explain significant changes in financial metrics year-over-year.
1297
- 2. Calculate and interpret key financial ratios (e.g., liquidity ratios, profitability ratios, leverage ratios).
1298
- 3. Analyze trends in revenue, expenses, and profitability.
1299
- 4. Highlight any red flags or areas of concern in the financial statements.
1300
- 5. Provide insights on the company's financial health and performance based on the data.
1301
-
1302
- When analyzing, consider industry standards and compare the company's performance to its peers when possible. Your analysis should be thorough, data-driven, and provide actionable insights for investors and stakeholders.""",
1303
- max_loops=1,
1304
- autosave=True,
1305
- dashboard=False,
1306
- verbose=True,
1307
- dynamic_temperature_enabled=True,
1308
- saved_state_path="financial_statement_analyzer_state.json",
1309
- user_name="swarms_corp",
1310
- retry_attempts=1,
1311
- context_length=200000,
1312
- return_step_meta=False,
1313
- )
1314
-
1315
- # Agent 2: Risk Assessment Specialist
1316
- agent2 = Agent(
1317
- agent_name="RiskAssessmentSpecialist",
1318
- model_name="gpt-4o",
1319
- system_prompt="""You are a Risk Assessment Specialist focusing on 10-K SEC reports. Your primary role is to identify, analyze, and evaluate potential risks disclosed in the report.
1320
-
1321
- Key responsibilities:
1322
- 1. Thoroughly review the "Risk Factors" section of the 10-K report.
1323
- 2. Identify and categorize different types of risks (e.g., operational, financial, legal, market, technological).
1324
- 3. Assess the potential impact and likelihood of each identified risk.
1325
- 4. Analyze the company's risk mitigation strategies and their effectiveness.
1326
- 5. Identify any emerging risks not explicitly mentioned but implied by the company's operations or market conditions.
1327
- 6. Compare the company's risk profile with industry peers when possible.
1328
-
1329
- Your analysis should provide a comprehensive overview of the company's risk landscape, helping stakeholders understand the potential challenges and uncertainties facing the business. Be sure to highlight any critical risks that could significantly impact the company's future performance or viability.""",
1330
- max_loops=1,
1331
- autosave=True,
1332
- dashboard=False,
1333
- verbose=True,
1334
- dynamic_temperature_enabled=True,
1335
- saved_state_path="risk_assessment_specialist_state.json",
1336
- user_name="swarms_corp",
1337
- retry_attempts=1,
1338
- context_length=200000,
1339
- return_step_meta=False,
1340
- )
1341
-
1342
- # Agent 3: Business Strategy Evaluator
1343
- agent3 = Agent(
1344
- agent_name="BusinessStrategyEvaluator",
1345
- model_name="gpt-4o",
1346
- system_prompt="""You are a Business Strategy Evaluator specializing in analyzing 10-K SEC reports. Your focus is on assessing the company's overall strategy, market position, and future outlook.
1347
-
1348
- Key responsibilities:
1349
- 1. Analyze the company's business description, market opportunities, and competitive landscape.
1350
- 2. Evaluate the company's products or services, including their market share and growth potential.
1351
- 3. Assess the effectiveness of the company's current business strategy and its alignment with market trends.
1352
- 4. Identify key performance indicators (KPIs) and evaluate the company's performance against these metrics.
1353
- 5. Analyze management's discussion and analysis (MD&A) section to understand their perspective on the business.
1354
- 6. Identify potential growth opportunities or areas for improvement in the company's strategy.
1355
- 7. Compare the company's strategic position with key competitors in the industry.
1356
-
1357
- Your analysis should provide insights into the company's strategic direction, its ability to create value, and its potential for future growth. Consider both short-term and long-term perspectives in your evaluation.""",
1358
- max_loops=1,
1359
- autosave=True,
1360
- dashboard=False,
1361
- verbose=True,
1362
- dynamic_temperature_enabled=True,
1363
- saved_state_path="business_strategy_evaluator_state.json",
1364
- user_name="swarms_corp",
1365
- retry_attempts=1,
1366
- context_length=200000,
1367
- return_step_meta=False,
1368
- )
1369
-
1370
- # Aggregator Agent
1371
- aggregator_agent = Agent(
1372
- agent_name="10KReportAggregator",
1373
- model_name="gpt-4o",
1374
- system_prompt="""You are the 10-K Report Aggregator, responsible for synthesizing and summarizing the analyses provided by the Financial Statement Analyzer, Risk Assessment Specialist, and Business Strategy Evaluator. Your goal is to create a comprehensive, coherent, and insightful summary of the 10-K SEC report.
1375
-
1376
- Key responsibilities:
1377
- 1. Integrate the financial analysis, risk assessment, and business strategy evaluation into a unified report.
1378
- 2. Identify and highlight the most critical information and insights from each specialist's analysis.
1379
- 3. Reconcile any conflicting information or interpretations among the specialists' reports.
1380
- 4. Provide a balanced view of the company's overall performance, risks, and strategic position.
1381
- 5. Summarize key findings and their potential implications for investors and stakeholders.
1382
- 6. Identify any areas where further investigation or clarification may be needed.
1383
-
1384
- Your final report should be well-structured, easy to understand, and provide a holistic view of the company based on the 10-K SEC report. It should offer valuable insights for decision-making while acknowledging any limitations or uncertainties in the analysis.""",
1385
- max_loops=1,
1386
- autosave=True,
1387
- dashboard=False,
1388
- verbose=True,
1389
- dynamic_temperature_enabled=True,
1390
- saved_state_path="10k_report_aggregator_state.json",
1391
- user_name="swarms_corp",
1392
- retry_attempts=1,
1393
- context_length=200000,
1394
- return_step_meta=False,
1395
- )
1396
-
1397
- # Create the Mixture of Agents class
1398
- moa = MixtureOfAgents(
1399
- agents=[agent1, agent2, agent3],
1400
- aggregator_agent=aggregator_agent,
1401
- aggregator_system_prompt="""As the 10-K Report Aggregator, your task is to synthesize the analyses provided by the Financial Statement Analyzer, Risk Assessment Specialist, and Business Strategy Evaluator into a comprehensive and coherent report.
1402
-
1403
- Follow these steps:
1404
- 1. Review and summarize the key points from each specialist's analysis.
1405
- 2. Identify common themes and insights across the analyses.
1406
- 3. Highlight any discrepancies or conflicting interpretations, if present.
1407
- 4. Provide a balanced and integrated view of the company's financial health, risks, and strategic position.
1408
- 5. Summarize the most critical findings and their potential impact on investors and stakeholders.
1409
- 6. Suggest areas for further investigation or monitoring, if applicable.
1410
-
1411
- Your final output should be a well-structured, insightful report that offers a holistic view of the company based on the 10-K SEC report analysis.""",
1412
- layers=3,
1413
- )
1414
-
1415
- # Example usage
1416
- company_name = "NVIDIA"
1417
- out = moa.run(
1418
- f"Analyze the latest 10-K SEC report for {company_name}. Provide a comprehensive summary of the company's financial performance, risk profile, and business strategy."
1419
- )
1420
- print(out)
1421
-
1422
- ```
1423
-
1424
- -------
1425
-
1426
- ## SpreadSheetSwarm
1427
-
1428
- SpreadSheetSwarm manages thousands of agents concurrently for efficient task processing. It supports one-to-many task distribution, scalability, and autosaving results. Initialized with a name, description, agents, and settings, the run method executes tasks and returns a dictionary of agent outputs.
1429
-
1430
- [Learn more:](https://docs.swarms.world/en/latest/swarms/structs/spreadsheet_swarm/)
1431
-
1432
- ```python
1433
- from swarms import Agent, SpreadSheetSwarm
1434
- # Define custom system prompts for each social media platform
1435
- TWITTER_AGENT_SYS_PROMPT = """
1436
- You are a Twitter marketing expert specializing in real estate. Your task is to create engaging, concise tweets to promote properties, analyze trends to maximize engagement, and use appropriate hashtags and timing to reach potential buyers.
1437
- """
1438
-
1439
- INSTAGRAM_AGENT_SYS_PROMPT = """
1440
- You are an Instagram marketing expert focusing on real estate. Your task is to create visually appealing posts with engaging captions and hashtags to showcase properties, targeting specific demographics interested in real estate.
1441
- """
1442
-
1443
- FACEBOOK_AGENT_SYS_PROMPT = """
1444
- You are a Facebook marketing expert for real estate. Your task is to craft posts optimized for engagement and reach on Facebook, including using images, links, and targeted messaging to attract potential property buyers.
1445
- """
1446
-
1447
- LINKEDIN_AGENT_SYS_PROMPT = """
1448
- You are a LinkedIn marketing expert for the real estate industry. Your task is to create professional and informative posts, highlighting property features, market trends, and investment opportunities, tailored to professionals and investors.
1449
- """
1450
-
1451
- EMAIL_AGENT_SYS_PROMPT = """
1452
- You are an Email marketing expert specializing in real estate. Your task is to write compelling email campaigns to promote properties, focusing on personalization, subject lines, and effective call-to-action strategies to drive conversions.
1453
- """
1454
-
1455
- # Initialize your agents for different social media platforms
1456
- agents = [
1457
- Agent(
1458
- agent_name="Twitter-RealEstate-Agent",
1459
- system_prompt=TWITTER_AGENT_SYS_PROMPT,
1460
- model_name="gpt-4o-mini",
1461
- max_loops=1,
1462
- dynamic_temperature_enabled=True,
1463
- saved_state_path="twitter_realestate_agent.json",
1464
- user_name="realestate_swarms",
1465
- retry_attempts=1,
1466
- ),
1467
- Agent(
1468
- agent_name="Instagram-RealEstate-Agent",
1469
- system_prompt=INSTAGRAM_AGENT_SYS_PROMPT,
1470
- model_name="gpt-4o-mini",
1471
- max_loops=1,
1472
- dynamic_temperature_enabled=True,
1473
- saved_state_path="instagram_realestate_agent.json",
1474
- user_name="realestate_swarms",
1475
- retry_attempts=1,
1476
- ),
1477
- Agent(
1478
- agent_name="Facebook-RealEstate-Agent",
1479
- system_prompt=FACEBOOK_AGENT_SYS_PROMPT,
1480
- model_name="gpt-4o-mini",
1481
- max_loops=1,
1482
- dynamic_temperature_enabled=True,
1483
- saved_state_path="facebook_realestate_agent.json",
1484
- user_name="realestate_swarms",
1485
- retry_attempts=1,
1486
- ),
1487
- Agent(
1488
- agent_name="LinkedIn-RealEstate-Agent",
1489
- system_prompt=LINKEDIN_AGENT_SYS_PROMPT,
1490
- model_name="gpt-4o-mini",
1491
- max_loops=1,
1492
- dynamic_temperature_enabled=True,
1493
- saved_state_path="linkedin_realestate_agent.json",
1494
- user_name="realestate_swarms",
1495
- retry_attempts=1,
1496
- ),
1497
- Agent(
1498
- agent_name="Email-RealEstate-Agent",
1499
- system_prompt=EMAIL_AGENT_SYS_PROMPT,
1500
- model_name="gpt-4o-mini",
1501
- max_loops=1,
1502
- dynamic_temperature_enabled=True,
1503
- saved_state_path="email_realestate_agent.json",
1504
- user_name="realestate_swarms",
1505
- retry_attempts=1,
1506
- ),
1507
- ]
1508
-
1509
- # Create a Swarm with the list of agents
1510
- swarm = SpreadSheetSwarm(
1511
- name="Real-Estate-Marketing-Swarm",
1512
- description="A swarm that processes real estate marketing tasks using multiple agents on different threads.",
1513
- agents=agents,
1514
- autosave_on=True,
1515
- save_file_path="real_estate_marketing_spreadsheet.csv",
1516
- run_all_agents=False,
1517
- max_loops=2,
1518
- )
1519
-
1520
- # Run the swarm
1521
- swarm.run(
1522
- task="""
1523
- Create posts to promote luxury properties in North Texas, highlighting their features, location, and investment potential. Include relevant hashtags, images, and engaging captions.
1524
-
1525
-
1526
- Property:
1527
- $10,399,000
1528
- 1609 Meandering Way Dr, Roanoke, TX 76262
1529
- Link to the property: https://www.zillow.com/homedetails/1609-Meandering-Way-Dr-Roanoke-TX-76262/308879785_zpid/
1530
-
1531
- What's special
1532
- Unveiling a new custom estate in the prestigious gated Quail Hollow Estates! This impeccable residence, set on a sprawling acre surrounded by majestic trees, features a gourmet kitchen equipped with top-tier Subzero and Wolf appliances. European soft-close cabinets and drawers, paired with a double Cambria Quartzite island, perfect for family gatherings. The first-floor game room&media room add extra layers of entertainment. Step into the outdoor sanctuary, where a sparkling pool and spa, and sunken fire pit, beckon leisure. The lavish master suite features stunning marble accents, custom his&her closets, and a secure storm shelter.Throughout the home,indulge in the visual charm of designer lighting and wallpaper, elevating every space. The property is complete with a 6-car garage and a sports court, catering to the preferences of basketball or pickleball enthusiasts. This residence seamlessly combines luxury&recreational amenities, making it a must-see for the discerning buyer.
1533
-
1534
- Facts & features
1535
- Interior
1536
- Bedrooms & bathrooms
1537
- Bedrooms: 6
1538
- Bathrooms: 8
1539
- Full bathrooms: 7
1540
- 1/2 bathrooms: 1
1541
- Primary bedroom
1542
- Bedroom
1543
- Features: Built-in Features, En Suite Bathroom, Walk-In Closet(s)
1544
- Cooling
1545
- Central Air, Ceiling Fan(s), Electric
1546
- Appliances
1547
- Included: Built-In Gas Range, Built-In Refrigerator, Double Oven, Dishwasher, Gas Cooktop, Disposal, Ice Maker, Microwave, Range, Refrigerator, Some Commercial Grade, Vented Exhaust Fan, Warming Drawer, Wine Cooler
1548
- Features
1549
- Wet Bar, Built-in Features, Dry Bar, Decorative/Designer Lighting Fixtures, Eat-in Kitchen, Elevator, High Speed Internet, Kitchen Island, Pantry, Smart Home, Cable TV, Walk-In Closet(s), Wired for Sound
1550
- Flooring: Hardwood
1551
- Has basement: No
1552
- Number of fireplaces: 3
1553
- Fireplace features: Living Room, Primary Bedroom
1554
- Interior area
1555
- Total interior livable area: 10,466 sqft
1556
- Total spaces: 12
1557
- Parking features: Additional Parking
1558
- Attached garage spaces: 6
1559
- Carport spaces: 6
1560
- Features
1561
- Levels: Two
1562
- Stories: 2
1563
- Patio & porch: Covered
1564
- Exterior features: Built-in Barbecue, Barbecue, Gas Grill, Lighting, Outdoor Grill, Outdoor Living Area, Private Yard, Sport Court, Fire Pit
1565
- Pool features: Heated, In Ground, Pool, Pool/Spa Combo
1566
- Fencing: Wrought Iron
1567
- Lot
1568
- Size: 1.05 Acres
1569
- Details
1570
- Additional structures: Outdoor Kitchen
1571
- Parcel number: 42232692
1572
- Special conditions: Standard
1573
- Construction
1574
- Type & style
1575
- Home type: SingleFamily
1576
- Architectural style: Contemporary/Modern,Detached
1577
- Property subtype: Single Family Residence
1578
- """
1579
- )
1580
-
1581
- ```
1582
-
1583
-
1584
- ----------
1585
-
1586
- ## `ForestSwarm`
1587
-
1588
- The `ForestSwarm` architecture is an intelligent system designed to optimize task assignment by dynamically selecting the most appropriate agent from a collection of specialized trees. Through asynchronous task processing, the system intelligently matches tasks with agents based on their relevance. This matching is accomplished by computing the semantic similarity between each agent's system prompts and the keywords present in the task. For comprehensive details about the `ForestSwarm` implementation and capabilities, please consult the [official documentation](https://docs.swarms.world/en/latest/swarms/structs/forest_swarm/).
1589
-
1590
-
1591
-
1592
-
1593
- ```python
1594
- from swarms import TreeAgent, Tree, ForestSwarm
1595
-
1596
- # Create agents with varying system prompts and dynamically generated distances/keywords
1597
- agents_tree1 = [
1598
- TreeAgent(
1599
- system_prompt="""You are an expert Stock Analysis Agent with deep knowledge of financial markets, technical analysis, and fundamental analysis. Your primary function is to analyze stock performance, market trends, and provide actionable insights. When analyzing stocks:
1600
-
1601
- 1. Always start with a brief overview of the current market conditions.
1602
- 2. Use a combination of technical indicators (e.g., moving averages, RSI, MACD) and fundamental metrics (e.g., P/E ratio, EPS growth, debt-to-equity).
1603
- 3. Consider both short-term and long-term perspectives in your analysis.
1604
- 4. Provide clear buy, hold, or sell recommendations with supporting rationale.
1605
- 5. Highlight potential risks and opportunities specific to each stock or sector.
1606
- 6. Use bullet points for clarity when listing key points or metrics.
1607
- 7. If relevant, compare the stock to its peers or sector benchmarks.
1608
-
1609
- Remember to maintain objectivity and base your analysis on factual data. If asked about future performance, always include a disclaimer about market unpredictability. Your goal is to provide comprehensive, accurate, and actionable stock analysis to inform investment decisions.""",
1610
- agent_name="Stock Analysis Agent",
1611
- ),
1612
- TreeAgent(
1613
- system_prompt="""You are a highly skilled Financial Planning Agent, specializing in personal and corporate financial strategies. Your role is to provide comprehensive financial advice tailored to each client's unique situation. When creating financial plans:
1614
-
1615
- 1. Begin by asking key questions about the client's financial goals, current situation, and risk tolerance.
1616
- 2. Develop a holistic view of the client's finances, including income, expenses, assets, and liabilities.
1617
- 3. Create detailed, step-by-step action plans to achieve financial goals.
1618
- 4. Provide specific recommendations for budgeting, saving, and investing.
1619
- 5. Consider tax implications and suggest tax-efficient strategies.
1620
- 6. Incorporate risk management and insurance planning into your recommendations.
1621
- 7. Use charts or tables to illustrate financial projections and scenarios.
1622
- 8. Regularly suggest reviewing and adjusting the plan as circumstances change.
1623
-
1624
- Always prioritize the client's best interests and adhere to fiduciary standards. Explain complex financial concepts in simple terms, and be prepared to justify your recommendations with data and reasoning.""",
1625
- agent_name="Financial Planning Agent",
1626
- ),
1627
- TreeAgent(
1628
- agent_name="Retirement Strategy Agent",
1629
- system_prompt="""You are a specialized Retirement Strategy Agent, focused on helping individuals and couples plan for a secure and comfortable retirement. Your expertise covers various aspects of retirement planning, including savings strategies, investment allocation, and income generation during retirement. When developing retirement strategies:
1630
-
1631
- 1. Start by assessing the client's current age, desired retirement age, and expected lifespan.
1632
- 2. Calculate retirement savings goals based on desired lifestyle and projected expenses.
1633
- 3. Analyze current retirement accounts (e.g., 401(k), IRA) and suggest optimization strategies.
1634
- 4. Provide guidance on asset allocation and rebalancing as retirement approaches.
1635
- 5. Explain various retirement income sources (e.g., Social Security, pensions, annuities).
1636
- 6. Discuss healthcare costs and long-term care planning.
1637
- 7. Offer strategies for tax-efficient withdrawals during retirement.
1638
- 8. Consider estate planning and legacy goals in your recommendations.
1639
-
1640
- Use Monte Carlo simulations or other statistical tools to illustrate the probability of retirement success. Always emphasize the importance of starting early and the power of compound interest. Be prepared to adjust strategies based on changing market conditions or personal circumstances.""",
1641
- ),
1642
- ]
1643
-
1644
- agents_tree2 = [
1645
- TreeAgent(
1646
- system_prompt="""You are a knowledgeable Tax Filing Agent, specializing in personal and business tax preparation and strategy. Your role is to ensure accurate tax filings while maximizing legitimate deductions and credits. When assisting with tax matters:
1647
-
1648
- 1. Start by gathering all necessary financial information and documents.
1649
- 2. Stay up-to-date with the latest tax laws and regulations, including state-specific rules.
1650
- 3. Identify all applicable deductions and credits based on the client's situation.
1651
- 4. Provide step-by-step guidance for completing tax forms accurately.
1652
- 5. Explain tax implications of various financial decisions.
1653
- 6. Offer strategies for tax-efficient investing and income management.
1654
- 7. Assist with estimated tax payments for self-employed individuals or businesses.
1655
- 8. Advise on record-keeping practices for tax purposes.
1656
-
1657
- Always prioritize compliance with tax laws while ethically minimizing tax liability. Be prepared to explain complex tax concepts in simple terms and provide rationale for your recommendations. If a situation is beyond your expertise, advise consulting a certified tax professional or IRS resources.""",
1658
- agent_name="Tax Filing Agent",
1659
- ),
1660
- TreeAgent(
1661
- system_prompt="""You are a sophisticated Investment Strategy Agent, adept at creating and managing investment portfolios to meet diverse financial goals. Your expertise covers various asset classes, market analysis, and risk management techniques. When developing investment strategies:
1662
-
1663
- 1. Begin by assessing the client's investment goals, time horizon, and risk tolerance.
1664
- 2. Provide a comprehensive overview of different asset classes and their risk-return profiles.
1665
- 3. Create diversified portfolio recommendations based on modern portfolio theory.
1666
- 4. Explain the benefits and risks of various investment vehicles (e.g., stocks, bonds, ETFs, mutual funds).
1667
- 5. Incorporate both passive and active investment strategies as appropriate.
1668
- 6. Discuss the importance of regular portfolio rebalancing and provide a rebalancing strategy.
1669
- 7. Consider tax implications of investment decisions and suggest tax-efficient strategies.
1670
- 8. Provide ongoing market analysis and suggest portfolio adjustments as needed.
1671
-
1672
- Use historical data and forward-looking projections to illustrate potential outcomes. Always emphasize the importance of long-term investing and the risks of market timing. Be prepared to explain complex investment concepts in clear, accessible language.""",
1673
- agent_name="Investment Strategy Agent",
1674
- ),
1675
- TreeAgent(
1676
- system_prompt="""You are a specialized ROTH IRA Agent, focusing on the intricacies of Roth Individual Retirement Accounts. Your role is to provide expert guidance on Roth IRA rules, benefits, and strategies to maximize their value for retirement planning. When advising on Roth IRAs:
1677
-
1678
- 1. Explain the fundamental differences between traditional and Roth IRAs.
1679
- 2. Clarify Roth IRA contribution limits and income eligibility requirements.
1680
- 3. Discuss the tax advantages of Roth IRAs, including tax-free growth and withdrawals.
1681
- 4. Provide guidance on Roth IRA conversion strategies and their tax implications.
1682
- 5. Explain the five-year rule and how it affects Roth IRA withdrawals.
1683
- 6. Offer strategies for maximizing Roth IRA contributions, such as the backdoor Roth IRA method.
1684
- 7. Discuss how Roth IRAs fit into overall retirement and estate planning strategies.
1685
- 8. Provide insights on investment choices within a Roth IRA to maximize tax-free growth.
1686
-
1687
- Always stay current with IRS regulations regarding Roth IRAs. Be prepared to provide numerical examples to illustrate the long-term benefits of Roth IRAs. Emphasize the importance of considering individual financial situations when making Roth IRA decisions.""",
1688
- agent_name="ROTH IRA Agent",
1689
- ),
1690
- ]
1691
-
1692
- # Create trees
1693
- tree1 = Tree(tree_name="Financial Tree", agents=agents_tree1)
1694
- tree2 = Tree(tree_name="Investment Tree", agents=agents_tree2)
1695
-
1696
- # Create the ForestSwarm
1697
- multi_agent_structure = ForestSwarm(trees=[tree1, tree2])
1698
-
1699
- # Run a task
1700
- task = "What are the best platforms to do our taxes on"
1701
- output = multi_agent_structure.run(task)
1702
- print(output)
1703
-
1704
- ```
1705
-
1706
-
1707
-
1708
- ------------
1709
-
1710
- ## `SwarmRouter`
1711
-
1712
- The `SwarmRouter` class is a flexible routing system designed to manage different types of swarms for task execution. It provides a unified interface to interact with various swarm types, including `AgentRearrange`, `MixtureOfAgents`, `SpreadSheetSwarm`, `SequentialWorkflow`, and `ConcurrentWorkflow`. We will be continuously adding more and more swarm architectures here as we progress with new architectures. [Learn More](https://docs.swarms.world/en/latest/swarms/structs/swarm_router/)
1713
-
1714
-
1715
- ```python
1716
- import os
1717
- from dotenv import load_dotenv
1718
- from swarms import Agent
1719
- from swarm_models import OpenAIChat
1720
- from swarms.structs.swarm_router import SwarmRouter, SwarmType
1721
-
1722
- load_dotenv()
1723
-
1724
- # Get the OpenAI API key from the environment variable
1725
- api_key = os.getenv("GROQ_API_KEY")
1726
-
1727
- # Model
1728
- model = OpenAIChat(
1729
- openai_api_base="https://api.groq.com/openai/v1",
1730
- openai_api_key=api_key,
1731
- model_name="llama-3.1-70b-versatile",
1732
- temperature=0.1,
1733
- )
1734
- # Define specialized system prompts for each agent
1735
- DATA_EXTRACTOR_PROMPT = """You are a highly specialized private equity agent focused on data extraction from various documents. Your expertise includes:
1736
- 1. Extracting key financial metrics (revenue, EBITDA, growth rates, etc.) from financial statements and reports
1737
- 2. Identifying and extracting important contract terms from legal documents
1738
- 3. Pulling out relevant market data from industry reports and analyses
1739
- 4. Extracting operational KPIs from management presentations and internal reports
1740
- 5. Identifying and extracting key personnel information from organizational charts and bios
1741
- Provide accurate, structured data extracted from various document types to support investment analysis."""
1742
-
1743
- SUMMARIZER_PROMPT = """You are an expert private equity agent specializing in summarizing complex documents. Your core competencies include:
1744
- 1. Distilling lengthy financial reports into concise executive summaries
1745
- 2. Summarizing legal documents, highlighting key terms and potential risks
1746
- 3. Condensing industry reports to capture essential market trends and competitive dynamics
1747
- 4. Summarizing management presentations to highlight key strategic initiatives and projections
1748
- 5. Creating brief overviews of technical documents, emphasizing critical points for non-technical stakeholders
1749
- Deliver clear, concise summaries that capture the essence of various documents while highlighting information crucial for investment decisions."""
1750
-
1751
- FINANCIAL_ANALYST_PROMPT = """You are a specialized private equity agent focused on financial analysis. Your key responsibilities include:
1752
- 1. Analyzing historical financial statements to identify trends and potential issues
1753
- 2. Evaluating the quality of earnings and potential adjustments to EBITDA
1754
- 3. Assessing working capital requirements and cash flow dynamics
1755
- 4. Analyzing capital structure and debt capacity
1756
- 5. Evaluating financial projections and underlying assumptions
1757
- Provide thorough, insightful financial analysis to inform investment decisions and valuation."""
1758
-
1759
- MARKET_ANALYST_PROMPT = """You are a highly skilled private equity agent specializing in market analysis. Your expertise covers:
1760
- 1. Analyzing industry trends, growth drivers, and potential disruptors
1761
- 2. Evaluating competitive landscape and market positioning
1762
- 3. Assessing market size, segmentation, and growth potential
1763
- 4. Analyzing customer dynamics, including concentration and loyalty
1764
- 5. Identifying potential regulatory or macroeconomic impacts on the market
1765
- Deliver comprehensive market analysis to assess the attractiveness and risks of potential investments."""
1766
-
1767
- OPERATIONAL_ANALYST_PROMPT = """You are an expert private equity agent focused on operational analysis. Your core competencies include:
1768
- 1. Evaluating operational efficiency and identifying improvement opportunities
1769
- 2. Analyzing supply chain and procurement processes
1770
- 3. Assessing sales and marketing effectiveness
1771
- 4. Evaluating IT systems and digital capabilities
1772
- 5. Identifying potential synergies in merger or add-on acquisition scenarios
1773
- Provide detailed operational analysis to uncover value creation opportunities and potential risks."""
1774
-
1775
- # Initialize specialized agents
1776
- data_extractor_agent = Agent(
1777
- agent_name="Data-Extractor",
1778
- system_prompt=DATA_EXTRACTOR_PROMPT,
1779
- llm=model,
1780
- max_loops=1,
1781
- autosave=True,
1782
- verbose=True,
1783
- dynamic_temperature_enabled=True,
1784
- saved_state_path="data_extractor_agent.json",
1785
- user_name="pe_firm",
1786
- retry_attempts=1,
1787
- context_length=200000,
1788
- output_type="string",
1789
- )
1790
-
1791
- summarizer_agent = Agent(
1792
- agent_name="Document-Summarizer",
1793
- system_prompt=SUMMARIZER_PROMPT,
1794
- llm=model,
1795
- max_loops=1,
1796
- autosave=True,
1797
- verbose=True,
1798
- dynamic_temperature_enabled=True,
1799
- saved_state_path="summarizer_agent.json",
1800
- user_name="pe_firm",
1801
- retry_attempts=1,
1802
- context_length=200000,
1803
- output_type="string",
1804
- )
1805
-
1806
- financial_analyst_agent = Agent(
1807
- agent_name="Financial-Analyst",
1808
- system_prompt=FINANCIAL_ANALYST_PROMPT,
1809
- llm=model,
1810
- max_loops=1,
1811
- autosave=True,
1812
- verbose=True,
1813
- dynamic_temperature_enabled=True,
1814
- saved_state_path="financial_analyst_agent.json",
1815
- user_name="pe_firm",
1816
- retry_attempts=1,
1817
- context_length=200000,
1818
- output_type="string",
1819
- )
1820
-
1821
- market_analyst_agent = Agent(
1822
- agent_name="Market-Analyst",
1823
- system_prompt=MARKET_ANALYST_PROMPT,
1824
- llm=model,
1825
- max_loops=1,
1826
- autosave=True,
1827
- verbose=True,
1828
- dynamic_temperature_enabled=True,
1829
- saved_state_path="market_analyst_agent.json",
1830
- user_name="pe_firm",
1831
- retry_attempts=1,
1832
- context_length=200000,
1833
- output_type="string",
1834
- )
1835
-
1836
- operational_analyst_agent = Agent(
1837
- agent_name="Operational-Analyst",
1838
- system_prompt=OPERATIONAL_ANALYST_PROMPT,
1839
- llm=model,
1840
- max_loops=1,
1841
- autosave=True,
1842
- verbose=True,
1843
- dynamic_temperature_enabled=True,
1844
- saved_state_path="operational_analyst_agent.json",
1845
- user_name="pe_firm",
1846
- retry_attempts=1,
1847
- context_length=200000,
1848
- output_type="string",
1849
- )
1850
-
1851
- # Initialize the SwarmRouter
1852
- router = SwarmRouter(
1853
- name="pe-document-analysis-swarm",
1854
- description="Analyze documents for private equity due diligence and investment decision-making",
1855
- max_loops=1,
1856
- agents=[
1857
- data_extractor_agent,
1858
- summarizer_agent,
1859
- financial_analyst_agent,
1860
- market_analyst_agent,
1861
- operational_analyst_agent,
1862
- ],
1863
- swarm_type="ConcurrentWorkflow", # or "SequentialWorkflow" or "ConcurrentWorkflow" or
1864
- )
1865
-
1866
- # Example usage
1867
- if __name__ == "__main__":
1868
- # Run a comprehensive private equity document analysis task
1869
- result = router.run(
1870
- "Where is the best place to find template term sheets for series A startups. Provide links and references"
1871
- )
1872
- print(result)
1873
-
1874
- # Retrieve and print logs
1875
- for log in router.get_logs():
1876
- print(f"{log.timestamp} - {log.level}: {log.message}")
1877
-
1878
- ```
1879
-
1880
- ### Changing Swarm Types
1881
-
1882
- You can create multiple SwarmRouter instances with different swarm types:
1883
-
1884
- ```python
1885
- sequential_router = SwarmRouter(
1886
- name="SequentialRouter",
1887
- agents=[
1888
- data_extractor_agent,
1889
- summarizer_agent,
1890
- financial_analyst_agent,
1891
- market_analyst_agent,
1892
- operational_analyst_agent,
1893
- ],
1894
- swarm_type=SwarmType.SequentialWorkflow
1895
- )
1896
-
1897
- concurrent_router = SwarmRouter(
1898
- name="ConcurrentRouter",
1899
- agents=[
1900
- data_extractor_agent,
1901
- summarizer_agent,
1902
- financial_analyst_agent,
1903
- market_analyst_agent,
1904
- operational_analyst_agent,
1905
- ],
1906
- swarm_type=SwarmType.ConcurrentWorkflow
1907
- )
1908
- ```
1909
-
1910
- ### AgentRearrange
1911
-
1912
- Use Case: Optimizing agent order for complex multi-step tasks.
1913
-
1914
- ```python
1915
- rearrange_router = SwarmRouter(
1916
- name="TaskOptimizer",
1917
- description="Optimize agent order for multi-step tasks",
1918
- max_loops=3,
1919
- agents=[
1920
- data_extractor_agent,
1921
- summarizer_agent,
1922
- financial_analyst_agent,
1923
- market_analyst_agent,
1924
- operational_analyst_agent,
1925
- ],
1926
- swarm_type=SwarmType.AgentRearrange,
1927
- flow = f"{data_extractor.name} -> {analyzer.name} -> {summarizer.name}"
1928
- )
1929
-
1930
- result = rearrange_router.run("Analyze and summarize the quarterly financial report")
1931
- ```
1932
-
1933
- ### MixtureOfAgents
1934
-
1935
- Use Case: Combining diverse expert agents for comprehensive analysis.
1936
-
1937
- ```python
1938
- mixture_router = SwarmRouter(
1939
- name="ExpertPanel",
1940
- description="Combine insights from various expert agents",
1941
- max_loops=1,
1942
- agents=[
1943
- data_extractor_agent,
1944
- summarizer_agent,
1945
- financial_analyst_agent,
1946
- market_analyst_agent,
1947
- operational_analyst_agent,
1948
- ],
1949
- swarm_type=SwarmType.MixtureOfAgents
1950
- )
1951
-
1952
- result = mixture_router.run("Evaluate the potential acquisition of TechStartup Inc.")
1953
- ```
1954
-
1955
-
1956
- -------
1957
-
1958
- ## GroupChat
1959
-
1960
- A production-grade multi-agent system enabling sophisticated group conversations between AI agents with customizable speaking patterns, parallel processing capabilities, and comprehensive conversation tracking.
1961
-
1962
-
1963
- ```python
1964
- from swarms import Agent, GroupChat, expertise_based
1965
-
1966
-
1967
- if __name__ == "__main__":
1968
-
1969
-
1970
- # Example agents
1971
- agent1 = Agent(
1972
- agent_name="Financial-Analysis-Agent",
1973
- system_prompt="You are a financial analyst specializing in investment strategies.",
1974
- model_name="gpt-4o-mini",
1975
- temperature=0.1,
1976
- max_loops=1,
1977
- autosave=False,
1978
- dashboard=False,
1979
- verbose=True,
1980
- dynamic_temperature_enabled=True,
1981
- user_name="swarms_corp",
1982
- retry_attempts=1,
1983
- context_length=200000,
1984
- output_type="string",
1985
- streaming_on=False,
1986
- )
1987
-
1988
- agent2 = Agent(
1989
- agent_name="Tax-Adviser-Agent",
1990
- system_prompt="You are a tax adviser who provides clear and concise guidance on tax-related queries.",
1991
- model_name="gpt-4o-mini",
1992
- temperature=0.1,
1993
- max_loops=1,
1994
- autosave=False,
1995
- dashboard=False,
1996
- verbose=True,
1997
- dynamic_temperature_enabled=True,
1998
- user_name="swarms_corp",
1999
- retry_attempts=1,
2000
- context_length=200000,
2001
- output_type="string",
2002
- streaming_on=False,
2003
- )
2004
-
2005
- agents = [agent1, agent2]
2006
-
2007
- chat = GroupChat(
2008
- name="Investment Advisory",
2009
- description="Financial and tax analysis group",
2010
- agents=agents,
2011
- speaker_fn=expertise_based,
2012
- )
2013
-
2014
- history = chat.run(
2015
- "How to optimize tax strategy for investments?"
2016
- )
2017
- print(history)
2018
-
2019
-
2020
- ```
2021
-
2022
- ---
2023
-
2024
- ## MultiAgentRouter
2025
-
2026
- The MultiAgentRouter is a swarm architecture designed to dynamically assign tasks to the most suitable agent. It achieves this through a director or boss entity that utilizes function calls to identify and allocate tasks to the agent best equipped to handle them. [Check out the documentation](https://docs.swarms.world/en/latest/swarms/structs/multi_agent_router/)
2027
-
2028
- ```python
2029
- from swarms import Agent
2030
- from swarms.structs.multi_agent_orchestrator import MultiAgentRouter
2031
-
2032
- # Example usage:
2033
- if __name__ == "__main__":
2034
- # Define some example agents
2035
- agents = [
2036
- Agent(
2037
- agent_name="ResearchAgent",
2038
- description="Specializes in researching topics and providing detailed, factual information",
2039
- system_prompt="You are a research specialist. Provide detailed, well-researched information about any topic, citing sources when possible.",
2040
- model_name="openai/gpt-4o",
2041
- ),
2042
- Agent(
2043
- agent_name="CodeExpertAgent",
2044
- description="Expert in writing, reviewing, and explaining code across multiple programming languages",
2045
- system_prompt="You are a coding expert. Write, review, and explain code with a focus on best practices and clean code principles.",
2046
- model_name="openai/gpt-4o",
2047
- ),
2048
- Agent(
2049
- agent_name="WritingAgent",
2050
- description="Skilled in creative and technical writing, content creation, and editing",
2051
- system_prompt="You are a writing specialist. Create, edit, and improve written content while maintaining appropriate tone and style.",
2052
- model_name="openai/gpt-4o",
2053
- ),
2054
- ]
2055
-
2056
- # Initialize routers with different configurations
2057
- router_execute = MultiAgentRouter(agents=agents, execute_task=True)
2058
-
2059
- # Example task
2060
- task = "Write a Python function to calculate fibonacci numbers"
2061
-
2062
- try:
2063
- # Process the task with execution
2064
- print("\nWith task execution:")
2065
- result_execute = router_execute.route_task(task)
2066
- print(result_execute)
2067
-
2068
- except Exception as e:
2069
- print(f"Error occurred: {str(e)}")
2070
- ```
2071
-
2072
-
2073
- ----------
2074
-
2075
- ## Onboarding Session
2076
-
2077
- Get onboarded now with the creator and lead maintainer of Swarms, Kye Gomez, who will show you how to get started with the installation, usage examples, and starting to build your custom use case! [CLICK HERE](https://cal.com/swarms/swarms-onboarding-session)
2078
-
2079
-
2080
- ---
2081
-
2082
- ## Documentation
2083
-
2084
- Documentation is located here at: [docs.swarms.world](https://docs.swarms.world)
2085
-
2086
- -----
2087
-
2088
- ## 🫶 Contributions:
2089
-
2090
- The easiest way to contribute is to pick any issue with the `good first issue` tag 💪. Read the Contributing guidelines [here](/CONTRIBUTING.md). Bug Report? [File here](https://github.com/swarms/gateway/issues) | Feature Request? [File here](https://github.com/swarms/gateway/issues)
2091
-
2092
- Swarms is an open-source project, and contributions are VERY welcome. If you want to contribute, you can create new features, fix bugs, or improve the infrastructure. Please refer to the [CONTRIBUTING.md](https://github.com/kyegomez/swarms/blob/master/CONTRIBUTING.md) and our [contributing board](https://github.com/users/kyegomez/projects/1) to participate in Roadmap discussions!
2093
-
2094
- ----
2095
-
2096
-
2097
- ### Connect With Us
2098
-
2099
- | Platform | Link | Description |
2100
- |----------|------|-------------|
2101
- | 📚 Documentation | [docs.swarms.world](https://docs.swarms.world) | Official documentation and guides |
2102
- | 📝 Blog | [Medium](https://medium.com/@kyeg) | Latest updates and technical articles |
2103
- | 💬 Discord | [Join Discord](https://discord.gg/jM3Z6M9uMq) | Live chat and community support |
2104
- | 🐦 Twitter | [@kyegomez](https://twitter.com/kyegomez) | Latest news and announcements |
2105
- | 👥 LinkedIn | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) | Professional network and updates |
2106
- | 📺 YouTube | [Swarms Channel](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) | Tutorials and demos |
2107
- | 🎫 Events | [Sign up here](https://lu.ma/5p2jnc2v) | Join our community events |
2108
-
2109
-
2110
-
2111
- ## Citation
2112
-
2113
- If you use **swarms** in your research, please cite the project by referencing the metadata in [CITATION.cff](./CITATION.cff).
2114
-
2115
-
2116
- # License
2117
-
2118
- APACHE
2119
-