Hello everyone, I’m new to the world of agent-based systems and AI. I am currently building an AI chatbot for restaurant table reservations via WhatsApp. To do this, I have developed a CrewAI Router Intent Flow to orchestrate the application’s flow as deterministically as possible.
Below is the current state of my flow:
class ChatbotState(BaseModel):
conversation_history: List[Dict[str, str]] =
latest_message: str = “”
phone_number: str = “”
intent: Optional[str] = None
Here’s how I’ve structured the flow:
- start() – This function takes the user’s latest message and analyzes its intent, updating the
intent
field in the current state. - router() – Based on the detected intent, it routes the execution to the appropriate Crew.
- listen(“create_reservation”) – In this case, if the detected intent is
"create_reservation"
, the flow continues here.
Currently, I’ve defined only this route.
The problem I’m facing is more about how to structure the flow. For example, to create a table reservation, the user needs to provide the following fields to correctly invoke the reservation tool:
- reservation_date
- start_time
- client_name
- party_size
- phone_number
My issue is that I don’t know how to retrieve these necessary parameters to correctly invoke the tool, since every time the user sends a new message, the process restarts from start(). Initially, I thought about creating a loop within listen(“create_reservation”), but I’m not sure if that’s the correct approach. Additionally, I’m uncertain where to store the parameters as they are extracted from the user’s messages.
I appreciate any insights or suggestions on how to better manage and store the conversation state and parameters throughout the flow.