swarms 7.6.1__tar.gz → 7.6.2__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 (192) hide show
  1. {swarms-7.6.1 → swarms-7.6.2}/PKG-INFO +1 -1
  2. {swarms-7.6.1 → swarms-7.6.2}/pyproject.toml +1 -1
  3. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/__init__.py +6 -4
  4. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/reasoning_agents.py +10 -0
  5. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/__init__.py +6 -3
  6. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/agent.py +37 -8
  7. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/concurrent_workflow.py +1 -1
  8. swarms-7.6.2/swarms/structs/dynamic_conversational_swarm.py +226 -0
  9. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/hiearchical_swarm.py +1 -1
  10. swarms-7.6.2/swarms/structs/hybrid_hiearchical_peer_swarm.py +273 -0
  11. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/majority_voting.py +1 -1
  12. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/mixture_of_agents.py +1 -1
  13. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/multi_agent_orchestrator.py +1 -1
  14. swarms-7.6.1/swarms/structs/output_type.py → swarms-7.6.2/swarms/structs/output_types.py +2 -1
  15. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/rearrange.py +1 -1
  16. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/sequential_workflow.py +1 -1
  17. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_router.py +1 -1
  18. {swarms-7.6.1 → swarms-7.6.2}/swarms/telemetry/main.py +7 -3
  19. swarms-7.6.2/swarms/tools/tool_schema_base_model.py +57 -0
  20. swarms-7.6.1/swarms/structs/agent_security.py +0 -318
  21. swarms-7.6.1/swarms/structs/airflow_swarm.py +0 -430
  22. swarms-7.6.1/swarms/structs/output_types.py +0 -16
  23. {swarms-7.6.1 → swarms-7.6.2}/LICENSE +0 -0
  24. {swarms-7.6.1 → swarms-7.6.2}/README.md +0 -0
  25. {swarms-7.6.1 → swarms-7.6.2}/swarms/__init__.py +0 -0
  26. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/agent_judge.py +0 -0
  27. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/agent_print.py +0 -0
  28. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/ape_agent.py +0 -0
  29. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/auto_generate_swarm_config.py +0 -0
  30. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/consistency_agent.py +0 -0
  31. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/create_agents_from_yaml.py +0 -0
  32. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/flexion_agent.py +0 -0
  33. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/gkp_agent.py +0 -0
  34. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/i_agent.py +0 -0
  35. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/openai_assistant.py +0 -0
  36. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/reasoning_duo.py +0 -0
  37. {swarms-7.6.1 → swarms-7.6.2}/swarms/agents/tool_agent.py +0 -0
  38. {swarms-7.6.1 → swarms-7.6.2}/swarms/artifacts/__init__.py +0 -0
  39. {swarms-7.6.1 → swarms-7.6.2}/swarms/artifacts/main_artifact.py +0 -0
  40. {swarms-7.6.1 → swarms-7.6.2}/swarms/cli/__init__.py +0 -0
  41. {swarms-7.6.1 → swarms-7.6.2}/swarms/cli/create_agent.py +0 -0
  42. {swarms-7.6.1 → swarms-7.6.2}/swarms/cli/main.py +0 -0
  43. {swarms-7.6.1 → swarms-7.6.2}/swarms/cli/onboarding_process.py +0 -0
  44. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/__init__.py +0 -0
  45. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/accountant_swarm_prompts.py +0 -0
  46. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/ag_prompt.py +0 -0
  47. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/aga.py +0 -0
  48. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/agent_judge_prompt.py +0 -0
  49. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/agent_prompt.py +0 -0
  50. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/agent_prompts.py +0 -0
  51. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/agent_system_prompts.py +0 -0
  52. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/ai_research_team.py +0 -0
  53. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/aot_prompt.py +0 -0
  54. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/autobloggen.py +0 -0
  55. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/autoswarm.py +0 -0
  56. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/chat_prompt.py +0 -0
  57. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/code_interpreter.py +0 -0
  58. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/code_spawner.py +0 -0
  59. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/debate.py +0 -0
  60. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/documentation.py +0 -0
  61. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/education.py +0 -0
  62. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/finance_agent_prompt.py +0 -0
  63. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/finance_agent_sys_prompt.py +0 -0
  64. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/growth_agent_prompt.py +0 -0
  65. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/idea2img.py +0 -0
  66. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/legal_agent_prompt.py +0 -0
  67. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/logistics.py +0 -0
  68. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/meta_system_prompt.py +0 -0
  69. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/multi_modal_autonomous_instruction_prompt.py +0 -0
  70. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/multi_modal_prompts.py +0 -0
  71. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/multi_modal_visual_prompts.py +0 -0
  72. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/operations_agent_prompt.py +0 -0
  73. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/personal_stylist.py +0 -0
  74. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/product_agent_prompt.py +0 -0
  75. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/programming.py +0 -0
  76. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/project_manager.py +0 -0
  77. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/prompt.py +0 -0
  78. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/prompt_generator.py +0 -0
  79. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/prompt_generator_optimizer.py +0 -0
  80. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/python.py +0 -0
  81. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/react.py +0 -0
  82. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/reasoning_prompt.py +0 -0
  83. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/refiner_agent_prompt.py +0 -0
  84. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/sales.py +0 -0
  85. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/sales_prompts.py +0 -0
  86. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/security_team.py +0 -0
  87. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/self_operating_prompt.py +0 -0
  88. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/sop_generator_agent_prompt.py +0 -0
  89. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/summaries_prompts.py +0 -0
  90. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/support_agent_prompt.py +0 -0
  91. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/swarm_manager_agent.py +0 -0
  92. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/task_assignment_prompt.py +0 -0
  93. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/tests.py +0 -0
  94. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/tools.py +0 -0
  95. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/urban_planning.py +0 -0
  96. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/visual_cot.py +0 -0
  97. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/worker_prompt.py +0 -0
  98. {swarms-7.6.1 → swarms-7.6.2}/swarms/prompts/xray_swarm_prompt.py +0 -0
  99. {swarms-7.6.1 → swarms-7.6.2}/swarms/schemas/__init__.py +0 -0
  100. {swarms-7.6.1 → swarms-7.6.2}/swarms/schemas/agent_input_schema.py +0 -0
  101. {swarms-7.6.1 → swarms-7.6.2}/swarms/schemas/agent_step_schemas.py +0 -0
  102. {swarms-7.6.1 → swarms-7.6.2}/swarms/schemas/base_schemas.py +0 -0
  103. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/agent_builder.py +0 -0
  104. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/agent_registry.py +0 -0
  105. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/agent_roles.py +0 -0
  106. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/agent_router.py +0 -0
  107. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/agents_available.py +0 -0
  108. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/async_workflow.py +0 -0
  109. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/auto_swarm.py +0 -0
  110. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/auto_swarm_builder.py +0 -0
  111. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/base_structure.py +0 -0
  112. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/base_swarm.py +0 -0
  113. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/base_workflow.py +0 -0
  114. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/concat.py +0 -0
  115. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/conversation.py +0 -0
  116. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/csv_to_agent.py +0 -0
  117. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/de_hallucination_swarm.py +0 -0
  118. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/deep_research_swarm.py +0 -0
  119. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/graph_swarm.py +0 -0
  120. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/graph_workflow.py +0 -0
  121. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/groupchat.py +0 -0
  122. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/malt.py +0 -0
  123. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/matrix_swarm.py +0 -0
  124. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/meme_agent_persona_generator.py +0 -0
  125. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/model_router.py +0 -0
  126. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/multi_agent_collab.py +0 -0
  127. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/multi_agent_exec.py +0 -0
  128. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/octotools.py +0 -0
  129. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/omni_agent_types.py +0 -0
  130. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/pulsar_swarm.py +0 -0
  131. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/queue_swarm.py +0 -0
  132. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/round_robin.py +0 -0
  133. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/safe_loading.py +0 -0
  134. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/spreadsheet_swarm.py +0 -0
  135. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/stopping_conditions.py +0 -0
  136. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_arange.py +0 -0
  137. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_builder.py +0 -0
  138. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_eval.py +0 -0
  139. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_id_generator.py +0 -0
  140. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_load_balancer.py +0 -0
  141. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_matcher.py +0 -0
  142. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_output_type.py +0 -0
  143. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarm_registry.py +0 -0
  144. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarming_architectures.py +0 -0
  145. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/swarms_api.py +0 -0
  146. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/talk_hier.py +0 -0
  147. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/tree_swarm.py +0 -0
  148. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/utils.py +0 -0
  149. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/various_alt_swarms.py +0 -0
  150. {swarms-7.6.1 → swarms-7.6.2}/swarms/structs/workspace_manager.py +0 -0
  151. {swarms-7.6.1 → swarms-7.6.2}/swarms/telemetry/__init__.py +0 -0
  152. {swarms-7.6.1 → swarms-7.6.2}/swarms/telemetry/bootup.py +0 -0
  153. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/__init__.py +0 -0
  154. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/base_tool.py +0 -0
  155. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/cohere_func_call_schema.py +0 -0
  156. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/func_calling_utils.py +0 -0
  157. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/func_to_str.py +0 -0
  158. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/function_util.py +0 -0
  159. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/json_former.py +0 -0
  160. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/json_utils.py +0 -0
  161. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/logits_processor.py +0 -0
  162. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/mcp_integration.py +0 -0
  163. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/openai_func_calling_schema_pydantic.py +0 -0
  164. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/openai_tool_creator_decorator.py +0 -0
  165. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/py_func_to_openai_func_str.py +0 -0
  166. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/pydantic_to_json.py +0 -0
  167. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/tool_parse_exec.py +0 -0
  168. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/tool_registry.py +0 -0
  169. {swarms-7.6.1 → swarms-7.6.2}/swarms/tools/tool_utils.py +0 -0
  170. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/__init__.py +0 -0
  171. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/agent_ops_check.py +0 -0
  172. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/any_to_str.py +0 -0
  173. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/auto_download_check_packages.py +0 -0
  174. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/calculate_func_metrics.py +0 -0
  175. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/data_to_text.py +0 -0
  176. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/disable_logging.py +0 -0
  177. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/file_processing.py +0 -0
  178. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/formatter.py +0 -0
  179. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/function_caller_model.py +0 -0
  180. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/history_output_formatter.py +0 -0
  181. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/litellm_tokenizer.py +0 -0
  182. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/litellm_wrapper.py +0 -0
  183. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/loguru_logger.py +0 -0
  184. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/markdown_message.py +0 -0
  185. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/pandas_utils.py +0 -0
  186. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/parse_code.py +0 -0
  187. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/pdf_to_text.py +0 -0
  188. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/str_to_dict.py +0 -0
  189. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/swarm_reliability_checks.py +0 -0
  190. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/try_except_wrapper.py +0 -0
  191. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/visualizer.py +0 -0
  192. {swarms-7.6.1 → swarms-7.6.2}/swarms/utils/wrapper_clusterop.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: swarms
