From ab98c3bd2874ce27c0f34364097e3437a98984d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Sat, 24 Feb 2024 03:11:41 -0300 Subject: [PATCH] Avoid empty task outputs --- src/crewai/crew.py | 2 +- src/crewai/task.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/crewai/crew.py b/src/crewai/crew.py index 5d005743e..bf532dbf3 100644 --- a/src/crewai/crew.py +++ b/src/crewai/crew.py @@ -254,7 +254,7 @@ class Crew(BaseModel): if self.full_output: return { "final_output": output, - "tasks_outputs": [task.output for task in self.tasks], + "tasks_outputs": [task.output for task in self.tasks if task], } else: return output diff --git a/src/crewai/task.py b/src/crewai/task.py index 06be0fd31..ac741f93b 100644 --- a/src/crewai/task.py +++ b/src/crewai/task.py @@ -116,7 +116,8 @@ class Task(BaseModel): for task in self.context: if task.async_execution: task.thread.join() - context.append(task.output.raw_output) + if task and task.output: + context.append(task.output.raw_output) context = "\n".join(context) tools = tools or self.tools