Fix ignored Crew task callback when one is set on the Task (#2040)

* Fix ignored Crew task callback when one is set on the Task

* type checking
This commit is contained in:
Thiago Moretto
2025-02-05 17:53:15 -03:00
committed by GitHub
parent 77c7b7dfa1
commit 92731544ae
2 changed files with 75 additions and 0 deletions

View File

@@ -423,6 +423,10 @@ class Task(BaseModel):
if self.callback:
self.callback(self.output)
crew = self.agent.crew # type: ignore[union-attr]
if crew and crew.task_callback and crew.task_callback != self.callback:
crew.task_callback(self.output)
if self._execution_span:
self._telemetry.task_ended(self._execution_span, self, agent.crew)
self._execution_span = None