I’m considering using CrewAI to process customer email requests. Quite often, these requests contain multiple questions that belong to different knowledge areas and require specific RAG data sources to be answered correctly. I need to extract a list of questions from the email, classify them to determine the appropriate data source for each question, and assign to agents that specialize on answering these type of questions. Then, I need to compile all the responses into a single email reply for the client.
Is this scenario achievable with CrewAI? I’m not sure how to structure the flow when one task generates a series of subtasks routed to specialized agents.
This is possible with Flows. I think you should structure it this way
- @start fetch_email - fetch email from client if you are not passing it in the flow inputs
- @listen get_questions (fetch_email) - extract questions from the email and puts them in a list
- @router classify_question - classify questions from the previous step and routes them to the appropriate crew with data source
- @listen(classify_question) handle_question - handle question. This can have multiple variations based on the data source
- @listen save_email_draft - get all the answers to the questions and draft a reply to the customer email
If you have multiple questions you will need to conditionally loop between classify_question and the question_handlers until all questions are answered.
This is simplistic but I’m sure you get the idea and you can start working on a solution that suits your situation.
Feel free to reach out to me if you need any clarification/help on any of this.
2 Likes
Thank you for the detailed answer. Will try to build a prototype flow this week.