Long lived tasks crews / flows

Hi team,

I’m looking for some guidance regarding the implementation of long lived tasks and keep track record of the state changes.

Let’s say a crew starts the process with a new email arrival and it has to validate if it’s part of an existing conversation or if this is an update of an existing chain.

  • If it’s new, then we should start the process of understanding what’s the email about, why we should care and create a task/topic ID where we keep track record of these changes (assume we’re filtering spam or advertising already, just focusing on a curated list of email addresses that matter for us).

  • if it’s part of an existing conversation or regarding a very specific topic that we’re handling with different actors and the crew has to coordinate, then we update the existing topic.

  • Whenever a task/topic is completed, then we should close that registry and marked as completed. Then this information will be updated in a proper PSQL with the status of the tasks and outcome of the conversation to show to the end user what was the outcome in a digested version.

I wonder if you consider the most accurate way to solve this using Flows or if there’s another alternative. In any case, my challenge comes when I want to store the status of the task or the flow state somewhere else, like in cache, topic or a NoSQL DB in an elegant way.

The reason to have a separated store in my solution (and at least on my understanding) is to be able to pickup the task in other moment when I have an update on that matter so, I keep updating the same “topic” in some way to speak.
Perhaps I’m going into the wrong direction or I completely misunderstood the way to implement CrewAI for long lived tasks, so I’d appreciate your input on this matter.

Thanks