From 47b64d3507c3be54c6f6360cb6c755bf37f15bd4 Mon Sep 17 00:00:00 2001 From: Lucas Gomide Date: Tue, 2 Sep 2025 17:28:22 -0300 Subject: [PATCH] fix: use explicit DeprecationWarning for legacy token detection (#440) --- src/crewai_tools/adapters/enterprise_adapter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/crewai_tools/adapters/enterprise_adapter.py b/src/crewai_tools/adapters/enterprise_adapter.py index 3acf1e8e0..c4bfa35eb 100644 --- a/src/crewai_tools/adapters/enterprise_adapter.py +++ b/src/crewai_tools/adapters/enterprise_adapter.py @@ -1,7 +1,7 @@ import os import json import requests -import logging +import warnings from typing import List, Any, Dict, Literal, Optional, Union, get_origin, Type, cast from pydantic import Field, create_model from crewai.tools import BaseTool @@ -409,8 +409,10 @@ class EnterpriseActionKitToolAdapter: def _set_enterprise_action_token(self, enterprise_action_token: Optional[str]): if enterprise_action_token and not enterprise_action_token.startswith("PK_"): - logging.warning( - "Legacy token detected, please consider using the new Enterprise Action Auth token. Check out our docs for more information https://docs.crewai.com/en/enterprise/features/integrations." + warnings.warn( + "Legacy token detected, please consider using the new Enterprise Action Auth token. Check out our docs for more information https://docs.crewai.com/en/enterprise/features/integrations.", + DeprecationWarning, + stacklevel=2 ) token = enterprise_action_token or os.environ.get("CREWAI_ENTERPRISE_TOOLS_TOKEN")