swarms 7.8.9__tar.gz → 7.9.1__tar.gz

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.
Files changed (222) hide show
  1. swarms-7.9.1/PKG-INFO +626 -0
  2. swarms-7.9.1/README.md +582 -0
  3. {swarms-7.8.9 → swarms-7.9.1}/pyproject.toml +1 -1
  4. {swarms-7.8.9 → swarms-7.9.1}/swarms/cli/onboarding_process.py +1 -3
  5. swarms-7.9.1/swarms/prompts/collaborative_prompts.py +177 -0
  6. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/__init__.py +11 -1
  7. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/agent.py +488 -127
  8. swarms-7.9.1/swarms/structs/concurrent_workflow.py +222 -0
  9. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/conversation.py +103 -25
  10. swarms-7.9.1/swarms/structs/interactive_groupchat.py +1063 -0
  11. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/ma_utils.py +25 -6
  12. swarms-7.9.1/swarms/structs/mixture_of_agents.py +205 -0
  13. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/swarm_router.py +155 -195
  14. swarms-7.9.1/swarms/telemetry/__init__.py +13 -0
  15. swarms-7.9.1/swarms/telemetry/log_executions.py +43 -0
  16. swarms-7.9.1/swarms/telemetry/main.py +134 -0
  17. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/base_tool.py +8 -3
  18. swarms-7.9.1/swarms/utils/formatter.py +266 -0
  19. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/litellm_wrapper.py +7 -1
  20. swarms-7.9.1/swarms/utils/retry_func.py +66 -0
  21. swarms-7.8.9/PKG-INFO +0 -2119
  22. swarms-7.8.9/README.md +0 -2075
  23. swarms-7.8.9/swarms/structs/concurrent_workflow.py +0 -348
  24. swarms-7.8.9/swarms/structs/interactive_groupchat.py +0 -356
  25. swarms-7.8.9/swarms/structs/mixture_of_agents.py +0 -230
  26. swarms-7.8.9/swarms/telemetry/__init__.py +0 -27
  27. swarms-7.8.9/swarms/telemetry/main.py +0 -298
  28. swarms-7.8.9/swarms/utils/formatter.py +0 -149
  29. {swarms-7.8.9 → swarms-7.9.1}/LICENSE +0 -0
  30. {swarms-7.8.9 → swarms-7.9.1}/swarms/__init__.py +0 -0
  31. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/__init__.py +0 -0
  32. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/agent_judge.py +0 -0
  33. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/agent_print.py +0 -0
  34. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/ape_agent.py +0 -0
  35. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/auto_generate_swarm_config.py +0 -0
  36. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/consistency_agent.py +0 -0
  37. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/cort_agent.py +0 -0
  38. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/create_agents_from_yaml.py +0 -0
  39. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/flexion_agent.py +0 -0
  40. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/gkp_agent.py +0 -0
  41. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/i_agent.py +0 -0
  42. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/openai_assistant.py +0 -0
  43. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/react_agent.py +0 -0
  44. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/reasoning_agents.py +0 -0
  45. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/reasoning_duo.py +0 -0
  46. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/self_agent_builder.py +0 -0
  47. {swarms-7.8.9 → swarms-7.9.1}/swarms/agents/tool_agent.py +0 -0
  48. {swarms-7.8.9 → swarms-7.9.1}/swarms/artifacts/__init__.py +0 -0
  49. {swarms-7.8.9 → swarms-7.9.1}/swarms/artifacts/main_artifact.py +0 -0
  50. {swarms-7.8.9 → swarms-7.9.1}/swarms/cli/__init__.py +0 -0
  51. {swarms-7.8.9 → swarms-7.9.1}/swarms/cli/create_agent.py +0 -0
  52. {swarms-7.8.9 → swarms-7.9.1}/swarms/cli/main.py +0 -0
  53. {swarms-7.8.9 → swarms-7.9.1}/swarms/communication/__init__.py +0 -0
  54. {swarms-7.8.9 → swarms-7.9.1}/swarms/communication/base_communication.py +0 -0
  55. {swarms-7.8.9 → swarms-7.9.1}/swarms/communication/duckdb_wrap.py +0 -0
  56. {swarms-7.8.9 → swarms-7.9.1}/swarms/communication/pulsar_struct.py +0 -0
  57. {swarms-7.8.9 → swarms-7.9.1}/swarms/communication/redis_wrap.py +0 -0
  58. {swarms-7.8.9 → swarms-7.9.1}/swarms/communication/sqlite_wrap.py +0 -0
  59. {swarms-7.8.9 → swarms-7.9.1}/swarms/communication/supabase_wrap.py +0 -0
  60. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/__init__.py +0 -0
  61. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/accountant_swarm_prompts.py +0 -0
  62. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/ag_prompt.py +0 -0
  63. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/aga.py +0 -0
  64. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/agent_conversation_aggregator.py +0 -0
  65. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/agent_judge_prompt.py +0 -0
  66. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/agent_prompt.py +0 -0
  67. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/agent_prompts.py +0 -0
  68. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/agent_self_builder_prompt.py +0 -0
  69. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/agent_system_prompts.py +0 -0
  70. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/ai_research_team.py +0 -0
  71. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/aot_prompt.py +0 -0
  72. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/autobloggen.py +0 -0
  73. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/autoswarm.py +0 -0
  74. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/chat_prompt.py +0 -0
  75. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/code_interpreter.py +0 -0
  76. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/code_spawner.py +0 -0
  77. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/debate.py +0 -0
  78. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/documentation.py +0 -0
  79. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/education.py +0 -0
  80. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/finance_agent_prompt.py +0 -0
  81. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/finance_agent_sys_prompt.py +0 -0
  82. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/growth_agent_prompt.py +0 -0
  83. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/idea2img.py +0 -0
  84. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/legal_agent_prompt.py +0 -0
  85. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/logistics.py +0 -0
  86. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/max_loop_prompt.py +0 -0
  87. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/meta_system_prompt.py +0 -0
  88. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/multi_agent_collab_prompt.py +0 -0
  89. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/multi_modal_autonomous_instruction_prompt.py +0 -0
  90. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/multi_modal_prompts.py +0 -0
  91. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/multi_modal_visual_prompts.py +0 -0
  92. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/operations_agent_prompt.py +0 -0
  93. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/paper_idea_agent.py +0 -0
  94. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/personal_stylist.py +0 -0
  95. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/product_agent_prompt.py +0 -0
  96. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/programming.py +0 -0
  97. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/project_manager.py +0 -0
  98. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/prompt.py +0 -0
  99. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/prompt_generator.py +0 -0
  100. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/prompt_generator_optimizer.py +0 -0
  101. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/python.py +0 -0
  102. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/react.py +0 -0
  103. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/react_base_prompt.py +0 -0
  104. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/reasoning_prompt.py +0 -0
  105. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/refiner_agent_prompt.py +0 -0
  106. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/safety_prompt.py +0 -0
  107. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/sales.py +0 -0
  108. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/sales_prompts.py +0 -0
  109. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/security_team.py +0 -0
  110. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/self_operating_prompt.py +0 -0
  111. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/sop_generator_agent_prompt.py +0 -0
  112. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/summaries_prompts.py +0 -0
  113. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/support_agent_prompt.py +0 -0
  114. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/swarm_manager_agent.py +0 -0
  115. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/task_assignment_prompt.py +0 -0
  116. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/tests.py +0 -0
  117. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/tools.py +0 -0
  118. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/urban_planning.py +0 -0
  119. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/visual_cot.py +0 -0
  120. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/worker_prompt.py +0 -0
  121. {swarms-7.8.9 → swarms-7.9.1}/swarms/prompts/xray_swarm_prompt.py +0 -0
  122. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/__init__.py +0 -0
  123. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/agent_class_schema.py +0 -0
  124. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/agent_completion_response.py +0 -0
  125. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/agent_mcp_errors.py +0 -0
  126. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/agent_rag_schema.py +0 -0
  127. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/agent_step_schemas.py +0 -0
  128. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/agent_tool_schema.py +0 -0
  129. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/base_schemas.py +0 -0
  130. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/conversation_schema.py +0 -0
  131. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/llm_agent_schema.py +0 -0
  132. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/mcp_schemas.py +0 -0
  133. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/swarms_api_schemas.py +0 -0
  134. {swarms-7.8.9 → swarms-7.9.1}/swarms/schemas/tool_schema_base_model.py +0 -0
  135. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/agent_builder.py +0 -0
  136. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/agent_rag_handler.py +0 -0
  137. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/agent_registry.py +0 -0
  138. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/agent_roles.py +0 -0
  139. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/agent_router.py +0 -0
  140. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/aop.py +0 -0
  141. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/auto_swarm_builder.py +0 -0
  142. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/base_structure.py +0 -0
  143. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/base_swarm.py +0 -0
  144. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/base_workflow.py +0 -0
  145. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/batch_agent_execution.py +0 -0
  146. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/concat.py +0 -0
  147. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/council_judge.py +0 -0
  148. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/csv_to_agent.py +0 -0
  149. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/de_hallucination_swarm.py +0 -0
  150. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/deep_research_swarm.py +0 -0
  151. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/dynamic_conversational_swarm.py +0 -0
  152. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/graph_workflow.py +0 -0
  153. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/groupchat.py +0 -0
  154. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/hiearchical_swarm.py +0 -0
  155. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/hybrid_hiearchical_peer_swarm.py +0 -0
  156. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/image_batch_processor.py +0 -0
  157. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/long_agent.py +0 -0
  158. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/ma_blocks.py +0 -0
  159. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/majority_voting.py +0 -0
  160. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/malt.py +0 -0
  161. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/matrix_swarm.py +0 -0
  162. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/meme_agent_persona_generator.py +0 -0
  163. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/model_router.py +0 -0
  164. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/multi_agent_exec.py +0 -0
  165. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/multi_agent_router.py +0 -0
  166. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/multi_model_gpu_manager.py +0 -0
  167. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/omni_agent_types.py +0 -0
  168. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/rearrange.py +0 -0
  169. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/round_robin.py +0 -0
  170. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/safe_loading.py +0 -0
  171. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/sequential_workflow.py +0 -0
  172. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/spreadsheet_swarm.py +0 -0
  173. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/stopping_conditions.py +0 -0
  174. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/swarm_arange.py +0 -0
  175. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/swarm_eval.py +0 -0
  176. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/swarm_id_generator.py +0 -0
  177. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/swarm_matcher.py +0 -0
  178. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/swarm_registry.py +0 -0
  179. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/swarming_architectures.py +0 -0
  180. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/tree_swarm.py +0 -0
  181. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/utils.py +0 -0
  182. {swarms-7.8.9 → swarms-7.9.1}/swarms/structs/various_alt_swarms.py +0 -0
  183. {swarms-7.8.9 → swarms-7.9.1}/swarms/telemetry/bootup.py +0 -0
  184. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/__init__.py +0 -0
  185. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/cohere_func_call_schema.py +0 -0
  186. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/create_agent_tool.py +0 -0
  187. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/func_calling_utils.py +0 -0
  188. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/func_to_str.py +0 -0
  189. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/function_util.py +0 -0
  190. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/json_former.py +0 -0
  191. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/json_utils.py +0 -0
  192. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/logits_processor.py +0 -0
  193. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/mcp_client_call.py +0 -0
  194. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/openai_func_calling_schema_pydantic.py +0 -0
  195. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/openai_tool_creator_decorator.py +0 -0
  196. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/py_func_to_openai_func_str.py +0 -0
  197. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/pydantic_to_json.py +0 -0
  198. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/tool_parse_exec.py +0 -0
  199. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/tool_registry.py +0 -0
  200. {swarms-7.8.9 → swarms-7.9.1}/swarms/tools/tool_utils.py +0 -0
  201. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/__init__.py +0 -0
  202. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/any_to_str.py +0 -0
  203. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/audio_processing.py +0 -0
  204. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/auto_download_check_packages.py +0 -0
  205. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/calculate_func_metrics.py +0 -0
  206. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/check_all_model_max_tokens.py +0 -0
  207. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/data_to_text.py +0 -0
  208. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/disable_logging.py +0 -0
  209. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/file_processing.py +0 -0
  210. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/function_caller_model.py +0 -0
  211. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/generate_keys.py +0 -0
  212. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/history_output_formatter.py +0 -0
  213. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/index.py +0 -0
  214. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/litellm_tokenizer.py +0 -0
  215. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/loguru_logger.py +0 -0
  216. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/output_types.py +0 -0
  217. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/parse_code.py +0 -0
  218. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/pdf_to_text.py +0 -0
  219. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/str_to_dict.py +0 -0
  220. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/try_except_wrapper.py +0 -0
  221. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/vllm_wrapper.py +0 -0
  222. {swarms-7.8.9 → swarms-7.9.1}/swarms/utils/xml_utils.py +0 -0
