new tool around adapter

This commit is contained in:
João Moura
2025-04-24 23:05:50 -07:00
parent af5a605f31
commit 7c1a87e5ab
3 changed files with 47 additions and 0 deletions

View File

@@ -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
)

View File

@@ -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

View File

@@ -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]