Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit e8659e7

Browse files
authored
refactor: remove token validation from EnterpriseActionKitToolAdapter… (#331)
* 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
1 parent d910c7f commit e8659e7

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

crewai_tools/adapters/enterprise_adapter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ def __init__(
125125
enterprise_action_kit_project_id: str = ENTERPRISE_ACTION_KIT_PROJECT_ID,
126126
):
127127
"""Initialize the adapter with an enterprise action token."""
128-
if not enterprise_action_token:
129-
raise ValueError("enterprise_action_token is required")
130128

131129
self.enterprise_action_token = enterprise_action_token
132130
self._actions_schema = {}

crewai_tools/tools/crewai_enterprise_tools/crewai_enterprise_tools.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
import os
66
import typing as t
7+
import logging
78
from crewai.tools import BaseTool
89
from crewai_tools.adapters.enterprise_adapter import EnterpriseActionKitToolAdapter
910

11+
logger = logging.getLogger(__name__)
12+
1013

1114
def CrewaiEnterpriseTools(
1215
enterprise_token: t.Optional[str] = None,
@@ -18,19 +21,16 @@ def CrewaiEnterpriseTools(
1821
1922
Args:
2023
enterprise_token: The token for accessing enterprise actions.
21-
If not provided, will try to use CREWAI_ENTEPRISE_TOOLS_TOKEN env var.
24+
If not provided, will try to use CREWAI_ENTERPRISE_TOOLS_TOKEN env var.
2225
actions_list: Optional list of specific tool names to include.
2326
If provided, only tools with these names will be returned.
2427
2528
Returns:
2629
A list of BaseTool instances for enterprise actions
2730
"""
2831
if enterprise_token is None:
29-
enterprise_token = os.environ.get("CREWAI_ENTEPRISE_TOOLS_TOKEN")
30-
if enterprise_token is None:
31-
raise ValueError(
32-
"No enterprise token provided. Please provide a token or set the CREWAI_ENTEPRISE_TOOLS_TOKEN environment variable."
33-
)
32+
enterprise_token = os.environ.get("CREWAI_ENTERPRISE_TOOLS_TOKEN")
33+
logger.warning("No enterprise token provided")
3434

3535
adapter_kwargs = {"enterprise_action_token": enterprise_token}
3636

0 commit comments

Comments
 (0)