swarms-7.9.1/PKG-INFO ADDED
@@ -0,0 +1,626 @@
1
+ Metadata-Version: 2.3
2
+ Name: swarms
3
+ Version: 7.9.1
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: 700px" width="100%" 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
+ Swarms delivers a comprehensive, enterprise-grade multi-agent infrastructure platform designed for production-scale deployments and seamless integration with existing systems. [Learn more about the swarms feature set here](https://docs.swarms.world/en/latest/swarms/features/)
145
+
146
+ | Category | Features | Benefits |
147
+ |----------|----------|-----------|
148
+ | 🏢 **Enterprise Architecture** | • Production-Ready Infrastructure<br>• High Availability Systems<br>• Modular Microservices Design<br>• Comprehensive Observability<br>• Backwards Compatibility | • 99.9%+ Uptime Guarantee<br>• Reduced Operational Overhead<br>• Seamless Legacy Integration<br>• Enhanced System Monitoring<br>• Risk-Free Migration Path |
149
+ | 🤖 **Multi-Agent Orchestration** | • Hierarchical Agent Swarms<br>• Parallel Processing Pipelines<br>• Sequential Workflow Orchestration<br>• Graph-Based Agent Networks<br>• Dynamic Agent Composition<br>• Agent Registry Management | • Complex Business Process Automation<br>• Scalable Task Distribution<br>• Flexible Workflow Adaptation<br>• Optimized Resource Utilization<br>• Centralized Agent Governance<br>• Enterprise-Grade Agent Lifecycle Management |
150
+ | 🔄 **Enterprise Integration** | • Multi-Model Provider Support<br>• Custom Agent Development Framework<br>• Extensive Enterprise Tool Library<br>• Multiple Memory Systems<br>• Backwards Compatibility with LangChain, AutoGen, CrewAI<br>• Standardized API Interfaces | • Vendor-Agnostic Architecture<br>• Custom Solution Development<br>• Extended Functionality Integration<br>• Enhanced Knowledge Management<br>• Seamless Framework Migration<br>• Reduced Integration Complexity |
151
+ | 📈 **Enterprise Scalability** | • Concurrent Multi-Agent Processing<br>• Intelligent Resource Management<br>• Load Balancing & Auto-Scaling<br>• Horizontal Scaling Capabilities<br>• Performance Optimization<br>• Capacity Planning Tools | • High-Throughput Processing<br>• Cost-Effective Resource Utilization<br>• Elastic Scaling Based on Demand<br>• Linear Performance Scaling<br>• Optimized Response Times<br>• Predictable Growth Planning |
152
+ | 🛠️ **Developer Experience** | • Intuitive Enterprise API<br>• Comprehensive Documentation<br>• Active Enterprise Community<br>• CLI & SDK Tools<br>• IDE Integration Support<br>• Code Generation Templates | • Accelerated Development Cycles<br>• Reduced Learning Curve<br>• Expert Community Support<br>• Rapid Deployment Capabilities<br>• Enhanced Developer Productivity<br>• Standardized Development Patterns |
153
+
154
+
155
+ ## Install 💻
156
+
157
+ ### Using pip
158
+ ```bash
159
+ $ pip3 install -U swarms
160
+ ```
161
+
162
+ ### Using uv (Recommended)
163
+ [uv](https://github.com/astral-sh/uv) is a fast Python package installer and resolver, written in Rust.
164
+
165
+ ```bash
166
+ # Install uv
167
+ $ curl -LsSf https://astral.sh/uv/install.sh | sh
168
+
169
+ # Install swarms using uv
170
+ $ uv pip install swarms
171
+ ```
172
+
173
+ ### Using poetry
174
+ ```bash
175
+ # Install poetry if you haven't already
176
+ $ curl -sSL https://install.python-poetry.org | python3 -
177
+
178
+ # Add swarms to your project
179
+ $ poetry add swarms
180
+ ```
181
+
182
+ ### From source
183
+ ```bash
184
+ # Clone the repository
185
+ $ git clone https://github.com/kyegomez/swarms.git
186
+ $ cd swarms
187
+
188
+ # Install with pip
189
+ $ pip install -e .
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Environment Configuration
195
+
196
+ [Learn more about the environment configuration here](https://docs.swarms.world/en/latest/swarms/install/env/)
197
+
198
+ ```
199
+ OPENAI_API_KEY=""
200
+ WORKSPACE_DIR="agent_workspace"
201
+ ANTHROPIC_API_KEY=""
202
+ GROQ_API_KEY=""
203
+ ```
204
+
205
+
206
+
207
+ ### 🤖 Your First Agent
208
+
209
+ An **Agent** is the fundamental building block of a swarm—an autonomous entity powered by an LLM + Tools + Memory. [Learn more Here](https://docs.swarms.world/en/latest/swarms/structs/agent/)
210
+
211
+ ```python
212
+ from swarms import Agent
213
+
214
+ # Initialize a new agent
215
+ agent = Agent(
216
+ model_name="gpt-4o-mini", # Specify the LLM
217
+ max_loops=1, # Set the number of interactions
218
+ interactive=True, # Enable interactive mode for real-time feedback
219
+ )
220
+
221
+ # Run the agent with a task
222
+ agent.run("What are the key benefits of using a multi-agent system?")
223
+ ```
224
+
225
+ ### 🤝 Your First Swarm: Multi-Agent Collaboration
226
+
227
+ A **Swarm** consists of multiple agents working together. This simple example creates a two-agent workflow for researching and writing a blog post. [Learn More About SequentialWorkflow](https://docs.swarms.world/en/latest/swarms/structs/sequential_workflow/)
228
+
229
+ ```python
230
+ from swarms import Agent, SequentialWorkflow
231
+
232
+ # Agent 1: The Researcher
233
+ researcher = Agent(
234
+ agent_name="Researcher",
235
+ system_prompt="Your job is to research the provided topic and provide a detailed summary.",
236
+ model_name="gpt-4o-mini",
237
+ )
238
+
239
+ # Agent 2: The Writer
240
+ writer = Agent(
241
+ agent_name="Writer",
242
+ system_prompt="Your job is to take the research summary and write a beautiful, engaging blog post about it.",
243
+ model_name="gpt-4o-mini",
244
+ )
245
+
246
+ # Create a sequential workflow where the researcher's output feeds into the writer's input
247
+ workflow = SequentialWorkflow(agents=[researcher, writer])
248
+
249
+ # Run the workflow on a task
250
+ final_post = workflow.run("The history and future of artificial intelligence")
251
+ print(final_post)
252
+
253
+ ```
254
+
255
+ -----
256
+
257
+ ## 🏗️ Multi-Agent Architectures For Production Deployments
258
+
259
+ `swarms` provides a variety of powerful, pre-built multi-agent architectures enabling you to orchestrate agents in various ways. Choose the right structure for your specific problem to build efficient and reliable production systems.
260
+
261
+ | **Architecture** | **Description** | **Best For** |
262
+ |---|---|---|
263
+ | **[SequentialWorkflow](https://docs.swarms.world/en/latest/swarms/structs/sequential_workflow/)** | Agents execute tasks in a linear chain; one agent's output is the next one's input. | Step-by-step processes like data transformation pipelines, report generation. |
264
+ | **[ConcurrentWorkflow](https://docs.swarms.world/en/latest/swarms/structs/concurrent_workflow/)** | Agents run tasks simultaneously for maximum efficiency. | High-throughput tasks like batch processing, parallel data analysis. |
265
+ | **[AgentRearrange](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/)** | Dynamically maps complex relationships (e.g., `a -> b, c`) between agents. | Flexible and adaptive workflows, task distribution, dynamic routing. |
266
+ | **[GraphWorkflow](https://docs.swarms.world/en/latest/swarms/structs/graph_workflow/)** | Orchestrates agents as nodes in a Directed Acyclic Graph (DAG). | Complex projects with intricate dependencies, like software builds. |
267
+ | **[MixtureOfAgents (MoA)](https://docs.swarms.world/en/latest/swarms/structs/moa/)** | Utilizes multiple expert agents in parallel and synthesizes their outputs. | Complex problem-solving, achieving state-of-the-art performance through collaboration. |
268
+ | **[GroupChat](https://docs.swarms.world/en/latest/swarms/structs/group_chat/)** | Agents collaborate and make decisions through a conversational interface. | Real-time collaborative decision-making, negotiations, brainstorming. |
269
+ | **[ForestSwarm](https://docs.swarms.world/en/latest/swarms/structs/forest_swarm/)** | Dynamically selects the most suitable agent or tree of agents for a given task. | Task routing, optimizing for expertise, complex decision-making trees. |
270
+ | **[SpreadSheetSwarm](https://docs.swarms.world/en/latest/swarms/structs/spreadsheet_swarm/)** | Manages thousands of agents concurrently, tracking tasks and outputs in a structured format. | Massive-scale parallel operations, large-scale data generation and analysis. |
271
+ | **[SwarmRouter](https://docs.swarms.world/en/latest/swarms/structs/swarm_router/)** | Universal orchestrator that provides a single interface to run any type of swarm with dynamic selection. | Simplifying complex workflows, switching between swarm strategies, unified multi-agent management. |
272
+
273
+ -----
274
+
275
+ ### SequentialWorkflow
276
+
277
+ A `SequentialWorkflow` executes tasks in a strict order, forming a pipeline where each agent builds upon the work of the previous one. `SequentialWorkflow` is Ideal for processes that have clear, ordered steps. This ensures that tasks with dependencies are handled correctly.
278
+
279
+ ```python
280
+ from swarms import Agent, SequentialWorkflow
281
+
282
+ # Initialize agents for a 3-step process
283
+ # 1. Generate an idea
284
+ idea_generator = Agent(agent_name="IdeaGenerator", system_prompt="Generate a unique startup idea.", model_name="gpt-4o-mini")
285
+ # 2. Validate the idea
286
+ validator = Agent(agent_name="Validator", system_prompt="Take this startup idea and analyze its market viability.", model_name="gpt-4o-mini")
287
+ # 3. Create a pitch
288
+ pitch_creator = Agent(agent_name="PitchCreator", system_prompt="Write a 3-sentence elevator pitch for this validated startup idea.", model_name="gpt-4o-mini")
289
+
290
+ # Create the sequential workflow
291
+ workflow = SequentialWorkflow(agents=[idea_generator, validator, pitch_creator])
292
+
293
+ # Run the workflow
294
+ elevator_pitch = workflow.run()
295
+ print(elevator_pitch)
296
+ ```
297
+
298
+ -----
299
+
300
+
301
+ ### ConcurrentWorkflow (with `SpreadSheetSwarm`)
302
+
303
+ A concurrent workflow runs multiple agents simultaneously. `SpreadSheetSwarm` is a powerful implementation that can manage thousands of concurrent agents and log their outputs to a CSV file. Use this architecture for high-throughput tasks that can be performed in parallel, drastically reducing execution time.
304
+
305
+ ```python
306
+ from swarms import Agent, SpreadSheetSwarm
307
+
308
+ # Define a list of tasks (e.g., social media posts to generate)
309
+ platforms = ["Twitter", "LinkedIn", "Instagram"]
310
+
311
+ # Create an agent for each task
312
+ agents = [
313
+ Agent(
314
+ agent_name=f"{platform}-Marketer",
315
+ system_prompt=f"Generate a real estate marketing post for {platform}.",
316
+ model_name="gpt-4o-mini",
317
+ )
318
+ for platform in platforms
319
+ ]
320
+
321
+ # Initialize the swarm to run these agents concurrently
322
+ swarm = SpreadSheetSwarm(
323
+ agents=agents,
324
+ autosave_on=True,
325
+ save_file_path="marketing_posts.csv",
326
+ )
327
+
328
+ # Run the swarm with a single, shared task description
329
+ property_description = "A beautiful 3-bedroom house in sunny California."
330
+ swarm.run(task=f"Generate a post about: {property_description}")
331
+ # Check marketing_posts.csv for the results!
332
+ ```
333
+
334
+ ---
335
+
336
+ ### AgentRearrange
337
+
338
+ Inspired by `einsum`, `AgentRearrange` lets you define complex, non-linear relationships between agents using a simple string-based syntax. [Learn more](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/). This architecture is Perfect for orchestrating dynamic workflows where agents might work in parallel, sequence, or a combination of both.
339
+
340
+ ```python
341
+ from swarms import Agent, AgentRearrange
342
+
343
+ # Define agents
344
+ researcher = Agent(agent_name="researcher", model_name="gpt-4o-mini")
345
+ writer = Agent(agent_name="writer", model_name="gpt-4o-mini")
346
+ editor = Agent(agent_name="editor", model_name="gpt-4o-mini")
347
+
348
+ # Define a flow: researcher sends work to both writer and editor simultaneously
349
+ # This is a one-to-many relationship
350
+ flow = "researcher -> writer, editor"
351
+
352
+ # Create the rearrangement system
353
+ rearrange_system = AgentRearrange(
354
+ agents=[researcher, writer, editor],
355
+ flow=flow,
356
+ )
357
+
358
+ # Run the system
359
+ # The researcher will generate content, and then both the writer and editor
360
+ # will process that content in parallel.
361
+ outputs = rearrange_system.run("Analyze the impact of AI on modern cinema.")
362
+ print(outputs)
363
+ ```
364
+
365
+
366
+ <!--
367
+ ### GraphWorkflow
368
+
369
+ `GraphWorkflow` orchestrates tasks using a Directed Acyclic Graph (DAG), allowing you to manage complex dependencies where some tasks must wait for others to complete.
370
+
371
+ **Description:** Essential for building sophisticated pipelines, like in software development or complex project management, where task order and dependencies are critical.
372
+
373
+ ```python
374
+ from swarms import Agent, GraphWorkflow, Node, Edge, NodeType
375
+
376
+ # Define agents and a simple python function as nodes
377
+ code_generator = Agent(agent_name="CodeGenerator", system_prompt="Write Python code for the given task.", model_name="gpt-4o-mini")
378
+ code_tester = Agent(agent_name="CodeTester", system_prompt="Test the given Python code and find bugs.", model_name="gpt-4o-mini")
379
+
380
+ # Create nodes for the graph
381
+ node1 = Node(id="generator", agent=code_generator)
382
+ node2 = Node(id="tester", agent=code_tester)
383
+
384
+ # Create the graph and define the dependency
385
+ graph = GraphWorkflow()
386
+ graph.add_nodes([node1, node2])
387
+ graph.add_edge(Edge(source="generator", target="tester")) # Tester runs after generator
388
+
389
+ # Set entry and end points
390
+ graph.set_entry_points(["generator"])
391
+ graph.set_end_points(["tester"])
392
+
393
+ # Run the graph workflow
394
+ results = graph.run("Create a function that calculates the factorial of a number.")
395
+ print(results)
396
+ ``` -->
397
+
398
+ ----
399
+
400
+ ### SwarmRouter: The Universal Swarm Orchestrator
401
+
402
+ The `SwarmRouter` simplifies building complex workflows by providing a single interface to run any type of swarm. Instead of importing and managing different swarm classes, you can dynamically select the one you need just by changing the `swarm_type` parameter. [Read the full documentation](https://docs.swarms.world/en/latest/swarms/structs/swarm_router/)
403
+
404
+ This makes your code cleaner and more flexible, allowing you to switch between different multi-agent strategies with ease. Here's a complete example that shows how to define agents and then use `SwarmRouter` to execute the same task using different collaborative strategies.
405
+
406
+ ```python
407
+ from swarms import Agent
408
+ from swarms.structs.swarm_router import SwarmRouter, SwarmType
409
+
410
+ # Define a few generic agents
411
+ writer = Agent(agent_name="Writer", system_prompt="You are a creative writer.", model_name="gpt-4o-mini")
412
+ editor = Agent(agent_name="Editor", system_prompt="You are an expert editor for stories.", model_name="gpt-4o-mini")
413
+ reviewer = Agent(agent_name="Reviewer", system_prompt="You are a final reviewer who gives a score.", model_name="gpt-4o-mini")
414
+
415
+ # The agents and task will be the same for all examples
416
+ agents = [writer, editor, reviewer]
417
+ task = "Write a short story about a robot who discovers music."
418
+
419
+ # --- Example 1: SequentialWorkflow ---
420
+ # Agents run one after another in a chain: Writer -> Editor -> Reviewer.
421
+ print("Running a Sequential Workflow...")
422
+ sequential_router = SwarmRouter(swarm_type=SwarmType.SequentialWorkflow, agents=agents)
423
+ sequential_output = sequential_router.run(task)
424
+ print(f"Final Sequential Output:\n{sequential_output}\n")
425
+
426
+ # --- Example 2: ConcurrentWorkflow ---
427
+ # All agents receive the same initial task and run at the same time.
428
+ print("Running a Concurrent Workflow...")
429
+ concurrent_router = SwarmRouter(swarm_type=SwarmType.ConcurrentWorkflow, agents=agents)
430
+ concurrent_outputs = concurrent_router.run(task)
431
+ # This returns a dictionary of each agent's output
432
+ for agent_name, output in concurrent_outputs.items():
433
+ print(f"Output from {agent_name}:\n{output}\n")
434
+
435
+ # --- Example 3: MixtureOfAgents ---
436
+ # All agents run in parallel, and a special 'aggregator' agent synthesizes their outputs.
437
+ print("Running a Mixture of Agents Workflow...")
438
+ aggregator = Agent(
439
+ agent_name="Aggregator",
440
+ system_prompt="Combine the story, edits, and review into a final document.",
441
+ model_name="gpt-4o-mini"
442
+ )
443
+ moa_router = SwarmRouter(
444
+ swarm_type=SwarmType.MixtureOfAgents,
445
+ agents=agents,
446
+ aggregator_agent=aggregator, # MoA requires an aggregator
447
+ )
448
+ aggregated_output = moa_router.run(task)
449
+ print(f"Final Aggregated Output:\n{aggregated_output}\n")
450
+ ```
451
+
452
+
453
+ The `SwarmRouter` is a powerful tool for simplifying multi-agent orchestration. It provides a consistent and flexible way to deploy different collaborative strategies, allowing you to build more sophisticated applications with less code.
454
+
455
+ -------
456
+
457
+ ### MixtureOfAgents (MoA)
458
+
459
+ The `MixtureOfAgents` architecture processes tasks by feeding them to multiple "expert" agents in parallel. Their diverse outputs are then synthesized by an aggregator agent to produce a final, high-quality result. [Learn more here](https://docs.swarms.world/en/latest/swarms/examples/moa_example/)
460
+
461
+ ```python
462
+ from swarms import Agent, MixtureOfAgents
463
+
464
+ # Define expert agents
465
+ financial_analyst = Agent(agent_name="FinancialAnalyst", system_prompt="Analyze financial data.", model_name="gpt-4o-mini")
466
+ market_analyst = Agent(agent_name="MarketAnalyst", system_prompt="Analyze market trends.", model_name="gpt-4o-mini")
467
+ risk_analyst = Agent(agent_name="RiskAnalyst", system_prompt="Analyze investment risks.", model_name="gpt-4o-mini")
468
+
469
+ # Define the aggregator agent
470
+ aggregator = Agent(
471
+ agent_name="InvestmentAdvisor",
472
+ system_prompt="Synthesize the financial, market, and risk analyses to provide a final investment recommendation.",
473
+ model_name="gpt-4o-mini"
474
+ )
475
+
476
+ # Create the MoA swarm
477
+ moa_swarm = MixtureOfAgents(
478
+ agents=[financial_analyst, market_analyst, risk_analyst],
479
+ aggregator_agent=aggregator,
480
+ )
481
+
482
+ # Run the swarm
483
+ recommendation = moa_swarm.run("Should we invest in NVIDIA stock right now?")
484
+ print(recommendation)
485
+ ```
486
+
487
+ ----
488
+
489
+ ### GroupChat
490
+
491
+ `GroupChat` creates a conversational environment where multiple agents can interact, discuss, and collaboratively solve a problem. You can define the speaking order or let it be determined dynamically. This architecture is ideal for tasks that benefit from debate and multi-perspective reasoning, such as contract negotiation, brainstorming, or complex decision-making.
492
+
493
+ ```python
494
+ from swarms import Agent, GroupChat
495
+
496
+ # Define agents for a debate
497
+ tech_optimist = Agent(agent_name="TechOptimist", system_prompt="Argue for the benefits of AI in society.", model_name="gpt-4o-mini")
498
+ tech_critic = Agent(agent_name="TechCritic", system_prompt="Argue against the unchecked advancement of AI.", model_name="gpt-4o-mini")
499
+
500
+ # Create the group chat
501
+ chat = GroupChat(
502
+ agents=[tech_optimist, tech_critic],
503
+ max_loops=4, # Limit the number of turns in the conversation
504
+ )
505
+
506
+ # Run the chat with an initial topic
507
+ conversation_history = chat.run(
508
+ "Let's discuss the societal impact of artificial intelligence."
509
+ )
510
+
511
+ # Print the full conversation
512
+ for message in conversation_history:
513
+ print(f"[{message['agent_name']}]: {message['content']}")
514
+ ```
515
+
516
+ ---
517
+
518
+ ## Documentation
519
+
520
+ Documentation is located here at: [docs.swarms.world](https://docs.swarms.world)
521
+
522
+
523
+ ---
524
+
525
+
526
+ ## Guides and Walkthroughs
527
+
528
+ Here are quick reference guides on how to get started with swarms.
529
+
530
+ | Section | Description | Links |
531
+ |----------------------|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|
532
+ | Installation | Complete setup guide for Swarms in your environment | [Installation](https://docs.swarms.world/en/latest/swarms/install/install/) |
533
+ | Quickstart | Get up and running with your first swarm in minutes | [Get Started](https://docs.swarms.world/en/latest/swarms/install/quickstart/) |
534
+ | Agent Internal Mechanisms | Deep dive into how agents work internally | [Agent Architecture](https://docs.swarms.world/en/latest/swarms/framework/agents_explained/) |
535
+ | Agent API | Complete reference for the Agent class and its methods | [Agent API](https://docs.swarms.world/en/latest/swarms/structs/agent/) |
536
+ | Integrating External Agents | Connect Swarms with other AI frameworks like Griptape and Autogen | [Integrating External APIs](https://docs.swarms.world/en/latest/swarms/agents/external_party_agents/) |
537
+ | Creating Agents from YAML | Define and configure agents using YAML configuration files | [Creating Agents from YAML](https://docs.swarms.world/en/latest/swarms/agents/create_agents_yaml/) |
538
+ | Why You Need Swarms | Understanding the benefits of multi-agent collaboration | [Why Multi-Agent Collaboration is Necessary](https://docs.swarms.world/en/latest/swarms/concept/why/) |
539
+ | Multi-Agent Architectures Analysis | Comprehensive analysis of different swarm patterns and architectures | [Multi-Agent Architectures](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/) |
540
+ | Choosing the Right Swarm | Guide to selecting the optimal swarm architecture for your specific business needs | [Business Problem Guide](https://docs.swarms.world/en/latest/swarms/concept/swarm_architectures/) |
541
+ | AgentRearrange Docs | Documentation for dynamic agent rearrangement and workflow optimization | [AgentRearrange API](https://docs.swarms.world/en/latest/swarms/structs/agent_rearrange/) |
542
+
543
+
544
+
545
+ ---
546
+
547
+
548
+ ## 🫶 Contribute to Swarms
549
+
550
+ Swarms is built by the community, for the community. We believe that collaborative development is the key to pushing the boundaries of what's possible with multi-agent AI. Your contributions are not only welcome—they are essential to our mission. [Learn more about why you should contribute to swarms](https://docs.swarms.world/en/latest/contributors/main/)
551
+
552
+ ### Why Contribute?
553
+
554
+ By joining us, you have the opportunity to:
555
+
556
+ * 🚀 **Work on the Frontier of agents:** Shape the future of autonomous agent technology and help build a production-grade, open-source framework.
557
+
558
+ * 🤝 **Join a Vibrant Community:** Collaborate with a passionate and growing group of agent developers, researchers, and AI enthusiasts.
559
+
560
+ * 🛠️ **Make a Tangible Impact:** Whether you're fixing a bug, adding a new feature, or improving documentation, your work will be used in real-world applications.
561
+
562
+ * 📚 **Learn and Grow:** Gain hands-on experience with advanced AI concepts and strengthen your software engineering skills.
563
+
564
+ Discover more about our mission and the benefits of becoming a contributor in our official [**Contributor's Guide**](https://docs.swarms.world/en/latest/contributors/main/).
565
+
566
+ ### How to Get Started
567
+
568
+ We've made it easy to start contributing. Here's how you can help:
569
+
570
+ 1. **Find an Issue to Tackle:** The best way to begin is by visiting our [**contributing project board**](https://github.com/users/kyegomez/projects/1). Look for issues tagged with `good first issue`—these are specifically selected for new contributors.
571
+
572
+ 2. **Report a Bug or Request a Feature:** Have a new idea or found something that isn't working right? We'd love to hear from you. Please [**file a Bug Report or Feature Request**](https://github.com/kyegomez/swarms/issues) on our GitHub Issues page.
573
+
574
+ 3. **Understand Our Workflow and Standards:** Before submitting your work, please review our complete [**Contribution Guidelines**](https://github.com/kyegomez/swarms/blob/master/CONTRIBUTING.md). To help maintain code quality, we also encourage you to read our guide on [**Code Cleanliness**](https://docs.swarms.world/en/latest/swarms/framework/code_cleanliness/).
575
+
576
+ 4. **Join the Discussion:** To participate in roadmap discussions and connect with other developers, join our community on [**Discord**](https://discord.gg/jM3Z6M9uMq).
577
+
578
+
579
+ ### ✨ Our Valued Contributors
580
+
581
+ Thank you for contributing to swarms. Your work is extremely appreciated and recognized.
582
+
583
+ <a href="https://github.com/kyegomez/swarms/graphs/contributors">
584
+ <img src="https://contrib.rocks/image?repo=kyegomez/swarms" />
585
+ </a>
586
+
587
+ -----
588
+
589
+ ## Connect With Us
590
+
591
+ Join our community of agent engineers and researchers for technical support, cutting-edge updates, and exclusive access to world-class agent engineering insights!
592
+
593
+ | Platform | Description | Link |
594
+ |----------|-------------|------|
595
+ | 📚 Documentation | Official documentation and guides | [docs.swarms.world](https://docs.swarms.world) |
596
+ | 📝 Blog | Latest updates and technical articles | [Medium](https://medium.com/@kyeg) |
597
+ | 💬 Discord | Live chat and community support | [Join Discord](https://discord.gg/jM3Z6M9uMq) |
598
+ | 🐦 Twitter | Latest news and announcements | [@kyegomez](https://twitter.com/kyegomez) |
599
+ | 👥 LinkedIn | Professional network and updates | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) |
600
+ | 📺 YouTube | Tutorials and demos | [Swarms Channel](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) |
601
+ | 🎫 Events | Join our community events | [Sign up here](https://lu.ma/5p2jnc2v) |
602
+ | 🚀 Onboarding Session | Get onboarded with Kye Gomez, creator and lead maintainer of Swarms | [Book Session](https://cal.com/swarms/swarms-onboarding-session) |
603
+
604
+ ------
605
+
606
+ ## Citation
607
+
608
+ If you use **swarms** in your research, please cite the project by referencing the metadata in [CITATION.cff](./CITATION.cff).
609
+
610
+ ```bibtex
611
+ @misc{SWARMS_2022,
612
+ author = {Gomez, Kye and Pliny and More, Harshal and Swarms Community},
613
+ title = {{Swarms: Production-Grade Multi-Agent Infrastructure Platform}},
614
+ year = {2022},
615
+ howpublished = {\url{https://github.com/kyegomez/swarms}},
616
+ note = {Documentation available at \url{https://docs.swarms.world}},
617
+ version = {latest}
618
+ }
619
+ ```
620
+
621
+ # License
622
+
623
+ APACHE
624
+
625
+
626
+