NLU receiving messages even after the conversation is paused

Hi,

I am trying to handoff the conversation to the human agent. I have implemented a custom action to hand off the conversation to human agent. The handoff request is going fine. After that I am returning ConversationPaused(), which is successfully pausing the conversation.

Now the issue is, after this any message the user is sending, is reaching NLU but not the action server at all, and since it does not reach action server, I am unable to route those to the human agents.

Below is the human handoff action -

class ActionHumanHandoff(Action):

def name(self) -> Text:
    return "action_human_handoff"

def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
    response = "Reaching out to a human agent."
    dispatcher.utter_message(response)
    logger.debug(tracker.is_paused())

    try:
        events = tracker.current_state()['events']
        # logger.debug(events)

        url = "http://<host>:<port>/handoff"
        api_call_headers = {'Content-Type': 'application/json'}
        req_data = {}
        req_data['sender_id'] = tracker.sender_id
        req_data['isPaused'] = tracker.is_paused()
        req_data['channel'] = tracker.get_latest_input_channel()
        req_data['latest_events'] = json.dumps(tracker.events_after_latest_restart())
        req_data['intent'] = tracker.get_intent_of_latest_message()
        req_data['latest_msg'] = json.dumps(tracker.latest_message)
        request_data = json.dumps(req_data)

        api_call_response = requests.post(url, headers=api_call_headers, verify=False, data=request_data)

        resp_json = api_call_response.json()

    except:
        logger.debug(resp_json)


    return [ConversationPaused()]

I am using rasa==2.8.12, rasa-sdk==2.8.2. The channels are - webexteams and rest.

Btw, I am successfully able to unpause the conversation later using Rasa & Rasa Pro Documentation, which I will still leverage once the agent or user decides to finish the conversation.

Thanks!

What channel are you using?

Hello,

I am using Webex Teams. But is this channel dependent?

Thanks!

I would not try to route live conversations thru Rasa. I would create a custom version of the Telegram channel and have the channel route between the bot and a live agent.

Use the approach described in the helpdesk example bot for handing off between assitants.

Thanks! I was hoping that if after pausing conversation, we can directly send the messages to the action server (bypassing NLU) and the conversation can continue thru that, a lot of effort could be saved such as writing code to send/receive messages to/from channel, logging via EventBroker etc. But it seems, handoff is just plain handing off the conversation to a new layer which manages the exchange b/w human and the channel directly.

I am trying to evaluate if _predict_and_execute_next_action in processor.py can be altered appropriately to achieve the said behavior, it would save a lot of re-work. But not able to figure out yet.

Thanks a lot for the guidance!!

Hello, When you pause a conversation, it indeed stops actions from being predicted and executed, which is why it’s not reaching your action server. To route incoming messages to your human agents while the conversation is paused, you may want to consider a custom channel or middleware that intercepts the messages and redirects them to your human agents. You might also consider an approach that doesn’t involve pausing the conversation, but uses a form or a specific rule that sends all messages to the human agent while in this state.