open-swarm 0.1.1743070217__py3-none-any.whl → 0.1.1743362777__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.
Files changed (217) hide show
  1. open_swarm-0.1.1743362777.dist-info/METADATA +217 -0
  2. open_swarm-0.1.1743362777.dist-info/RECORD +260 -0
  3. {open_swarm-0.1.1743070217.dist-info → open_swarm-0.1.1743362777.dist-info}/WHEEL +1 -2
  4. open_swarm-0.1.1743362777.dist-info/entry_points.txt +2 -0
  5. swarm/__init__.py +0 -2
  6. swarm/auth.py +53 -49
  7. swarm/blueprints/README.md +67 -0
  8. swarm/blueprints/burnt_noodles/blueprint_burnt_noodles.py +412 -0
  9. swarm/blueprints/chatbot/blueprint_chatbot.py +98 -0
  10. swarm/blueprints/chatbot/templates/chatbot/chatbot.html +33 -0
  11. swarm/blueprints/digitalbutlers/blueprint_digitalbutlers.py +183 -0
  12. swarm/blueprints/dilbot_universe/blueprint_dilbot_universe.py +285 -0
  13. swarm/blueprints/divine_code/__init__.py +0 -0
  14. swarm/blueprints/divine_code/apps.py +11 -0
  15. swarm/blueprints/divine_code/blueprint_divine_code.py +219 -0
  16. swarm/blueprints/django_chat/apps.py +6 -0
  17. swarm/blueprints/django_chat/blueprint_django_chat.py +84 -0
  18. swarm/blueprints/django_chat/templates/django_chat/django_chat_webpage.html +37 -0
  19. swarm/blueprints/django_chat/urls.py +8 -0
  20. swarm/blueprints/django_chat/views.py +32 -0
  21. swarm/blueprints/echocraft/blueprint_echocraft.py +44 -0
  22. swarm/blueprints/family_ties/apps.py +11 -0
  23. swarm/blueprints/family_ties/blueprint_family_ties.py +152 -0
  24. swarm/blueprints/family_ties/models.py +19 -0
  25. swarm/blueprints/family_ties/serializers.py +7 -0
  26. swarm/blueprints/family_ties/settings.py +16 -0
  27. swarm/blueprints/family_ties/urls.py +10 -0
  28. swarm/blueprints/family_ties/views.py +26 -0
  29. swarm/blueprints/flock/__init__.py +0 -0
  30. swarm/blueprints/gaggle/blueprint_gaggle.py +184 -0
  31. swarm/blueprints/gotchaman/blueprint_gotchaman.py +232 -0
  32. swarm/blueprints/mcp_demo/blueprint_mcp_demo.py +133 -0
  33. swarm/blueprints/messenger/templates/messenger/messenger.html +46 -0
  34. swarm/blueprints/mission_improbable/blueprint_mission_improbable.py +234 -0
  35. swarm/blueprints/monkai_magic/blueprint_monkai_magic.py +248 -0
  36. swarm/blueprints/nebula_shellz/blueprint_nebula_shellz.py +156 -0
  37. swarm/blueprints/omniplex/blueprint_omniplex.py +221 -0
  38. swarm/blueprints/rue_code/__init__.py +0 -0
  39. swarm/blueprints/rue_code/blueprint_rue_code.py +291 -0
  40. swarm/blueprints/suggestion/blueprint_suggestion.py +110 -0
  41. swarm/blueprints/unapologetic_press/blueprint_unapologetic_press.py +298 -0
  42. swarm/blueprints/whiskeytango_foxtrot/__init__.py +0 -0
  43. swarm/blueprints/whiskeytango_foxtrot/apps.py +11 -0
  44. swarm/blueprints/whiskeytango_foxtrot/blueprint_whiskeytango_foxtrot.py +256 -0
  45. swarm/extensions/blueprint/__init__.py +30 -15
  46. swarm/extensions/blueprint/agent_utils.py +16 -40
  47. swarm/extensions/blueprint/blueprint_base.py +141 -543
  48. swarm/extensions/blueprint/blueprint_discovery.py +112 -98
  49. swarm/extensions/blueprint/cli_handler.py +185 -0
  50. swarm/extensions/blueprint/config_loader.py +122 -0
  51. swarm/extensions/blueprint/django_utils.py +181 -79
  52. swarm/extensions/blueprint/interactive_mode.py +1 -1
  53. swarm/extensions/config/config_loader.py +83 -200
  54. swarm/extensions/launchers/build_swarm_wrapper.py +0 -0
  55. swarm/extensions/launchers/swarm_cli.py +199 -287
  56. swarm/llm/chat_completion.py +26 -55
  57. swarm/management/__init__.py +0 -0
  58. swarm/management/commands/__init__.py +0 -0
  59. swarm/management/commands/runserver.py +58 -0
  60. swarm/permissions.py +38 -0
  61. swarm/serializers.py +96 -5
  62. swarm/settings.py +95 -110
  63. swarm/static/contrib/fonts/fontawesome-webfont.ttf +7 -0
  64. swarm/static/contrib/fonts/fontawesome-webfont.woff +7 -0
  65. swarm/static/contrib/fonts/fontawesome-webfont.woff2 +7 -0
  66. swarm/static/contrib/markedjs/marked.min.js +6 -0
  67. swarm/static/contrib/tabler-icons/adjustments-horizontal.svg +27 -0
  68. swarm/static/contrib/tabler-icons/alert-triangle.svg +21 -0
  69. swarm/static/contrib/tabler-icons/archive.svg +21 -0
  70. swarm/static/contrib/tabler-icons/artboard.svg +27 -0
  71. swarm/static/contrib/tabler-icons/automatic-gearbox.svg +23 -0
  72. swarm/static/contrib/tabler-icons/box-multiple.svg +19 -0
  73. swarm/static/contrib/tabler-icons/carambola.svg +19 -0
  74. swarm/static/contrib/tabler-icons/copy.svg +20 -0
  75. swarm/static/contrib/tabler-icons/download.svg +21 -0
  76. swarm/static/contrib/tabler-icons/edit.svg +21 -0
  77. swarm/static/contrib/tabler-icons/filled/carambola.svg +13 -0
  78. swarm/static/contrib/tabler-icons/filled/paint.svg +13 -0
  79. swarm/static/contrib/tabler-icons/headset.svg +22 -0
  80. swarm/static/contrib/tabler-icons/layout-sidebar-left-collapse.svg +21 -0
  81. swarm/static/contrib/tabler-icons/layout-sidebar-left-expand.svg +21 -0
  82. swarm/static/contrib/tabler-icons/layout-sidebar-right-collapse.svg +21 -0
  83. swarm/static/contrib/tabler-icons/layout-sidebar-right-expand.svg +21 -0
  84. swarm/static/contrib/tabler-icons/message-chatbot.svg +22 -0
  85. swarm/static/contrib/tabler-icons/message-star.svg +22 -0
  86. swarm/static/contrib/tabler-icons/message-x.svg +23 -0
  87. swarm/static/contrib/tabler-icons/message.svg +21 -0
  88. swarm/static/contrib/tabler-icons/paperclip.svg +18 -0
  89. swarm/static/contrib/tabler-icons/playlist-add.svg +22 -0
  90. swarm/static/contrib/tabler-icons/robot.svg +26 -0
  91. swarm/static/contrib/tabler-icons/search.svg +19 -0
  92. swarm/static/contrib/tabler-icons/settings.svg +20 -0
  93. swarm/static/contrib/tabler-icons/thumb-down.svg +19 -0
  94. swarm/static/contrib/tabler-icons/thumb-up.svg +19 -0
  95. swarm/static/css/dropdown.css +22 -0
  96. swarm/static/htmx/htmx.min.js +0 -0
  97. swarm/static/js/dropdown.js +23 -0
  98. swarm/static/rest_mode/css/base.css +470 -0
  99. swarm/static/rest_mode/css/chat-history.css +286 -0
  100. swarm/static/rest_mode/css/chat.css +251 -0
  101. swarm/static/rest_mode/css/chatbot.css +74 -0
  102. swarm/static/rest_mode/css/chatgpt.css +62 -0
  103. swarm/static/rest_mode/css/colors/corporate.css +74 -0
  104. swarm/static/rest_mode/css/colors/pastel.css +81 -0
  105. swarm/static/rest_mode/css/colors/tropical.css +82 -0
  106. swarm/static/rest_mode/css/general.css +142 -0
  107. swarm/static/rest_mode/css/layout.css +167 -0
  108. swarm/static/rest_mode/css/layouts/messenger-layout.css +17 -0
  109. swarm/static/rest_mode/css/layouts/minimalist-layout.css +57 -0
  110. swarm/static/rest_mode/css/layouts/mobile-layout.css +8 -0
  111. swarm/static/rest_mode/css/messages.css +84 -0
  112. swarm/static/rest_mode/css/messenger.css +135 -0
  113. swarm/static/rest_mode/css/settings.css +91 -0
  114. swarm/static/rest_mode/css/simple.css +44 -0
  115. swarm/static/rest_mode/css/slack.css +58 -0
  116. swarm/static/rest_mode/css/style.css +156 -0
  117. swarm/static/rest_mode/css/theme.css +30 -0
  118. swarm/static/rest_mode/css/toast.css +40 -0
  119. swarm/static/rest_mode/js/auth.js +9 -0
  120. swarm/static/rest_mode/js/blueprint.js +41 -0
  121. swarm/static/rest_mode/js/blueprintUtils.js +12 -0
  122. swarm/static/rest_mode/js/chatLogic.js +79 -0
  123. swarm/static/rest_mode/js/debug.js +63 -0
  124. swarm/static/rest_mode/js/events.js +98 -0
  125. swarm/static/rest_mode/js/main.js +19 -0
  126. swarm/static/rest_mode/js/messages.js +264 -0
  127. swarm/static/rest_mode/js/messengerLogic.js +355 -0
  128. swarm/static/rest_mode/js/modules/apiService.js +84 -0
  129. swarm/static/rest_mode/js/modules/blueprintManager.js +162 -0
  130. swarm/static/rest_mode/js/modules/chatHistory.js +110 -0
  131. swarm/static/rest_mode/js/modules/debugLogger.js +14 -0
  132. swarm/static/rest_mode/js/modules/eventHandlers.js +107 -0
  133. swarm/static/rest_mode/js/modules/messageProcessor.js +120 -0
  134. swarm/static/rest_mode/js/modules/state.js +7 -0
  135. swarm/static/rest_mode/js/modules/userInteractions.js +29 -0
  136. swarm/static/rest_mode/js/modules/validation.js +23 -0
  137. swarm/static/rest_mode/js/rendering.js +119 -0
  138. swarm/static/rest_mode/js/settings.js +130 -0
  139. swarm/static/rest_mode/js/sidebar.js +94 -0
  140. swarm/static/rest_mode/js/simpleLogic.js +37 -0
  141. swarm/static/rest_mode/js/slackLogic.js +66 -0
  142. swarm/static/rest_mode/js/splash.js +76 -0
  143. swarm/static/rest_mode/js/theme.js +111 -0
  144. swarm/static/rest_mode/js/toast.js +36 -0
  145. swarm/static/rest_mode/js/ui.js +265 -0
  146. swarm/static/rest_mode/js/validation.js +57 -0
  147. swarm/static/rest_mode/svg/animated_spinner.svg +12 -0
  148. swarm/static/rest_mode/svg/arrow_down.svg +5 -0
  149. swarm/static/rest_mode/svg/arrow_left.svg +5 -0
  150. swarm/static/rest_mode/svg/arrow_right.svg +5 -0
  151. swarm/static/rest_mode/svg/arrow_up.svg +5 -0
  152. swarm/static/rest_mode/svg/attach.svg +8 -0
  153. swarm/static/rest_mode/svg/avatar.svg +7 -0
  154. swarm/static/rest_mode/svg/canvas.svg +6 -0
  155. swarm/static/rest_mode/svg/chat_history.svg +4 -0
  156. swarm/static/rest_mode/svg/close.svg +5 -0
  157. swarm/static/rest_mode/svg/copy.svg +4 -0
  158. swarm/static/rest_mode/svg/dark_mode.svg +3 -0
  159. swarm/static/rest_mode/svg/edit.svg +5 -0
  160. swarm/static/rest_mode/svg/layout.svg +9 -0
  161. swarm/static/rest_mode/svg/logo.svg +29 -0
  162. swarm/static/rest_mode/svg/logout.svg +5 -0
  163. swarm/static/rest_mode/svg/mobile.svg +5 -0
  164. swarm/static/rest_mode/svg/new_chat.svg +4 -0
  165. swarm/static/rest_mode/svg/not_visible.svg +5 -0
  166. swarm/static/rest_mode/svg/plus.svg +7 -0
  167. swarm/static/rest_mode/svg/run_code.svg +6 -0
  168. swarm/static/rest_mode/svg/save.svg +4 -0
  169. swarm/static/rest_mode/svg/search.svg +6 -0
  170. swarm/static/rest_mode/svg/settings.svg +4 -0
  171. swarm/static/rest_mode/svg/speaker.svg +5 -0
  172. swarm/static/rest_mode/svg/stop.svg +6 -0
  173. swarm/static/rest_mode/svg/thumbs_down.svg +3 -0
  174. swarm/static/rest_mode/svg/thumbs_up.svg +3 -0
  175. swarm/static/rest_mode/svg/toggle_off.svg +6 -0
  176. swarm/static/rest_mode/svg/toggle_on.svg +6 -0
  177. swarm/static/rest_mode/svg/trash.svg +10 -0
  178. swarm/static/rest_mode/svg/undo.svg +3 -0
  179. swarm/static/rest_mode/svg/visible.svg +8 -0
  180. swarm/static/rest_mode/svg/voice.svg +10 -0
  181. swarm/templates/account/login.html +22 -0
  182. swarm/templates/account/signup.html +32 -0
  183. swarm/templates/base.html +30 -0
  184. swarm/templates/chat.html +43 -0
  185. swarm/templates/index.html +35 -0
  186. swarm/templates/rest_mode/components/chat_sidebar.html +55 -0
  187. swarm/templates/rest_mode/components/header.html +45 -0
  188. swarm/templates/rest_mode/components/main_chat_pane.html +41 -0
  189. swarm/templates/rest_mode/components/settings_dialog.html +97 -0
  190. swarm/templates/rest_mode/components/splash_screen.html +7 -0
  191. swarm/templates/rest_mode/components/top_bar.html +28 -0
  192. swarm/templates/rest_mode/message_ui.html +50 -0
  193. swarm/templates/rest_mode/slackbot.html +30 -0
  194. swarm/templates/simple_blueprint_page.html +24 -0
  195. swarm/templates/websocket_partials/final_system_message.html +3 -0
  196. swarm/templates/websocket_partials/system_message.html +4 -0
  197. swarm/templates/websocket_partials/user_message.html +5 -0
  198. swarm/urls.py +57 -74
  199. swarm/utils/log_utils.py +63 -0
  200. swarm/views/api_views.py +48 -39
  201. swarm/views/chat_views.py +156 -70
  202. swarm/views/core_views.py +85 -90
  203. swarm/views/model_views.py +64 -121
  204. swarm/views/utils.py +65 -441
  205. open_swarm-0.1.1743070217.dist-info/METADATA +0 -258
  206. open_swarm-0.1.1743070217.dist-info/RECORD +0 -89
  207. open_swarm-0.1.1743070217.dist-info/entry_points.txt +0 -3
  208. open_swarm-0.1.1743070217.dist-info/top_level.txt +0 -1
  209. swarm/agent/agent.py +0 -49
  210. swarm/core.py +0 -326
  211. swarm/extensions/mcp/__init__.py +0 -1
  212. swarm/extensions/mcp/cache_utils.py +0 -36
  213. swarm/extensions/mcp/mcp_client.py +0 -341
  214. swarm/extensions/mcp/mcp_constants.py +0 -7
  215. swarm/extensions/mcp/mcp_tool_provider.py +0 -110
  216. swarm/types.py +0 -126
  217. {open_swarm-0.1.1743070217.dist-info → open_swarm-0.1.1743362777.dist-info}/licenses/LICENSE +0 -0
