Handoff to Human Agent

When any fallback action occurred, created my own fallback action which have following sequence of code:

  1. Send an utter_message to user displaying that it is connecting to the human agent
  2. Conversation is paused using tracker._paused = True
  3. Call to a REST API, which gets message from the human agent. API waits till it get message from the human agent
  4. this message is send to the user using utter_message
  5. Conversation is resumed using tracker._paused = False

As per this sequence of code, utter_message not displaying message to the user.

Please suggest what i am doing wrong, why utter_message not sending reply to the user. Also checked if i comment API call, then it sends reply to the user.

I just wanna say you are doing a great amazing professional conversation, though I couldn’t help you . Aha aha

1 Like

you can do one thing design your story flow like this -

#Fallback use case

  • Custom_Fallback_Intent
    • utter_message
    • custom_action_agent_call

here utter_message - can be a phrase like - “transferring you to human” and custom_action_agent_call - where you can call your api for human handoff

This should work as i have tried this way and its works like a charm!

Thanks Nikhil.

But I have one query here, if we are not having Custom_Fallback_Intent and we are using Fallback Actions for identifying fallback intent using threshold, then how we design mentioned story, as intent classified is of any type other than Custom_Fallback_Intent.

As i can say if i am getting you right , you can define another fallback action for generic fallback which will work according to the threshold you would have mentioned in your training script and you can mention that action name in your training script

Hi Nikhil, Thanks for the solution.

As per your solution, i have done this but i am getting an issue that action custom_action_agent_call calls API recursively to get human agent response and send back to user’s channel meanwhile some other user sends request for this or some other custom action it is not entertained till first user’s request gets completed.

How to handle multiple user requests simultaneously.

  1. Send an utter_message to user displaying that it is connecting to the human agent
  2. Conversation is paused using tracker._paused = True
  3. Call to a REST API, which gets message from the human agent. API waits till it get message from the human agent
  4. this message is send to the user using utter_message
  5. Conversation is resumed using tracker._paused = False This is mantigames advice.

Hi @sahil_soni how did you finally device a solution, what changes did you make finally? Also, can you post your code snippet where you’re making an external API call, I’m unable to solve that part.

2 Likes

can you post your code snippet where you’re making an external API call.

Hi @sahil_soni, I want to do something similar. But, I am not sure about the API call that you make to contact human agent and then get the response back from human. Do you have a working example that you could share?