diff --git a/src/crewai_tools/__init__.py b/src/crewai_tools/__init__.py index 3e3cdc019..f42750593 100644 --- a/src/crewai_tools/__init__.py +++ b/src/crewai_tools/__init__.py @@ -6,6 +6,7 @@ from .tools import ( CodeDocsSearchTool, CodeInterpreterTool, ComposioTool, + CrewaiEnterpriseTools, CSVSearchTool, DallETool, DatabricksQueryTool, @@ -70,3 +71,8 @@ from .aws import ( from .adapters.mcp_adapter import ( MCPServerAdapter, ) + + +from .adapters.enterprise_adapter import ( + EnterpriseActionTool +) diff --git a/src/crewai_tools/tools/__init__.py b/src/crewai_tools/tools/__init__.py index bae21a1c6..d95d08c78 100644 --- a/src/crewai_tools/tools/__init__.py +++ b/src/crewai_tools/tools/__init__.py @@ -5,6 +5,7 @@ from .browserbase_load_tool.browserbase_load_tool import BrowserbaseLoadTool from .code_docs_search_tool.code_docs_search_tool import CodeDocsSearchTool from .code_interpreter_tool.code_interpreter_tool import CodeInterpreterTool from .composio_tool.composio_tool import ComposioTool +from .crewai_enterprise_tools.crewai_enterprise_tools import CrewaiEnterpriseTools from .csv_search_tool.csv_search_tool import CSVSearchTool from .dalle_tool.dalle_tool import DallETool from .databricks_query_tool.databricks_query_tool import DatabricksQueryTool diff --git a/src/crewai_tools/tools/crewai_enterprise_tools/crewai_enterprise_tools.py b/src/crewai_tools/tools/crewai_enterprise_tools/crewai_enterprise_tools.py new file mode 100644 index 000000000..8086d81b5 --- /dev/null +++ b/src/crewai_tools/tools/crewai_enterprise_tools/crewai_enterprise_tools.py @@ -0,0 +1,40 @@ +""" +Crewai Enterprise Tools +""" + +import os +import typing as t +from crewai.tools import BaseTool +from crewai_tools.adapters.enterprise_adapter import EnterpriseActionKitToolAdapter + + +def CrewaiEnterpriseTools( + enterprise_token: t.Optional[str] = None, + actions_list: t.Optional[t.List[str]] = None +) -> t.List[BaseTool]: + """Factory function that returns crewai enterprise tools. + + Args: + enterprise_token: The token for accessing enterprise actions. + If not provided, will try to use CREWAI_ENTEPRISE_TOOLS_TOKEN env var. + actions_list: Optional list of specific tool names to include. + If provided, only tools with these names will be returned. + + Returns: + A list of BaseTool instances for enterprise actions + """ + if enterprise_token is None: + enterprise_token = os.environ.get("CREWAI_ENTEPRISE_TOOLS_TOKEN") + if enterprise_token is None: + raise ValueError( + "No enterprise token provided. Please provide a token or set the CREWAI_ENTEPRISE_TOOLS_TOKEN environment variable." + ) + + adapter = EnterpriseActionKitToolAdapter(enterprise_token) + all_tools = adapter.tools() + + if actions_list is None: + return all_tools + + # Filter tools based on the provided list + return [tool for tool in all_tools if tool.name in actions_list]