@@ -1,258 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: open-swarm
3
- Version: 0.1.1743070217
4
- Summary: A tool for orchestrating Swarm using both CLI and API.
5
- Author-email: Matthew Hand <matthewhandau@gmail.com>
6
- Requires-Python: >=3.10
7
- Description-Content-Type: text/markdown
8
- License-File: LICENSE
9
- Requires-Dist: aiofiles>=24.1.0
10
- Requires-Dist: aiohttp>=3.11.11
11
- Requires-Dist: asyncio>=3.4.3
12
- Requires-Dist: asynctest>=0.13.0
13
- Requires-Dist: channels>=4.2.0
14
- Requires-Dist: colorama>=0.4.6
15
- Requires-Dist: django<5.0,>=4.2
16
- Requires-Dist: django-allauth>=65.3.1
17
- Requires-Dist: django-template-debug>=0.3.5
18
- Requires-Dist: djangorestframework>=3.15.2
19
- Requires-Dist: flask>=3.1.0
20
- Requires-Dist: jmespath>=1.0.1
21
- Requires-Dist: jsonschema-pydantic>=0.6
22
- Requires-Dist: mcp>=1.2.0
23
- Requires-Dist: openai>=1.58.1
24
- Requires-Dist: python-dotenv>=1.0.1
25
- Requires-Dist: redis>=5.2.1
26
- Requires-Dist: requests>=2.32.3
27
- Requires-Dist: whitenoise>=6.8.2
28
- Requires-Dist: drf-spectacular>=0.23.0
29
- Requires-Dist: pyinstaller>=6.12.0
30
- Requires-Dist: tiktoken>=0.9.0
31
- Requires-Dist: django-cors-headers>=4.7.0
32
- Requires-Dist: cachetools>=5.5.2
33
- Provides-Extra: dev
34
- Requires-Dist: pytest>=8.3.4; extra == "dev"
35
- Requires-Dist: pytest-asyncio>=0.25.1; extra == "dev"
36
- Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
37
- Requires-Dist: pytest-django>=4.9.0; extra == "dev"
38
- Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
39
- Requires-Dist: python-semantic-release>=9.20.0; extra == "dev"
40
- Provides-Extra: experimental
41
- Requires-Dist: nemoguardrails>=0.11.0; extra == "experimental"
42
- Dynamic: license-file
43
-
44
- # Open Swarm
45
-
46
- <div align="center">
47
- <img src="assets/images/openswarm-project-image.jpg" alt="Project Logo" width="70%"/>
48
- </div>
49
-
50
- **Open Swarm** is a versatile, modular framework for building intelligent, multi-agent systems. It's a **fork and actively maintained extension** of the [OpenAI Swarm](https://github.com/openai/swarm) framework. It includes modifications to support stateless RESTful operations and a plugin system for custom extensions that enhance agentic workflows.
51
-
52
- ---
53
-
54
- https://github.com/user-attachments/assets/1335f7fb-ff61-4e96-881c-7d3154eb9f14
55
-
56
- (generated by www.gitpodcast.com)
57
-
58
- ---
59
-
60
- ## Table of Contents
61
- - [Key Features](#key-features)
62
- - [Quickstart](#quickstart)
63
- - [Blueprints](#blueprints)
64
- - [Further Documentation](#further-documentation)
65
- - [License](#license)
66
- - [Acknowledgements](#acknowledgements)
67
-
68
- ---
69
-
70
- ## Key Features
71
-
72
- 1. **Multi-Agent Orchestration**
73
- - Define multiple agents, each with unique instructions and roles.
74
- - Agents coordinate tasks, share context, or hand off queries between one another.
75
-
76
- 2. **Blueprint-Driven Architecture**
77
- - Each **Blueprint** encapsulates logic, tool connections, and environment/config settings.
78
- - Encourages reusable, modular patterns for different use cases.
79
-
80
- 3. **Optional MCP Integration**
81
- - Integrate with external tools (e.g., databases, web search, filesystems) through **MCP servers**.
82
- - Note `npx` MCP servers work great but `uvx` MCP servers currently have issues.
83
-
84
- 4. **CLI & REST Interface**
85
- - Run from the command line or expose a Django-powered REST API for broader integration.
86
- - Interactive web pages per blueprint at `/<blueprint_name>/`.
87
-
88
- 5. **OpenAI API Compatibility**
89
- - Exposes an endpoint at `/v1/chat/completions` that is functionally similar to the OpenAI Chat Completions API.
90
- - Includes a **mandatory** `sender` field in agent responses.
91
- - This field identifies which Swarm agent provided the response and must be preserved in the conversation history for proper handoffs between agents.
92
- - While the framework is compatible with OpenAI-like API clients, it assumes the client application maintains the `sender` field and, ideally, displays it in the user interface.
93
- - **Note:** Most OpenAI API-compatible applications will ignore the `sender` field by default and not display the agent name. Custom UI or logic is required to utilise and present this information.
94
-
95
- 6. **Configurable LLMs**
96
- - Supports multiple OpenAI-compatible providers in a single environment (e.g., `openai`, `grok`, `ollama`).
97
- - Allows specifying different models/providers for different agents—even within the same blueprint.
98
- - Use environment variable `DEFAULT_LLM` to specify default LLM model used by blueprints, e.g., `DEFAULT_LLM=deepseek-r1-distill-llama-70b`
99
-
100
- ---
101
-
102
- ## Quickstart
103
-
104
- Follow these simple steps to get Open Swarm up and running:
105
-
106
- 1. **Install the Package**
107
- Run:
108
- ```bash
109
- pip install open-swarm
110
- ```
111
-
112
- 2. **Configure an LLM Provider**
113
- When you run a blueprint for the first time, Open Swarm checks for a configuration file at `~/.swarm/swarm_config.json`. If the file is missing, it will automatically create a default configuration as shown below:
114
- ```json
115
- {
116
- "llm": {
117
- "default": {
118
- "provider": "openai",
119
- "model": "gpt-4o",
120
- "base_url": "https://api.openai.com/v1",
121
- "api_key": "${OPENAI_API_KEY}"
122
- }
123
- },
124
- "mcpServers": {}
125
- }
126
- ```
127
- Make sure to set the `OPENAI_API_KEY` environment variable with your valid OpenAI API key.
128
-
129
- An example of using an alternative provider:
130
-
131
- `swarm-cli config add --section llm --name deepseek-r1-distill-llama-70b --json '{"provider": "openai", "model": "deepseek-r1-distill-llama-70b", "base_url": "https://api.groq.com/openai/v1", "api_key": "${GROQ_API_KEY}"}' `
132
-
133
-
134
- 3. **(Optional) Configure a Simple MCP Server**
135
- To add an MCP server for additional utilities (e.g., file fetching), use the `swarm-cli config add --json '<multiline_json_block>'`. For example:
136
-
137
- ```json
138
- "filesystem": {
139
- "command": "npx",
140
- "args": [
141
- "-y",
142
- "@modelcontextprotocol/server-filesystem ${ALLOWED_PATH}"
143
- ],
144
- "env": {
145
- "ALLOWED_PATH": "${ALLOWED_PATH}"
146
- }
147
- }
148
- ```
149
-
150
- 4. **Add an Example Blueprint**
151
- Add an example blueprint by running:
152
- ```bash
153
- swarm-cli add /path/to/your/blueprint.py --name example
154
- ```
155
- This copies your blueprint into the managed blueprints directory.
156
-
157
- Example blueprints are provided here: https://github.com/matthewhand/open-swarm/tree/main/blueprints
158
-
159
- 5. **Run the Blueprint from CLI**
160
- Execute the blueprint with:
161
- ```bash
162
- swarm-cli run example
163
- ```
164
-
165
- ---
166
-
167
- ## Overview
168
-
169
- Open Swarm provides the following core components:
170
-
171
- - **Swarm CLI:**
172
- A command-line tool for managing blueprints and configuration settings. It allows you to add, list, delete, run, and install blueprints, as well as update configuration entries for LLM providers and MCP servers.
173
-
174
- - **Swarm API:**
175
- An HTTP REST service that exposes endpoints such as `/v1/models` and `/v1/chat/completion(s)`. These endpoints let external applications interact with Open Swarm in an OpenAI API-compatible manner, publishing blueprints as models and processing chat completions. Additional endpoints can be exposed via blueprints.
176
-
177
- - **Swarm SDK:**
178
- Open Swarm can be used as a Python module. It is backwards compatible with the original OpenAI Swarm educational framework. It also adds many extensions including configuration loading, MCP server integration, Python Django DB and REST features, etc etc.
179
-
180
- For detailed usage instructions, please refer to the [USERGUIDE.md](./USERGUIDE.md). For developer-specific guidance, see [DEVELOPMENT.md](./DEVELOPMENT.md).
181
-
182
- ---
183
-
184
-
185
- ## Blueprints
186
-
187
- A **Blueprint** is a Python module that wraps:
188
-
189
- - **Agent Logic**: Defines how each agent in the Swarm processes user messages, whether it calls tools, and how it decides to hand off to other agents.
190
- - **Tools**: Specifies which agents have which tools (e.g., MCP-discovered tools, Python function calls).
191
- - **Environment & Configuration**: Ensures required environment variables and JSON configs are validated prior to agent execution.
192
-
193
- Once registered, a blueprint is discoverable at runtime, allowing the system to list and load agents on demand.
194
-
195
- ### Personal Assistant Example
196
-
197
- The **Personal Assistant Blueprint** demonstrates a hybrid approach, integrating **local Python function tools** with **MCP-discovered tools**. It consists of:
198
-
199
- 1. **Personal Assistant Agent**
200
- - Determines user intent and delegates queries accordingly.
201
- - Routes weather-related queries to the `WeatherAgent`.
202
- - Routes knowledge-based queries to the `DocumentationAgent`.
203
-
204
- 2. **Weather Agent** (Uses Python Function Tools)
205
- - Fetches current weather and forecasts via OpenWeatherMap.
206
- - Uses a **locally defined Python function** rather than an MCP server.
207
- - Requires `WEATHER_API_KEY` as an environment variable.
208
-
209
- 3. **Documentation Agent** (Uses MCP-Discovered Tools)
210
- - Retrieves relevant documentation via `rag-docs`.
211
- - Uses the MCP function `search_documentation` to dynamically retrieve information.
212
- - Requires the following environment variables:
213
- - `OPENAI_API_KEY`
214
- - `QDRANT_URL`
215
- - `QDRANT_API_KEY`
216
-
217
- This blueprint highlights **seamless multi-agent coordination** and the **flexibility of combining Python functions with MCP-discovered tools**.
218
-
219
- ### Other Examples
220
-
221
- Open Swarm includes a growing library of **Blueprint** examples:
222
-
223
- | Blueprint Name | Description | Status |
224
- |------------------------------|-----------------------------------------------------------------------------|-----------------------------------------|
225
- | **Echo Blueprint** | A straightforward agent that simply echoes user inputs—ideal for testing or as a starter template. | Stable |
226
- | **Suggestion Blueprint** | Blueprint providing suggestions and recommendations. | Stable |
227
- | **Database and Web Blueprint** | Demonstrates MCP-based integration with an SQLite database and Brave Search, illustrating how to combine data retrieval with real-time web queries. | Stable |
228
- | **University Blueprint** | Multi-agent system for university-related tasks. | Stable |
229
- | **Divine Ops Blueprint** | Multi-agent system for handling system administration tasks using MCP tools (filesystem, SQLite, search, etc.). | Stable |
230
- | **Nebucha Shellzzar Blueprint**| Example system administration blueprint. | Stable |
231
- | **Personal Assistant Blueprint** | Combines real-time weather updates (Python function) with documentation search (`rag-docs`, MCP). Demonstrates mixed tooling. | Broken (uvx-based) |
232
- | **Flowise Blueprint** | Integrates with Flowise for visual flow orchestration. | Broken (uvx-based, requires Flowise setup)|
233
-
234
- ---
235
- ---
236
-
237
- ## Further Documentation
238
-
239
- For advanced usage, sequence diagrams, or in-depth tooling examples, see [DEVELOPMENT.md](./DEVELOPMENT.md). Additional expansions and best practices for agent orchestration, LLM provider swapping, and more can be found in that document.
240
-
241
- ---
242
-
243
- ## License
244
-
245
- Open Swarm is provided under the MIT License. Refer to the [LICENSE](LICENSE) file for full details.
246
-
247
- ---
248
-
249
- ## Acknowledgements
250
-
251
- This project is based on the [OpenAI Swarm](https://github.com/openai/swarm) framework. We would like to acknowledge the original authors and contributors of this project for their work.
252
- We also wish to credit [django_chatbot](https://github.com/MattiPaivike/django_chatbot) for the Django chatbot view.
253
-
254
- ### Third-Party Libraries
255
- - **[Marked.js](https://github.com/markedjs/marked)** (MIT License)
256
- A fast, lightweight library for parsing Markdown into HTML.
257
- - **[Tabler Icons](https://tablericons.com)** (MIT License)
258
- A set of free, high-quality SVG icons for web projects, designed by Paweł Kuna.
@@ -1,89 +0,0 @@
1
- open_swarm-0.1.1743070217.dist-info/licenses/LICENSE,sha256=BU9bwRlnOt_JDIb6OT55Q4leLZx9RArDLTFnlDIrBEI,1062
2
- swarm/__init__.py,sha256=N2hwTgbJPoezNcg9WQCK0rj6Ap7MuyprhkWSDTfb9pI,71
3
- swarm/apps.py,sha256=up4C3m2JeyXeUcH-wYeReCuiOBVJ6404w9OfaRChLwM,2568
4
- swarm/auth.py,sha256=WcajB6lrA2cSA-Ho1lnBEs9_MNtDx713sxHRvIXx9fQ,2415
5
- swarm/consumers.py,sha256=wESLamkhbi4SEZt9k3yx6eU9ufOIZMCAL-OAXjJBGXE,5056
6
- swarm/core.py,sha256=qLQ6r9g8hQUK5Ui4UUozq-2h6vb4Hws80DSBtfnx4Hw,22965
7
- swarm/messages.py,sha256=CwADrjlj-uVmm-so1xIZvN1UkEWdzSn_hu7slfhuS8w,6549
8
- swarm/models.py,sha256=Ix0WEYYqza2lbOEBNesikRCs3XGUPWmqQyMWzZYUaxM,1494
9
- swarm/serializers.py,sha256=EPvQHvUZtnOKX5ltddNFPGnWaJGxFDWFbofTa39oxgE,363
10
- swarm/settings.py,sha256=MHSWvEv5j-vamjh5GyewFPc3b4SeudXJJS7-m0J2H3Y,7800
11
- swarm/tool_executor.py,sha256=KHM2mTGgbbTgWNN3fbV5c4MDY238OTLwaaqtkczFHFQ,12385
12
- swarm/types.py,sha256=CAbxN1SfHepjAQvJQo7zdiywXTf-6argVA0BCTZNRKo,4497
13
- swarm/urls.py,sha256=i7qIwlSMsMSMrOhkbiUfTEL7tdhRFY4g5prfBimKOX0,4085
14
- swarm/util.py,sha256=G4x2hXopHhB7IdGCkUXGoykYWyiICnjxg7wcr-WqL8I,4644
15
- swarm/wsgi.py,sha256=REM_u4HpMCkO0ddrOUXgtY-ITL-VTbRB1-WHvFJAtAU,408
16
- swarm/agent/__init__.py,sha256=YESGu_UXEBxrlQwghodUMN0vmXZDwWMU7DclCUvoklA,104
17
- swarm/agent/agent.py,sha256=-lGc05pGmveptO4oZoJq_L6XoTAIpxE8knTc6jxRmEQ,1680
18
- swarm/extensions/__init__.py,sha256=SadbzfxckByaaqzuKPfXMvqmj45-dcMlavlfQYhGnzE,56
19
- swarm/extensions/blueprint/__init__.py,sha256=-nAm6l7-42eAJYhWkQlcfq2hQB5ipxg2YIyiQRttX3c,1583
20
- swarm/extensions/blueprint/agent_utils.py,sha256=GLnjtLhtGW9k1vI9uqMojXcY-OkPXwdmQKLhs60CJ5k,1913
21
- swarm/extensions/blueprint/blueprint_base.py,sha256=hqvOQ3wS7OJNmqJgpH7IOjLTr3qyHf4XzXxqkkrGYzU,30478
22
- swarm/extensions/blueprint/blueprint_discovery.py,sha256=ihrIHo4mDaSAUVREXD1y26d5UmPnxVZtBwDGcDJeYrU,5139
23
- swarm/extensions/blueprint/blueprint_utils.py,sha256=Ef_pu-RYomqzFjMg6LOSPSdbYFCbYXjEoSvK1OT49Eo,702
24
- swarm/extensions/blueprint/common_utils.py,sha256=jeKcN3lMdrpOYWIpErH3L5am13jHjaImpVvk2b0mps4,462
25
- swarm/extensions/blueprint/django_utils.py,sha256=y3cGNXgCv4pqWFbVfLr3SmkKLAtwcJvf5JvoQphqAB0,10445
26
- swarm/extensions/blueprint/interactive_mode.py,sha256=rqJWz0aCJUW3ZJM6piuI9MWkfs4KBtPc3Z9u-jFgvVI,4595
27
- swarm/extensions/blueprint/output_utils.py,sha256=8OtVE3gEvPeeTu4Juo6Ad6omSlMqSuAtckXXx7P1CyQ,4022
28
- swarm/extensions/blueprint/spinner.py,sha256=3J0ZrNzoI5O5qR7hnCeRM3dZx2fLb_H3zkoj_AYt5LQ,3394
29
- swarm/extensions/blueprint/modes/rest_mode.py,sha256=KZuB_j2NfomER7CmlsLBqRipU3DymKY-9RpoGilMH0I,1357
30
- swarm/extensions/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- swarm/extensions/cli/blueprint_runner.py,sha256=CG6XfOiDWuc84I_qefBpkwxEs7JcIbvNJqce9jBYUxo,9158
32
- swarm/extensions/cli/cli_args.py,sha256=Lws6Q3I-DNpzq9qSRN8ylUXg-lWly1SuqDSQF9n50bw,2980
33
- swarm/extensions/cli/interactive_shell.py,sha256=ocHBP975uqJU5LQyM2IiMVW5lQ387lgYHe3sme9ucX4,1322
34
- swarm/extensions/cli/main.py,sha256=NnmovA7h1Rj1eDQVYe9AN6-eraIbIclHesNVmQPjdk4,1002
35
- swarm/extensions/cli/selection.py,sha256=etdG6hJFgnLuvD_sVJvXg8qFcgjzCjyL-vYyxWcU0TI,2002
36
- swarm/extensions/cli/utils.py,sha256=amDW-jbiM12N-t72j2S0cHP3Mxgoo3nrcwq6CwN9HFY,3290
37
- swarm/extensions/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- swarm/extensions/cli/commands/blueprint_management.py,sha256=dLNLLoTjInXQ1m9zRyNxu8NacDgwqYY50GvnhSiMQ_I,1116
39
- swarm/extensions/cli/commands/config_management.py,sha256=RFu9AP437aqUnyy8RDoyoZgW0WfT7h88_CQJaUnCR9E,480
40
- swarm/extensions/cli/commands/edit_config.py,sha256=O2Y-BKOSx7shSc-kspyseEQvtIeyQBUCD7Aj3r9dirw,2325
41
- swarm/extensions/cli/commands/list_blueprints.py,sha256=TyZv_dqM_UTK84-s-Dp7UWUcvWHXsNuxnCRNNNymWio,768
42
- swarm/extensions/cli/commands/validate_env.py,sha256=VXBjx9etvj4Re8qLwIPoHr4g5VwbwBCBdsr8gGLLYHI,1958
43
- swarm/extensions/cli/commands/validate_envvars.py,sha256=7-BDPYzV7wsga7kOggHNuCscI-7z-oPjMEBhq-ndDXA,1588
44
- swarm/extensions/cli/utils/discover_commands.py,sha256=aJdU3kSmLlpBxzGdfOA88AaCwpknHSD2cE0piCHZRUY,1053
45
- swarm/extensions/cli/utils/env_setup.py,sha256=k7QxRjzIGx5HC6RVZP9QSaaXEKMkcKCewD66u0e7qfE,496
46
- swarm/extensions/config/__init__.py,sha256=WjmGxMU5k3S40TNQxTfByYcT2YAchq_5gzXFWDLrLzU,141
47
- swarm/extensions/config/config_loader.py,sha256=A3XCIeLvD7Akp7D1rz-JsBfnW5AvulE-nN-Fop2VsLI,13666
48
- swarm/extensions/config/config_manager.py,sha256=bBT-NGbRdsXoJ-lxZM5kjAf5FvVVGRVdbbCQJiCX1_0,9951
49
- swarm/extensions/config/server_config.py,sha256=iBlQOaFQmkEPNLmVpAQvXlSWhTsu-YMIjEf-H-7QfUU,1882
50
- swarm/extensions/config/setup_wizard.py,sha256=yAZ7MOgc8ZGti2kjZ72G6QLFBI0lbhXAa7Wi7SeXDYo,4567
51
- swarm/extensions/config/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
- swarm/extensions/config/utils/logger.py,sha256=sUkKdZsjRiCGGCEPfZ4YqeZDbiaUeGFOa3mdbVOTmvU,1242
53
- swarm/extensions/launchers/__init__.py,sha256=RR4up00HKqXOOToxb63mKZ2o9fq-o75bUw7dZuxkAVk,56
54
- swarm/extensions/launchers/build_launchers.py,sha256=Eh3ODR9L4KinG1GDK4-lF3NE0EZ-ArCrP3fxtGYhXgs,433
55
- swarm/extensions/launchers/build_swarm_wrapper.py,sha256=c_9oR3To4M2cZyc1uYSiysHLhUGX5FkCAQk9AG7Va2Q,231
56
- swarm/extensions/launchers/swarm_api.py,sha256=f8olTI5JVdayp923etVQWsP8WRquPG5Mw3Q40ItN6kY,2877
57
- swarm/extensions/launchers/swarm_cli.py,sha256=ar0LxctmxUwhkVbKWLfGEcZB9c77qdPsf1Y33-UNgpY,14184
58
- swarm/extensions/launchers/swarm_wrapper.py,sha256=3K58yqPN4Ct0c7zfSDKRIGdL1Q7WOBXmAVHXT-aaPj4,1004
59
- swarm/extensions/mcp/__init__.py,sha256=Rn_lJsxmZZUJrzwig2M63lQxd7P_DX3fZyN1pJt2ps0,49
60
- swarm/extensions/mcp/cache_utils.py,sha256=XlTNsCdTwi_8rb6EQt-Mn6rUNnwADwAun_7pmdqgNMc,1206
61
- swarm/extensions/mcp/mcp_client.py,sha256=71BpGWiVnhrNx-cN07iL9Uv6C-kbT4EZ9jz4hSTBLlM,17430
62
- swarm/extensions/mcp/mcp_constants.py,sha256=XZ7b6uaOIs_Ubemk0xrEq-_9fiNLtANSU1Ge2H0AmmE,129
63
- swarm/extensions/mcp/mcp_tool_provider.py,sha256=HLG6zl_xgkWO7s9aazfs1i7eRvRjifY2CoqOwRFmAfg,4681
64
- swarm/llm/chat_completion.py,sha256=MfeyU7RXJHs8_TBMKxEd7QCnFWjKW7nmWwiNVGMUM0k,9564
65
- swarm/migrations/0010_initial_chat_models.py,sha256=qJbvLReRBEOE08FkxjOWMcwu7Ny4epNI_eG1PF8wcWM,1900
66
- swarm/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
- swarm/repl/__init__.py,sha256=hNU3HxjJJi6w5xgx34n3253QJPspFltrK7AM0G_1TlE,32
68
- swarm/repl/repl.py,sha256=sfVdSiDrStpZyxZehPn0nAxqaja2eySL9v9CfWhZEVc,2609
69
- swarm/utils/color_utils.py,sha256=utIfZ6ptGEdpHxIZiZ4gtfo5lLqZKQL5g0F8mEwMhTo,1184
70
- swarm/utils/context_utils.py,sha256=2Eu372CsuDTt6ikZ0w3OkLrFp4t9hKdgU5Kkc8faDDM,19315
71
- swarm/utils/general_utils.py,sha256=K3_Uy-189XSpLOxKGxl14fa2n7B0ZH28HgysL6vWG-M,7919
72
- swarm/utils/logger.py,sha256=g-ynqO3jqKx2rT2keiECsZ13aywFPsFlJAvo-SOeGlw,1679
73
- swarm/utils/logger_setup.py,sha256=2A9bXicV03yAPpgMFJGQt5ePB1tLwdkk7sCo-0OiglU,714
74
- swarm/utils/message_sequence.py,sha256=7Xa7YwGPgojfkrGcl-SbeR_BWwzXGDYNqAxq8F6XhDc,8616
75
- swarm/utils/message_utils.py,sha256=oNTD7pfmnnu_Br24pR2VEX9afIZwFLwg2HJBLXs1blY,4074
76
- swarm/utils/redact.py,sha256=L2lo927S575Ay7Jz6pUlK47Sxxzpd9IMybnDm6-WlC8,2955
77
- swarm/views/__init__.py,sha256=AcLk0R7Y69FhIVgJK2hZs8M_gCR-h_5iqUywz89yuHM,1223
78
- swarm/views/api_views.py,sha256=MXt_sWQYUIYgy6gTHSVIeSrszvhtkD-sxQiGBmdbQAg,1815
79
- swarm/views/chat_views.py,sha256=Jvwu8Y9sX2t2KkshBBAchXu6dRH8UDV8RAT3zXowVKg,3471
80
- swarm/views/core_views.py,sha256=VCv5BEBqUMz6OmQC4RkkIk1qq46f5f7Jyx4MqCaoENo,5229
81
- swarm/views/message_views.py,sha256=sDUnXyqKXC8WwIIMAlWf00s2_a2T9c75Na5FvYMJwBM,1596
82
- swarm/views/model_views.py,sha256=2bfqF8LOhgWDRFvm5FeovQDdLcZOS9OfkJLvSC0FDvs,6206
83
- swarm/views/utils.py,sha256=qNt1U5QKC2SFpViqdYwFU2mouklK0MR3W4I979-ES5s,23816
84
- swarm/views/web_views.py,sha256=ExQQeJpZ8CkLZQC_pXKOOmdnEy2qR3wEBP4LLp27DPU,7404
85
- open_swarm-0.1.1743070217.dist-info/METADATA,sha256=WPAFbZCl_Z6Gs9BwqUZuO0ElLrqXs2xglT-2a-Um1aA,11965
86
- open_swarm-0.1.1743070217.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
87
- open_swarm-0.1.1743070217.dist-info/entry_points.txt,sha256=tHIcZBvy_sbp_nqZcLG3NSgElG6vEZcUvR5U5325qak,126
88
- open_swarm-0.1.1743070217.dist-info/top_level.txt,sha256=ETN-2phSZezexCGmKSre_aUhRK0XI9Rzz7Fw5TCsLsQ,6
89
- open_swarm-0.1.1743070217.dist-info/RECORD,,
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- swarm-api = swarm.extensions.launchers.swarm_api:main
3
- swarm-cli = swarm.extensions.launchers.swarm_cli:main
@@ -1 +0,0 @@
1
- swarm
swarm/agent/agent.py DELETED
@@ -1,49 +0,0 @@
1
- # src/swarm/agent/agent.py
2
-
3
- from typing import Callable, Dict, Any, List
4
- import json
5
-
6
- class Agent:
7
- def __init__(self, name: str, instructions: str):
8
- self.name = name
9
- self.instructions = instructions
10
- self.tools: Dict[str, Dict[str, Any]] = {}
11
-
12
- def register_tool(self, name: str, func: Callable[..., Any], description: str = ""):
13
- """
14
- Registers a tool with the agent.
15
-
16
- Args:
17
- name (str): Name of the tool.
18
- func (Callable[..., Any]): The function implementing the tool.
19
- description (str): Description of the tool.
20
- """
21
- self.tools[name] = {
22
- "func": func,
23
- "description": description
24
- }
25
-
26
- async def process(self, query: str) -> str:
27
- """
28
- Processes a user query by determining which tool to invoke.
29
-
30
- Args:
31
- query (str): The user's query in JSON format specifying the tool and arguments.
32
-
33
- Returns:
34
- str: The response from the tool execution.
35
- """
36
- try:
37
- request = json.loads(query)
38
- tool_name = request.get("tool")
39
- arguments = request.get("arguments", {})
40
- if tool_name in self.tools:
41
- tool_func = self.tools[tool_name]["func"]
42
- result = await tool_func(**arguments)
43
- return result
44
- else:
45
- return f"Tool '{tool_name}' not found."
46
- except json.JSONDecodeError:
47
- return "Invalid query format. Expected JSON with 'tool' and 'arguments'."
48
- except Exception as e:
49
- return f"Error processing query: {e}"