fix: add mode='before' to allowed_agents validator to fix validation order

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2025-06-17 16:40:53 +00:00
parent 8fd2867155
commit a9a2c0f1bb

View File

@@ -25,7 +25,6 @@ from crewai.security.security_config import SecurityConfig
from crewai.tools.base_tool import BaseTool, Tool
from crewai.utilities import I18N, Logger, RPMController
from crewai.utilities.config import process_config
from crewai.utilities.converter import Converter
from crewai.utilities.string_utils import interpolate_only
T = TypeVar("T", bound="BaseAgent")
@@ -199,7 +198,7 @@ class BaseAgent(ABC, BaseModel):
)
return processed_tools
@field_validator("allowed_agents")
@field_validator("allowed_agents", mode="before")
@classmethod
def validate_allowed_agents(cls, allowed_agents: Optional[List[Union[str, "BaseAgent"]]]) -> Optional[List[Union[str, "BaseAgent"]]]:
"""Validate the allowed_agents list."""