open-swarm 0.1.1748636259__py3-none-any.whl → 0.1.1748636295__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.
- open_swarm-0.1.1748636295.dist-info/METADATA +257 -0
- {open_swarm-0.1.1748636259.dist-info → open_swarm-0.1.1748636295.dist-info}/RECORD +24 -17
- swarm/__init__.py +2 -0
- swarm/core.py +411 -0
- swarm/extensions/blueprint/agent_utils.py +40 -16
- swarm/extensions/blueprint/blueprint_base.py +394 -290
- swarm/extensions/blueprint/django_utils.py +79 -181
- swarm/extensions/blueprint/interactive_mode.py +72 -67
- swarm/extensions/blueprint/output_utils.py +22 -35
- swarm/extensions/config/config_loader.py +253 -109
- swarm/extensions/mcp/__init__.py +1 -0
- swarm/extensions/mcp/cache_utils.py +32 -0
- swarm/extensions/mcp/mcp_client.py +233 -0
- swarm/extensions/mcp/mcp_tool_provider.py +135 -0
- swarm/extensions/mcp/mcp_utils.py +260 -0
- swarm/llm/chat_completion.py +19 -48
- swarm/settings.py +106 -70
- swarm/types.py +91 -0
- swarm/views/chat_views.py +38 -31
- swarm/views/utils.py +1 -3
- open_swarm-0.1.1748636259.dist-info/METADATA +0 -188
- {open_swarm-0.1.1748636259.dist-info → open_swarm-0.1.1748636295.dist-info}/WHEEL +0 -0
- {open_swarm-0.1.1748636259.dist-info → open_swarm-0.1.1748636295.dist-info}/entry_points.txt +0 -0
- {open_swarm-0.1.1748636259.dist-info → open_swarm-0.1.1748636295.dist-info}/licenses/LICENSE +0 -0
- {open_swarm-0.1.1748636259.dist-info → open_swarm-0.1.1748636295.dist-info}/top_level.txt +0 -0
@@ -1,188 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: open-swarm
|
3
|
-
Version: 0.1.1748636259
|
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
|
-
Requires-Dist: openai-agents
|
34
|
-
Provides-Extra: dev
|
35
|
-
Requires-Dist: pytest>=8.3.4; extra == "dev"
|
36
|
-
Requires-Dist: pytest-asyncio>=0.25.1; extra == "dev"
|
37
|
-
Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
|
38
|
-
Requires-Dist: pytest-django>=4.9.0; extra == "dev"
|
39
|
-
Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
|
40
|
-
Requires-Dist: python-semantic-release>=9.20.0; extra == "dev"
|
41
|
-
Provides-Extra: experimental
|
42
|
-
Requires-Dist: nemoguardrails>=0.11.0; extra == "experimental"
|
43
|
-
Dynamic: license-file
|
44
|
-
|
45
|
-
Open-Swarm Update - 20250328
|
46
|
-
|
47
|
-
This project is now repurposed due to OpenAI officially supporting the Swarm framework under the new name "openai-agents(-python)".
|
48
|
-
|
49
|
-
Open-swarm now utilizes the openai-agents framework for enhanced capabilities, and the MCP logic has been offloaded to the openai-agents framework.
|
50
|
-
|
51
|
-
Key focus areas of this open-swarm framework include:
|
52
|
-
- **Blueprints**: A blueprint can be converted into an OpenAI-compatible REST endpoint (analogous to `/v1/chat/completions`, but with agents) and/or into CLI utilities on the shell.
|
53
|
-
- **Config Loader**: Blueprints and configuration management form a core aspect of the project.
|
54
|
-
|
55
|
-
Installation:
|
56
|
-
-------------
|
57
|
-
Open-swarm is available via PyPI. To install, run:
|
58
|
-
```
|
59
|
-
pip install open-swarm
|
60
|
-
```
|
61
|
-
|
62
|
-
Usage:
|
63
|
-
------
|
64
|
-
In development, after cloning the repository (`github.com/matthewhand/open-swarm`), you can run a blueprint directly with:
|
65
|
-
```
|
66
|
-
uv run blueprints/mcp_demo/blueprint_mcp_demo.py
|
67
|
-
```
|
68
|
-
|
69
|
-
To run the blueprint with a specific instruction (for example, to list its tools), execute:
|
70
|
-
```
|
71
|
-
uv run blueprints/mcp_demo/blueprint_mcp_demo.py --instruction "list your tools"
|
72
|
-
```
|
73
|
-
|
74
|
-
Alternatively, you can run the blueprint as an API endpoint using the swarm-api utility:
|
75
|
-
```
|
76
|
-
swarm-api --blueprint mcp_demo
|
77
|
-
```
|
78
|
-
|
79
|
-
In production, you can use the swarm-cli utility to manage and run blueprints. For example, to add an example blueprint:
|
80
|
-
```
|
81
|
-
swarm-cli add github:matthewhand/open-swarm/blueprints/mcp_demo
|
82
|
-
```
|
83
|
-
This command saves the blueprint to:
|
84
|
-
```
|
85
|
-
~/.swarm/blueprints/mcp_demo/
|
86
|
-
```
|
87
|
-
After adding the blueprint, you can convert it into a standalone CLI utility with:
|
88
|
-
```
|
89
|
-
swarm-cli install mcp_demo
|
90
|
-
```
|
91
|
-
|
92
|
-
Building a Basic Blueprint & Config File:
|
93
|
-
------------------------------------------
|
94
|
-
You can create your own blueprint to extend open-swarm's capabilities. Here is a walkthrough:
|
95
|
-
|
96
|
-
1. **Create a Blueprint File:**
|
97
|
-
- In the `blueprints/` directory, create a new Python file, for example `blueprints/my_blueprint.py`.
|
98
|
-
- Define a new class that inherits from `BlueprintBase` and implement the required abstract methods, such as `metadata` and `create_agents()`. For instance:
|
99
|
-
```
|
100
|
-
from swarm.extensions.blueprint.blueprint_base import BlueprintBase
|
101
|
-
|
102
|
-
class MyBlueprint(BlueprintBase):
|
103
|
-
@property
|
104
|
-
def metadata(self):
|
105
|
-
return {
|
106
|
-
"title": "MyBlueprint",
|
107
|
-
"env_vars": [],
|
108
|
-
"required_mcp_servers": [],
|
109
|
-
"max_context_tokens": 8000,
|
110
|
-
"max_context_messages": 50
|
111
|
-
}
|
112
|
-
|
113
|
-
def create_agents(self):
|
114
|
-
# Create and return agents as a dictionary.
|
115
|
-
return {"MyAgent": ...} # Implement your agent creation logic here.
|
116
|
-
|
117
|
-
if __name__ == "__main__":
|
118
|
-
MyBlueprint.main()
|
119
|
-
```
|
120
|
-
|
121
|
-
2. **Create a Configuration File:**
|
122
|
-
- Create a configuration file (e.g., `swarm_config.json`) at the root of the project. This file can include settings for LLM models and MCP servers. For example:
|
123
|
-
```
|
124
|
-
{
|
125
|
-
"llm": {
|
126
|
-
"default": {
|
127
|
-
"provider": "openai",
|
128
|
-
"model": "gpt-4",
|
129
|
-
"api_key": "your-openai-api-key",
|
130
|
-
"base_url": null
|
131
|
-
}
|
132
|
-
},
|
133
|
-
"mcpServers": {
|
134
|
-
"mcp_llms_txt_server": {
|
135
|
-
"command": "echo",
|
136
|
-
"args": [],
|
137
|
-
"env": {}
|
138
|
-
},
|
139
|
-
"everything_server": {
|
140
|
-
"command": "echo",
|
141
|
-
"args": [],
|
142
|
-
"env": {}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
}
|
146
|
-
```
|
147
|
-
|
148
|
-
3. **Running Your Blueprint:**
|
149
|
-
- To run your blueprint in development mode, use:
|
150
|
-
```
|
151
|
-
uv run blueprints/my_blueprint.py
|
152
|
-
```
|
153
|
-
- Ensure your configuration file is properly loaded by your blueprint (this might require modifications in your blueprint's initialization logic or passing a `--config` parameter).
|
154
|
-
|
155
|
-
Installation & Deployment via swarm-cli:
|
156
|
-
--------------------------------------------
|
157
|
-
After creating your blueprint and config file, you can manage it with the swarm-cli utility. For example:
|
158
|
-
- **Adding your blueprint:**
|
159
|
-
```
|
160
|
-
swarm-cli add github:matthewhand/open-swarm/blueprints/my_blueprint
|
161
|
-
```
|
162
|
-
- **Installing as a standalone CLI utility:**
|
163
|
-
```
|
164
|
-
swarm-cli install my_blueprint
|
165
|
-
```
|
166
|
-
|
167
|
-
Examples:
|
168
|
-
---------
|
169
|
-
**Blueprint "mcp_demo":**
|
170
|
-
|
171
|
-
The blueprint located in `blueprints/mcp_demo` demonstrates a key design principle:
|
172
|
-
- It creates a primary agent named **Sage** that leverages the MCP framework to incorporate external capabilities.
|
173
|
-
- **Sage** uses another agent, **Explorer**, as a tool to extend its functionality.
|
174
|
-
|
175
|
-
This hierarchical agent design illustrates how blueprints can compose agents that call on subagents as tools. This model serves as a prototype for creating powerful agent-driven workflows and can be deployed both as a REST endpoint and as a CLI tool.
|
176
|
-
|
177
|
-
Production Environment:
|
178
|
-
-----------------------
|
179
|
-
After installing the package via pip, you can manage blueprints with `swarm-cli` and launch them as standalone utilities or REST services.
|
180
|
-
|
181
|
-
For help with swarm-cli:
|
182
|
-
```
|
183
|
-
swarm-cli --help
|
184
|
-
```
|
185
|
-
|
186
|
-
For help with swarm-api:
|
187
|
-
```
|
188
|
-
swarm-api --help
|
File without changes
|
{open_swarm-0.1.1748636259.dist-info → open_swarm-0.1.1748636295.dist-info}/entry_points.txt
RENAMED
File without changes
|
{open_swarm-0.1.1748636259.dist-info → open_swarm-0.1.1748636295.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|