If you’re using the sequential process, then this is taken care of by CrewAI. As stated in the docs:
Sequential Process
This method mirrors dynamic team workflows, progressing through tasks in a thoughtful and systematic manner. Task execution follows the predefined order in the task list, with the output of one task serving as context for the next.
To customize task context, utilize the context parameter in the Task class to specify outputs that should be used as context for subsequent tasks.
Hey! @rakshit_gupta Where you able to resolve the issue? I am facing the similar issue.
I have two tasks:
Task 1 output is the pydantic model defined as:
class Task1Output(BaseModlel): task1_out: list[float]
Task2 output is also a pydantic model defined as class Task2Output(BaseModlel): task2_out: list[dict[str, str]]
I want to use the output of task 1 as an input to task 2. There is no error in Task 1 and I am getting a pydantic output from task 1. I have defined Task 2 as below:
Hey, you can’t use dynamically any value from task 1 into task 2 as in a varibale format, if you want to do that then you have to use flows in crew ai, and do it with separate crews. check your tasks file if you have given a variable in task2 which you are expecting from task 1, Context should be enough to do that. But, if you want the variable you can use flows