Open-Swarm Update - 20250328
This project is now repurposed due to OpenAI officially supporting the Swarm framework under the new name "openai-agents(-python)".
Open-swarm now utilizes the openai-agents framework for enhanced capabilities, and the MCP logic has been offloaded to the openai-agents framework.
Key focus areas of this open-swarm framework include:
- 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. - Config Loader: Blueprints and configuration management form a core aspect of the project.
Installation:
Open-swarm is available via PyPI. To install, run:
pip install open-swarm
Usage:
In development, after cloning the repository (github.com/matthewhand/open-swarm), you can run a blueprint directly with:
uv run blueprints/mcp_demo/blueprint_mcp_demo.py
To run the blueprint with a specific instruction (for example, to list its tools), execute:
uv run blueprints/mcp_demo/blueprint_mcp_demo.py --instruction "list your tools"
Alternatively, you can run the blueprint as an API endpoint using the swarm-api utility:
swarm-api --blueprint mcp_demo
In production, you can use the swarm-cli utility to manage and run blueprints. For example, to add an example blueprint:
swarm-cli add github:matthewhand/open-swarm/blueprints/mcp_demo
This command saves the blueprint to:
~/.swarm/blueprints/mcp_demo/
After adding the blueprint, you can convert it into a standalone CLI utility with:
swarm-cli install mcp_demo
Building a Basic Blueprint & Config File:
You can create your own blueprint to extend open-swarm's capabilities. Here is a walkthrough:
-
Create a Blueprint File:
- In the
blueprints/directory, create a new Python file, for exampleblueprints/my_blueprint.py. - Define a new class that inherits from
BlueprintBaseand implement the required abstract methods, such asmetadataandcreate_agents(). For instance:from swarm.extensions.blueprint.blueprint_base import BlueprintBase class MyBlueprint(BlueprintBase): @property def metadata(self): return { "title": "MyBlueprint", "env_vars": [], "required_mcp_servers": [], "max_context_tokens": 8000, "max_context_messages": 50 } def create_agents(self): # Create and return agents as a dictionary. return {"MyAgent": ...} # Implement your agent creation logic here. if __name__ == "__main__": MyBlueprint.main()
- In the
-
Create a Configuration File:
- 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:{ "llm": { "default": { "provider": "openai", "model": "gpt-4", "api_key": "your-openai-api-key", "base_url": null } }, "mcpServers": { "mcp_llms_txt_server": { "command": "echo", "args": [], "env": {} }, "everything_server": { "command": "echo", "args": [], "env": {} } } }
- Create a configuration file (e.g.,
-
Running Your Blueprint:
- To run your blueprint in development mode, use:
uv run blueprints/my_blueprint.py - Ensure your configuration file is properly loaded by your blueprint (this might require modifications in your blueprint's initialization logic or passing a
--configparameter).
- To run your blueprint in development mode, use:
Installation & Deployment via swarm-cli:
After creating your blueprint and config file, you can manage it with the swarm-cli utility. For example:
- Adding your blueprint:
swarm-cli add github:matthewhand/open-swarm/blueprints/my_blueprint - Installing as a standalone CLI utility:
swarm-cli install my_blueprint
Examples:
Blueprint "mcp_demo":
The blueprint located in blueprints/mcp_demo demonstrates a key design principle:
- It creates a primary agent named Sage that leverages the MCP framework to incorporate external capabilities.
- Sage uses another agent, Explorer, as a tool to extend its functionality.
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.
Production Environment:
After installing the package via pip, you can manage blueprints with swarm-cli and launch them as standalone utilities or REST services.
For help with swarm-cli:
swarm-cli --help
For help with swarm-api:
swarm-api --help
Metadata
Release files for open-swarm 0.1.1748636259
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| open_swarm-0.1.1748636259.tar.gz | 117.6 kB | Without provenance | Details for open_swarm-0.1.1748636259.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| open_swarm-0.1.1748636259-py3-none-any.whl | Python 3 | none | any | Details for open_swarm-0.1.1748636259-py3-none-any.whl |
Total release size: 228.5 kB
Release files / open_swarm-0.1.1748636259.tar.gz
| Download URL | open_swarm-0.1.1748636259.tar.gz |
|---|---|
| Size | 117.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79a727cce3bc8bdbbac49aecd917256172507fdc920db1286440745d410df071
|
|
BLAKE2b-256 checksum How to use checksums |
5647f579ab39ebae4d1db6e8244bc6091cccf7114add57c40ed8c4d693c817a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / open_swarm-0.1.1748636259-py3-none-any.whl
| Download URL | open_swarm-0.1.1748636259-py3-none-any.whl |
|---|---|
| Size | 110.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fda747e9f6686d7dc9ab68d9bcb1a2d1bd05f2dd90e4db97fdeb765f514d031
|
|
BLAKE2b-256 checksum How to use checksums |
611d8ed0e5350f7657b805c6d18aed0e62603c81f3d986df6962f4e0cdbe7f73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for open-swarm 0.1.1748636259
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.