How to pause and resume a conversation inside a custom action

Hi, I tried pausing the conversation by updating the tracker tracker.update(ConversationPaused()) However it returns the following error: AttributeError: 'Tracker' object has no attribute 'update'

I cannot use return[ConversationPaused()] as I need the conversation to be resumed in the same custom action.

Is there any way to pause and resume the conversation in the same custom action?

Itā€™s by design that custom actions cannot modify the tracker directly, they can only return events which will be used to update the tracker. So, Iā€™m afraid you are not able to pause and resume the conversation in the same custom action.

You can find the interface with all methods of the tracker that can be used inside your custom actions here: rasa-sdk/interfaces.py at master Ā· RasaHQ/rasa-sdk Ā· GitHub

Hey @Tanja, I want to pause the conversation to handoff to a human agent and resume the conversation once the human agent has completed the required task. What is the best procedure in rasa to implement this?

As you already mentioned you can pause the bot by return[ConversationPaused()] from a custom action. You can resume the bot with the event ConversationResumed. However, you cannot sent an event from the ā€œoutsideā€ to the bot at the moment. But we are working on it (see Support for external triggers / asynchronous actions Ā· Issue #3789 Ā· RasaHQ/rasa Ā· GitHub). This PR will allow you in the future to send an ConversationResumed event once the human agent has completed the required task to the bot.

1 Like

Thanks @Tanja, I will keep an eye out for that PR. I managed to resume the conversation by scheduling a custom action to return ConversationResumed event after the conversation has been paused. The scheduling is done by returning ReminderScheduled event. Once this action has been scheduled, another custom action will pause the conversation and handoff to a human agent. This way the conversation is resumed after the specified time. This might not be the best approach to solve this problem, but it gets the job done.

Please explain how you did that

1 Like

Can you please explain bit more in details?

Thanks for this @ShavinKalu . Iā€™m hesitant on using reminders to ā€œunpauseā€ the conversation due to how non-standard it can be. But that seems to be one of the possible solutions to solve this problem.

On the bright side, Iā€™m seeing that the PR for external triggers is accepted so I might check that out.

Thanks as well @Tanja for sharing the PR to us.

FYI, please check out this response where I summarize an approach to resume a conversation using curl.

1 Like