The Swarms ecosystem is a modular, clever framework constructed to help the seamless integration, execution, and orchestration of dynamic instruments that carry out particular features.
These instruments type the muse for the way autonomous brokers function, enabling them to retrieve knowledge, talk with APIs, conduct computational duties, and reply intelligently to real-world requests. By contributing to Swarms Instruments, builders can empower brokers with capabilities that drive sensible, enterprise-ready functions.
This information gives a complete roadmap for contributing instruments and plugins to the Swarms Tools repository!
Whether or not your experience lies in finance, healthcare, private productiveness, or developer tooling, this documentation outlines the important requirements, workflows, and integration patterns to make your contributions impactful and interoperable.
Instruments Github:
⭐ Help the Neighborhood: In case you discover this information and the Swarms framework useful, please think about starring, forking, and contributing to the Swarms repository on GitHub to assist develop this useful open-source device.
Documentation:
The Swarms Instruments GitHub repository is meticulously organized to keep up construction, scalability, and domain-specific readability. Every folder inside the repository represents a vertical the place instruments could be contributed and prolonged over time. These folders embrace:
finance/
: Market analytics, inventory worth retrievers, blockchain APIs, and so forth.social/
: Sentiment evaluation, engagement monitoring, and media scraping utilities.well being/
: Interfaces for EHR programs, wearable gadget APIs, or well being informatics.ai/
: Mannequin-serving utilities, embedding providers, and immediate engineering features.safety/
: Encryption libraries, danger scoring instruments, penetration take a look at interfaces.devtools/
: Construct instruments, deployment utilities, code high quality analyzers.misc/
: Common-purpose helpers or utilities that serve a number of domains.
Every device inside these directories is carried out as a single, self-contained perform. These features are anticipated to stick to Swarms-wide requirements for readability, typing, documentation, and API key dealing with.
To make sure long-term maintainability and clean agent-tool integration, every contribution should strictly observe the specs under.
import requests
import osdef fetch_data(image: str, date_range: str) -> str:
"""
Fetch monetary knowledge for a given image and date vary.
Args:
image (str): Ticker image of the asset.
date_range (str): Timeframe for the info (e.g., '1d', '1m', '1y').
Returns:
str: A string containing monetary knowledge or an error message.
"""
api_key = os.getenv("FINANCE_API_KEY")
url = f"https://api.financeprovider.com/knowledge?image={image}&vary={date_range}&apikey={api_key}"
response = requests.get(url)
if response.status_code == 200:
return response.textual content
return "Error fetching knowledge."
All logic should be encapsulated inside a single callable perform, written utilizing pure Python. The place possible, community requests must be stateless, side-effect-free, and gracefully deal with errors or timeouts.
All perform parameters should be typed utilizing Python’s sort hinting system. Use built-in primitives the place doable (e.g., str
, int
, float
, bool
) and make use of Optionally available
or Union
sorts when coping with nullable parameters or a number of codecs. This aids LLMs and sort checkers in understanding anticipated enter ranges.
No matter inside logic or complexity, instruments should return outputs in a constant string format. This string can include plain textual content or a serialized JSON object (as a string), however should not return uncooked objects, dictionaries, or binary blobs. This standardization ensures all downstream brokers can interpret device output predictably.
Safety and setting isolation are paramount. By no means hardcode API keys or delicate credentials inside supply code. All the time retrieve them dynamically utilizing the os.getenv("ENV_VAR")
method. If a device requires credentials, clearly doc the required setting variable names within the perform docstring.
Each device should embrace an in depth docstring that describes:
- The perform’s objective and operational scope
- All parameter sorts and codecs
- A transparent return sort
- Utilization examples or pattern inputs/outputs
Instance utilization:
end result = fetch_data("AAPL", "1m")
print(end result)
Nicely-documented code accelerates adoption and improves LLM interpretability.
To submit a device, observe the workflow under. This ensures your code integrates cleanly and is straightforward for maintainers to evaluation.
Navigate to the Swarms Tools repository and fork it to your private or group’s GitHub account.
Github:
git clone https://github.com/YOUR_USERNAME/swarms-tools.git
cd swarms-tools
git checkout -b characteristic/add-tool-
Use descriptive department names. That is particularly useful when collaborating in groups or sustaining audit trails.
Navigate into the suitable class folder (e.g., finance/
, ai/
, and so forth.) and implement your device in response to the outlined schema.
In case your device belongs in a brand new class, it’s possible you’ll create a brand new folder with a transparent, lowercase title.
Make sure the perform executes accurately and doesn’t throw runtime errors. If possible, take a look at edge instances and confirm constant habits throughout platforms.
git add .
git commit -m "Add below : API-based device for X"
git push origin characteristic/add-tool-
On GitHub, open a pull request out of your fork to the primary Swarms Instruments repository. Your PR description ought to:
- Summarize the device’s performance
- Reference any associated points or enhancements
- Embody utilization notes or setup directions (e.g., required API keys)
Github: