diff --git a/astrbot/core/agent/handoff.py b/astrbot/core/agent/handoff.py index 68bccb8f9..761c50269 100644 --- a/astrbot/core/agent/handoff.py +++ b/astrbot/core/agent/handoff.py @@ -15,7 +15,6 @@ class HandoffTool(FunctionTool, Generic[TContext]): tool_description: str | None = None, **kwargs, ) -> None: - self.agent = agent # Avoid passing duplicate `description` to the FunctionTool dataclass. # Some call sites (e.g. SubAgentOrchestrator) pass `description` via kwargs @@ -34,6 +33,8 @@ class HandoffTool(FunctionTool, Generic[TContext]): # Optional provider override for this subagent. When set, the handoff # execution will use this chat provider id instead of the global/default. self.provider_id: str | None = None + # Note: Must assign after super().__init__() to prevent parent class from overriding this attribute + self.agent = agent def default_parameters(self) -> dict: return {