fix: 'HandoffTool' object has no attribute 'agent' (#5005)

* fix: 移动agent的位置到super().__init__之后

* add: 添加一行注释
This commit is contained in:
Li-shi-ling
2026-02-10 11:01:49 +08:00
committed by GitHub
parent 1addd5b2ab
commit aab095347f
+2 -1
View File
@@ -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 {