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:
lorenzejay
2025-04-16 11:56:06 -07:00
parent 66c2df3840
commit 474d3445ef
2 changed files with 10 additions and 7 deletions

View File

@@ -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

View File

@@ -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."""