I have discovered a problem regarding how the squential tasks are saving the task_output when we need to use ConditionalTask.
So i was trying to build a crew that will have multiple ConditionalTask that all are depending on the output of the first task wich is not conditional like in the example bellow:
Creating the agents …
#Creating the Tasks:
manager_task= Task( … output_pydantic=CategoryOutput)
category_one_task = ConditionalTask(
context=[manager_task],
condition=is_category_one)
category_two_task = ConditionalTask(
context=[manager_task],
condition=is_category_two).
When trying to run crew.kickoff() i will get the error:
previous_output = task_outputs[task_index-1] if task_outputs else None
~~~~~~~~~~~~^^^^^^^^^^^^^^
IndexError: list index out of range
So I went to crew.py from the library and I started to debug and i saw that the method _handle_conditional_task will get as parameter the task_index which is increasing by each task but the task_outputs list where should be all the outputs of the task that already ran has just one element (the output of last task that ran).
Do you know how this can be solved? Or maybe is there an option that i am not seeing?
I also tried to look where the outputs will be appended to the task_outputs list but i couldn’t find for the place. I found it only when the tasks run in async_execution=True.
If anyone could help me i will really appreciate it.