Chatbots Magazine Become a Writer Intro to Chatbots

How do you manage Conversation States?

Hi botbuilders,

this question addresses everyone who is not using a framework, but is building its bot with a custom solution.

I was wondering how you are modelling your conversation states. Or if you are even using a concept like this.
I’m thinking about setting up a state machine to guide a user from state to state (following a decision diagram I’ve created), but this pattern also seems to be pretty restrictive and not easily scalable to me.

Are there any other ideas how to keep track of the context/state of a conversation with a specific user?

1 Like

Hi Betty,

Do you mean the same thing as I discuss here: Designing a Chatbot's Personality ?
The context in which an answer will be provided (so the answer could be different, of tone or content).

The way we do it is to keep a state that is an attribute of the user interacting with the bot at that moment and monitor that with separate agents that only monitor the various contexts that we have defined, so they can decide to change the context as the dialogue progresses. Is that easy and the best way? No, it’s not. Our next step should be AI to fuel that attribute…but we haven’t reached realization yet.

Hi Betty,

To manage state I use sessions based on the Facebook user id, the session object contains a goal that I think the user is trying to complete, as well as responses to questions I have asked.

The sessions are saved into a DB to try and remain stateless across multiple node heads.

In our bot a user can jump between goals, without getting the context mixed up. I do this by parsing the response from the user, and if it’s expected they continue along the same path, if its not expected I save the response on the session as it could be useful, try and figure out if this response could match another goal - if it does change goals, otherwise pop a message going “huh? what you talking about?”

I’m not sure if this is the best or cleanest way, so any input is welcomed.

cheers,
Paul