Chatbot Conversation Architecture · Chapter 4 · 10 min
Handoff to humans
Escalation triggers, agent context and returning control to the bot cleanly.
Identifying handoff moments
There are specific situations where a human agent must intervene in a conversation. Common triggers include the user explicitly asking for a person, or the system failing to understand the user's input twice in a row. You should also watch for negative sentiment and high-intent scenarios, such as formal legal complaints or complex refund requests, that the bot cannot handle. Proactive identification of these moments is the cornerstone of great customer service and ensures that users feel supported. Ensuring a timely transition to a human can save a failing customer experience and prevent long-term dissatisfaction.
Modeling the handoff state
You should represent the human-assisted phase as an explicit withAgent state within your state machine. While in this state, all incoming messages must be automatically routed to the agent's queue, and the bot must remain silent. Failing to correctly model this state is the primary cause of bots rudely interrupting a human agent by saying "I didn't understand that". This architectural choice ensures that the user always knows who they are talking to and avoids any confusing or conflicting messages.
const handoffLogic = (state: string, event: string) => {
if (event === 'REQUEST_HUMAN' || event === 'FRUSTRATION') {
return 'withAgent';
}
return state;
};Ensuring agent effectiveness
When an agent takes over, they need all available information to be helpful immediately. An agent who has to ask "how can I help?" when the user has already explained the problem wastes time and destroys customer trust. You must provide the agent with the full transcript, the captured slots, and the specific reason for the escalation. This preparation allows the agent to focus on solving the problem rather than gathering basic information that has already been provided.
Effective agents are those who can jump into a conversation with full context and a clear understanding of what has already happened. By providing them with a concise summary of the bot's interaction, you empower them to deliver a much higher level of service. This approach not only saves time for the agent but also significantly improves the overall experience for the user. It shows that your organization is organized, efficient, and truly cares about the user's needs.
Resolution and improvement
Once the agent resolves the issue, the transition back to the bot should be explicit and clearly communicated to the user. You should also implement a timeout mechanism for the withAgent state in case an agent does not pick up within your established service level agreement. If a timeout occurs, proactively offer the user an alternative option, such as a callback or a scheduled support ticket. Closing the loop correctly is just as important as the initial handoff and ensures a professional conclusion to the interaction.
Review your handoff process frequently to ensure it meets your quality standards and provides a great experience for both users and agents. Are users escalating when they should, or are they getting stuck in the bot for too long? Are agents solving the problems effectively once they get them, or do they need more information from the system? Use this feedback loop to refine your triggers and improve the information you provide to your agents, ensuring a seamless experience for everyone involved.
Discussion (4)
The callout about alerting on queue age instead of depth changed how we page people. Thank you.
Same experience here. Per-route metrics were the only way we found it.
The distinction between 'sent' and 'delivered' finally clicked for me here. We had dashboards treating them as the same thing for a year.
Would love a follow-up on how this behaves under carrier throttling. We see very different numbers per route.