3
- Version: 7.6.1
3
+ Version: 7.6.2
4
4
  Summary: Swarms - TGSC
5
5
  Home-page: https://github.com/kyegomez/swarms
6
6
  License: MIT
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
5
5
 
6
6
  [tool.poetry]
7
7
  name = "swarms"
8
- version = "7.6.1"
8
+ version = "7.6.2"
9
9
  description = "Swarms - TGSC"
10
10
  license = "MIT"
11
11
  authors = ["Kye Gomez <kye@apac.ai>"]
@@ -1,9 +1,10 @@
1
+ from swarms.agents.agent_judge import AgentJudge
1
2
  from swarms.agents.consistency_agent import SelfConsistencyAgent
2
-
3
- # from swarms.agents.tool_agent import ToolAgent
4
3
  from swarms.agents.create_agents_from_yaml import (
5
4
  create_agents_from_yaml,
6
5
  )
6
+ from swarms.agents.flexion_agent import ReflexionAgent
7
+ from swarms.agents.gkp_agent import GKPAgent
7
8
  from swarms.agents.i_agent import IterativeReflectiveExpansion
8
9
  from swarms.agents.reasoning_agents import (
9
10
  ReasoningAgentRouter,
@@ -23,8 +24,8 @@ from swarms.structs.stopping_conditions import (
23
24
  check_success,
24
25
  )
25
26
 
26
- from swarms.agents.flexion_agent import ReflexionAgent
27
- from swarms.agents.gkp_agent import GKPAgent
27
+ # Hybrid Hierarchical-Peer Model
28
+
28
29
 
29
30
  __all__ = [
30
31
  # "ToolAgent",
@@ -46,4 +47,5 @@ __all__ = [
46
47
  "agent_types",
47
48
  "ReflexionAgent",
48
49
  "GKPAgent",
50
+ "AgentJudge",
49
51
  ]
@@ -8,6 +8,7 @@ from swarms.agents.i_agent import (
8
8
  )
9
9
  from swarms.agents.reasoning_duo import ReasoningDuo
10
10
  from swarms.structs.output_types import OutputType
11
+ from swarms.agents.agent_judge import AgentJudge
11
12
 
12
13
  agent_types = Literal[
13
14
  "reasoning-duo",
@@ -18,6 +19,7 @@ agent_types = Literal[
18
19
  "ire-agent",
19
20
  "ReflexionAgent",
20
21
  "GKPAgent",
22
+ "AgentJudge",
21
23
  ]
22
24
 
23
25
 
@@ -106,6 +108,14 @@ class ReasoningAgentRouter:
106
108
  output_type=self.output_type,
107
109
  )
108
110
 
111
+ elif self.swarm_type == "AgentJudge":
112
+ return AgentJudge(
113
+ agent_name=self.agent_name,
114
+ model_name=self.model_name,
115
+ system_prompt=self.system_prompt,
116
+ max_loops=self.max_loops,
117
+ )
118
+
109
119
  elif self.swarm_type == "ReflexionAgent":
110
120
  return ReflexionAgent(
111
121
  agent_name=self.agent_name,
@@ -8,6 +8,8 @@ from swarms.structs.base_swarm import BaseSwarm
8
8
  from swarms.structs.base_workflow import BaseWorkflow
9
9
  from swarms.structs.concurrent_workflow import ConcurrentWorkflow
10
10
  from swarms.structs.conversation import Conversation
11
+ from swarms.structs.de_hallucination_swarm import DeHallucinationSwarm
12
+ from swarms.structs.deep_research_swarm import DeepResearchSwarm
11
13
  from swarms.structs.graph_workflow import (
12
14
  Edge,
13
15
  GraphWorkflow,
@@ -18,6 +20,9 @@ from swarms.structs.groupchat import (
18
20
  GroupChat,
19
21
  expertise_based,
20
22
  )
23
+ from swarms.structs.hybrid_hiearchical_peer_swarm import (
24
+ HybridHierarchicalClusterSwarm,
25
+ )
21
26
  from swarms.structs.majority_voting import (
22
27
  MajorityVoting,
23
28
  majority_voting,
@@ -83,9 +88,6 @@ from swarms.structs.swarms_api import (
83
88
  SwarmValidationError,
84
89
  )
85
90
 
86
- from swarms.structs.de_hallucination_swarm import DeHallucinationSwarm
87
- from swarms.structs.deep_research_swarm import DeepResearchSwarm
88
-
89
91
  __all__ = [
90
92
  "Agent",
91
93
  "AsyncWorkflow",
@@ -161,4 +163,5 @@ __all__ = [
161
163
  "MALT",
162
164
  "DeHallucinationSwarm",
163
165
  "DeepResearchSwarm",
166
+ "HybridHierarchicalClusterSwarm",
164
167
  ]
@@ -6,6 +6,7 @@ import random
6
6
  import threading
7
7
  import time
8
8
  import uuid
9
+
9
10
  from concurrent.futures import ThreadPoolExecutor
10
11
  from datetime import datetime
11
12
  from typing import (
@@ -49,12 +50,14 @@ from swarms.structs.safe_loading import (
49
50
  from swarms.telemetry.main import log_agent_data
50
51
  from swarms.tools.base_tool import BaseTool
51
52
  from swarms.tools.tool_parse_exec import parse_and_execute_json
53
+ from swarms.utils.any_to_str import any_to_str
52
54
  from swarms.utils.data_to_text import data_to_text
53
55
  from swarms.utils.file_processing import create_file_in_folder
54
56
  from swarms.utils.formatter import formatter
55
57
  from swarms.utils.litellm_tokenizer import count_tokens
56
58
  from swarms.utils.pdf_to_text import pdf_to_text
57
59
  from swarms.structs.agent_roles import agent_roles
60
+ from swarms.utils.str_to_dict import str_to_dict
58
61
 
59
62
 
60
63
  # Utils
@@ -803,7 +806,7 @@ class Agent:
803
806
  # Main function
804
807
  def _run(
805
808
  self,
806
- task: Optional[str] = None,
809
+ task: Optional[Union[str, Any]] = None,
807
810
  img: Optional[str] = None,
808
811
  speech: Optional[str] = None,
809
812
  video: Optional[str] = None,
@@ -1113,6 +1116,7 @@ class Agent:
1113
1116
  # )
1114
1117
 
1115
1118
  log_agent_data(self.to_dict())
1119
+
1116
1120
  if self.autosave is True:
1117
1121
  self.save()
1118
1122
 
@@ -2494,7 +2498,7 @@ class Agent:
2494
2498
 
2495
2499
  def run(
2496
2500
  self,
2497
- task: Optional[str] = None,
2501
+ task: Optional[Union[str, Any]] = None,
2498
2502
  img: Optional[str] = None,
2499
2503
  device: Optional[str] = "cpu", # gpu
2500
2504
  device_id: Optional[int] = 0,
@@ -2531,6 +2535,9 @@ class Agent:
2531
2535
  Exception: If any other error occurs during execution.
2532
2536
  """
2533
2537
 
2538
+ if not isinstance(task, str):
2539
+ task = any_to_str(task)
2540
+
2534
2541
  if scheduled_run_date:
2535
2542
  while datetime.now() < scheduled_run_date:
2536
2543
  time.sleep(
@@ -2539,13 +2546,18 @@ class Agent:
2539
2546
 
2540
2547
  try:
2541
2548
  # If cluster ops disabled, run directly
2542
- return self._run(
2549
+ output = self._run(
2543
2550
  task=task,
2544
2551
  img=img,
2545
2552
  *args,
2546
2553
  **kwargs,
2547
2554
  )
2548
2555
 
2556
+ if self.tools_list_dictionary is not None:
2557
+ return str_to_dict(output)
2558
+ else:
2559
+ return output
2560
+
2549
2561
  except ValueError as e:
2550
2562
  self._handle_run_error(e)
2551
2563
 
@@ -2635,7 +2647,7 @@ class Agent:
2635
2647
  )
2636
2648
 
2637
2649
  return agent.run(
2638
- task=f"From {self.agent_name}: {output}",
2650
+ task=f"From {self.agent_name}: Message: {output}",
2639
2651
  img=img,
2640
2652
  *args,
2641
2653
  **kwargs,
@@ -2651,10 +2663,27 @@ class Agent:
2651
2663
  """
2652
2664
  Talk to multiple agents.
2653
2665
  """
2654
- outputs = []
2655
- for agent in agents:
2656
- output = self.talk_to(agent, task, *args, **kwargs)
2657
- outputs.append(output)
2666
+ # o# Use the existing executor from self.executor or create a new one if needed
2667
+ with ThreadPoolExecutor() as executor:
2668
+ # Create futures for each agent conversation
2669
+ futures = [
2670
+ executor.submit(
2671
+ self.talk_to, agent, task, *args, **kwargs
2672
+ )
2673
+ for agent in agents
2674
+ ]
2675
+
2676
+ # Wait for all futures to complete and collect results
2677
+ outputs = []
2678
+ for future in futures:
2679
+ try:
2680
+ result = future.result()
2681
+ outputs.append(result)
2682
+ except Exception as e:
2683
+ logger.error(f"Error in agent communication: {e}")
2684
+ outputs.append(
2685
+ None
2686
+ ) # or handle error case as needed
2658
2687
 
2659
2688
  return outputs
2660
2689
 
@@ -12,7 +12,7 @@ from swarms.utils.file_processing import create_file_in_folder
12
12
  from swarms.utils.loguru_logger import initialize_logger
13
13
  from swarms.structs.conversation import Conversation
14
14
  from swarms.structs.swarm_id_generator import generate_swarm_id
15
- from swarms.structs.output_type import OutputType
15
+ from swarms.structs.output_types import OutputType
16
16
 
17
17
  logger = initialize_logger(log_folder="concurrent_workflow")
18
18
 
@@ -0,0 +1,226 @@
1
+ import json
2
+ import random
3
+ from swarms.structs.agent import Agent
4
+ from typing import List
5
+ from swarms.structs.conversation import Conversation
6
+ from swarms.utils.history_output_formatter import (
7
+ history_output_formatter,
8
+ )
9
+ from swarms.utils.any_to_str import any_to_str
10
+
11
+ tools = [
12
+ {
13
+ "type": "function",
14
+ "function": {
15
+ "name": "select_agent",
16
+ "description": "Analyzes the input task and selects the most appropriate agent configuration, outputting both the agent name and the formatted response.",
17
+ "parameters": {
18
+ "type": "object",
19
+ "properties": {
20
+ "respond_or_no_respond": {
21
+ "type": "boolean",
22
+ "description": "Whether the agent should respond to the response or not.",
23
+ },
24
+ "reasoning": {
25
+ "type": "string",
26
+ "description": "The reasoning behind the selection of the agent and response.",
27
+ },
28
+ "agent_name": {
29
+ "type": "string",
30
+ "description": "The name of the selected agent that is most appropriate for handling the given task.",
31
+ },
32
+ "response": {
33
+ "type": "string",
34
+ "description": "A clear and structured description of the response for the next agent.",
35
+ },
36
+ },
37
+ "required": [
38
+ "reasoning",
39
+ "agent_name",
40
+ "response",
41
+ "respond_or_no_respond",
42
+ ],
43
+ },
44
+ },
45
+ },
46
+ ]
47
+
48
+
49
+ class DynamicConversationalSwarm:
50
+ def __init__(
51
+ self,
52
+ name: str = "Dynamic Conversational Swarm",
53
+ description: str = "A swarm that uses a dynamic conversational model to solve complex tasks.",
54
+ agents: List[Agent] = [],
55
+ max_loops: int = 1,
56
+ output_type: str = "list",
57
+ *args,
58
+ **kwargs,
59
+ ):
60
+ self.name = name
61
+ self.description = description
62
+ self.agents = agents
63
+ self.max_loops = max_loops
64
+ self.output_type = output_type
65
+
66
+ self.conversation = Conversation()
67
+
68
+ # Agents in the chat
69
+ agents_in_chat = self.get_agents_info()
70
+ self.conversation.add(
71
+ role="Conversation Log", content=agents_in_chat
72
+ )
73
+
74
+ self.inject_tools()
75
+
76
+ # Inject tools into the agents
77
+ def inject_tools(self):
78
+ for agent in self.agents:
79
+ agent.tools_list_dictionary = tools
80
+
81
+ def parse_json_into_dict(self, json_str: str) -> dict:
82
+ try:
83
+ return json.loads(json_str)
84
+ except json.JSONDecodeError:
85
+ raise ValueError("Invalid JSON string")
86
+
87
+ def find_agent_by_name(self, agent_name: str) -> Agent:
88
+ for agent in self.agents:
89
+ if agent.name == agent_name:
90
+ return agent
91
+ raise ValueError(f"Agent with name {agent_name} not found")
92
+
93
+ def run_agent(self, agent_name: str, task: str) -> str:
94
+ agent = self.find_agent_by_name(agent_name)
95
+ return agent.run(task)
96
+
97
+ def fetch_random_agent_name(self) -> str:
98
+ return random.choice(self.agents).agent_name
99
+
100
+ def run(self, task: str) -> str:
101
+ """
102
+ Run the dynamic conversational swarm for a specified number of loops.
103
+ Each agent has access to the full conversation history.
104
+
105
+ Args:
106
+ task (str): The initial task/prompt to process
107
+
108
+ Returns:
109
+ str: The final response after all loops are complete
110
+ """
111
+ self.conversation.add(
112
+ role=f"{self.fetch_random_agent_name()}", content=task
113
+ )
114
+
115
+ # for loop in range(self.max_loops):
116
+ # # Add loop marker to conversation for clarity
117
+ # self.conversation.add(
118
+ # role="System",
119
+ # content=f"=== Starting Loop {loop + 1}/{self.max_loops} ==="
120
+ # )
121
+
122
+ # # First agent interaction
123
+ # current_agent = self.randomly_select_agent()
124
+ # response = self.run_agent(current_agent.name, self.conversation.get_str())
125
+ # self.conversation.add(role=current_agent.name, content=any_to_str(response))
126
+
127
+ # try:
128
+ # # Parse response and get next agent
129
+ # response_dict = self.parse_json_into_dict(response)
130
+
131
+ # # Check if we should continue or end the loop
132
+ # if not response_dict.get("respond_or_no_respond", True):
133
+ # break
134
+
135
+ # # Get the task description for the next agent
136
+ # next_task = response_dict.get("task_description", self.conversation.get_str())
137
+
138
+ # # Run the next agent with the specific task description
139
+ # next_agent = self.find_agent_by_name(response_dict["agent_name"])
140
+ # next_response = self.run_agent(next_agent.name, next_task)
141
+
142
+ # # Add both the task description and response to the conversation
143
+ # self.conversation.add(
144
+ # role="System",
145
+ # content=f"Response from {response_dict['agent_name']}: {next_task}"
146
+ # )
147
+ # self.conversation.add(role=next_agent.name, content=any_to_str(next_response))
148
+
149
+ # except (ValueError, KeyError) as e:
150
+ # self.conversation.add(
151
+ # role="System",
152
+ # content=f"Error in loop {loop + 1}: {str(e)}"
153
+ # )
154
+ # break
155
+
156
+ # Run first agent
157
+ current_agent = self.randomly_select_agent()
158
+ response = self.run_agent(
159
+ current_agent.agent_name, self.conversation.get_str()
160
+ )
161
+ self.conversation.add(
162
+ role=current_agent.agent_name,
163
+ content=any_to_str(response),
164
+ )
165
+
166
+ # Convert to json
167
+ response_dict = self.parse_json_into_dict(response)
168
+
169
+ # Fetch task
170
+ respone_two = response_dict["response"]
171
+ agent_name = response_dict["agent_name"]
172
+
173
+ print(f"Response from {agent_name}: {respone_two}")
174
+
175
+ # Run next agent
176
+ next_response = self.run_agent(
177
+ agent_name, self.conversation.get_str()
178
+ )
179
+ self.conversation.add(
180
+ role=agent_name, content=any_to_str(next_response)
181
+ )
182
+
183
+ # # Get the next agent
184
+ # response_three = self.parse_json_into_dict(next_response)
185
+ # agent_name_three = response_three["agent_name"]
186
+ # respone_four = response_three["response"]
187
+
188
+ # print(f"Response from {agent_name_three}: {respone_four}")
189
+ # # Run the next agent
190
+ # next_response = self.run_agent(agent_name_three, self.conversation.get_str())
191
+ # self.conversation.add(role=agent_name_three, content=any_to_str(next_response))
192
+
193
+ # Format and return the final conversation history
194
+ return history_output_formatter(
195
+ self.conversation, type=self.output_type
196
+ )
197
+
198
+ def randomly_select_agent(self) -> Agent:
199
+ return random.choice(self.agents)
200
+
201
+ def get_agents_info(self) -> str:
202
+ """
203
+ Fetches and formats information about all available agents in the system.
204
+
205
+ Returns:
206
+ str: A formatted string containing names and descriptions of all agents.
207
+ """
208
+ if not self.agents:
209
+ return "No agents currently available in the system."
210
+
211
+ agents_info = [
212
+ "Agents In the System:",
213
+ "",
214
+ ] # Empty string for line spacing
215
+
216
+ for idx, agent in enumerate(self.agents, 1):
217
+ agents_info.extend(
218
+ [
219
+ f"[Agent {idx}]",
220
+ f"Name: {agent.name}",
221
+ f"Description: {agent.description}",
222
+ "", # Empty string for line spacing between agents
223
+ ]
224
+ )
225
+
226
+ return "\n".join(agents_info).strip()
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
8
8
  from swarms.structs.agent import Agent
9
9
  from swarms.structs.base_swarm import BaseSwarm
10
10
  from swarms.structs.conversation import Conversation
11
- from swarms.structs.output_type import OutputType
11
+ from swarms.structs.output_types import OutputType
12
12
  from swarms.utils.formatter import formatter
13
13
 
14
14
  from swarms.utils.function_caller_model import OpenAIFunctionCaller