From 5a99f0776514a74078adf9a1f8a27c199c998fd3 Mon Sep 17 00:00:00 2001 From: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:21:18 -0700 Subject: [PATCH] =?UTF-8?q?refactor:=20remove=20token=20validation=20from?= =?UTF-8?q?=20EnterpriseActionKitToolAdapter=E2=80=A6=20(#331)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: remove token validation from EnterpriseActionKitToolAdapter and CrewaiEnterpriseTools This commit simplifies the initialization of the EnterpriseActionKitToolAdapter and CrewaiEnterpriseTools by removing the explicit validation for the enterprise action token. The token can now be set to None without raising an error, allowing for more flexible usage. * added loggers for monitoring * fixed typo --- src/crewai_tools/adapters/enterprise_adapter.py | 2 -- .../crewai_enterprise_tools.py | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/crewai_tools/adapters/enterprise_adapter.py b/src/crewai_tools/adapters/enterprise_adapter.py index e6e64647a..34238602e 100644 --- a/src/crewai_tools/adapters/enterprise_adapter.py +++ b/src/crewai_tools/adapters/enterprise_adapter.py @@ -125,8 +125,6 @@ class EnterpriseActionKitToolAdapter: enterprise_action_kit_project_id: str = ENTERPRISE_ACTION_KIT_PROJECT_ID, ): """Initialize the adapter with an enterprise action token.""" - if not enterprise_action_token: - raise ValueError("enterprise_action_token is required") self.enterprise_action_token = enterprise_action_token self._actions_schema = {} 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 index a1dc2970b..7fc97d179 100644 --- a/src/crewai_tools/tools/crewai_enterprise_tools/crewai_enterprise_tools.py +++ b/src/crewai_tools/tools/crewai_enterprise_tools/crewai_enterprise_tools.py @@ -4,9 +4,12 @@ Crewai Enterprise Tools import os import typing as t +import logging from crewai.tools import BaseTool from crewai_tools.adapters.enterprise_adapter import EnterpriseActionKitToolAdapter +logger = logging.getLogger(__name__) + def CrewaiEnterpriseTools( enterprise_token: t.Optional[str] = None, @@ -18,7 +21,7 @@ def CrewaiEnterpriseTools( Args: enterprise_token: The token for accessing enterprise actions. - If not provided, will try to use CREWAI_ENTEPRISE_TOOLS_TOKEN env var. + If not provided, will try to use CREWAI_ENTERPRISE_TOOLS_TOKEN env var. actions_list: Optional list of specific tool names to include. If provided, only tools with these names will be returned. @@ -26,11 +29,8 @@ def CrewaiEnterpriseTools( 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." - ) + enterprise_token = os.environ.get("CREWAI_ENTERPRISE_TOOLS_TOKEN") + logger.warning("No enterprise token provided") adapter_kwargs = {"enterprise_action_token": enterprise_token}