From 28aa8ef4f0ea3c811e46527327163ad02defd30c Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Oct 2025 11:15:39 -0700 Subject: [PATCH] [NEW][SCRIPT][For python3.14t setup] --- scripts/python_314t.sh | 31 +++++++++++++++++++++++++++++++ swarms/structs/aop.py | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 scripts/python_314t.sh diff --git a/scripts/python_314t.sh b/scripts/python_314t.sh new file mode 100644 index 00000000..46c1f9ed --- /dev/null +++ b/scripts/python_314t.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Python 3.14t Free-Threaded Setup Script +# This script automates the installation of Python 3.14 free-threaded build with uv + +set -e # Exit on error + +# Check if uv is installed +if ! command -v uv &> /dev/null; then + curl -LsSf https://astral.sh/uv/install.sh | sh + exit 1 +fi + +uv self update + +uv python install 3.14t + +uv venv --python 3.14t + +if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then + : +else + : +fi + +uv pip install swarms + +echo "To run Python 3.14t directly without activating:" +echo " uvx python@3.14t your_script.py" +echo "" +echo "==========================================" \ No newline at end of file diff --git a/swarms/structs/aop.py b/swarms/structs/aop.py index 8c9582ae..caab14cb 100644 --- a/swarms/structs/aop.py +++ b/swarms/structs/aop.py @@ -2319,6 +2319,15 @@ class AOP: class AOPCluster: + """ + AOPCluster manages a cluster of MCP servers, allowing for the retrieval and searching + of tools (agents) across multiple endpoints. + + Attributes: + urls (List[str]): List of MCP server URLs to connect to. + transport (str): The transport protocol to use (default: "streamable-http"). + """ + def __init__( self, urls: List[str], @@ -2326,12 +2335,31 @@ class AOPCluster: *args, **kwargs, ): + """ + Initialize the AOPCluster. + + Args: + urls (List[str]): List of MCP server URLs. + transport (str, optional): Transport protocol to use. Defaults to "streamable-http". + *args: Additional positional arguments. + **kwargs: Additional keyword arguments. + """ self.urls = urls self.transport = transport def get_tools( self, output_type: Literal["json", "dict", "str"] = "dict" ) -> List[Dict[str, Any]]: + """ + Retrieve the list of tools (agents) from all MCP servers in the cluster. + + Args: + output_type (Literal["json", "dict", "str"], optional): The format of the output. + Can be "json", "dict", or "str". Defaults to "dict". + + Returns: + List[Dict[str, Any]]: A list of tool information dictionaries. + """ return get_tools_for_multiple_mcp_servers( urls=self.urls, format="openai", @@ -2346,12 +2374,13 @@ class AOPCluster: Find a tool by its server name (function name). Args: - server_name: The name of the tool/function to find + server_name (str): The name of the tool/function to find. Returns: - Dict containing the tool information, or None if not found + Dict[str, Any]: Dictionary containing the tool information, or None if not found. """ for tool in self.get_tools(output_type="dict"): if tool.get("function", {}).get("name") == server_name: return tool return None +