mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-02 13:48:09 +00:00
feat: Introduce adapted_agent flag in BaseAgent and update BaseAgentAdapter initialization
- Added an `adapted_agent` boolean field to the BaseAgent class to indicate if the agent is adapted. - Updated the BaseAgentAdapter's constructor to pass `adapted_agent=True` to the superclass, ensuring proper initialization of the new field.
This commit is contained in:
@@ -21,7 +21,7 @@ class BaseAgentAdapter(BaseAgent, ABC):
|
||||
model_config = {"arbitrary_types_allowed": True}
|
||||
|
||||
def __init__(self, agent_config: Optional[Dict[str, Any]] = None, **kwargs: Any):
|
||||
super().__init__(**kwargs)
|
||||
super().__init__(adapted_agent=True, **kwargs)
|
||||
self._agent_config = agent_config
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -152,6 +152,9 @@ class BaseAgent(ABC, BaseModel):
|
||||
callbacks: List[Callable] = Field(
|
||||
default=[], description="Callbacks to be used for the agent"
|
||||
)
|
||||
adapted_agent: bool = Field(
|
||||
default=False, description="Whether the agent is adapted"
|
||||
)
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
@@ -258,12 +261,12 @@ class BaseAgent(ABC, BaseModel):
|
||||
"""Set the task tools that init BaseAgenTools class."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_output_converter(
|
||||
self, llm: Any, text: str, model: type[BaseModel] | None, instructions: str
|
||||
) -> Converter:
|
||||
"""Get the converter class for the agent to create json/pydantic outputs."""
|
||||
pass
|
||||
# @abstractmethod
|
||||
# def get_output_converter(
|
||||
# self, llm: Any, text: str, model: type[BaseModel] | None, instructions: str
|
||||
# ) -> Converter:
|
||||
# """Get the converter class for the agent to create json/pydantic outputs."""
|
||||
# pass
|
||||
|
||||
def copy(self: T) -> T: # type: ignore # Signature of "copy" incompatible with supertype "BaseModel"
|
||||
"""Create a deep copy of the Agent."""
|
||||
|
||||
Reference in New Issue
Block a user