đź’¬ End of turn detection for smoother AI agent chats with Telegram and Gemini

⚡ 1,317 views · 💬 Support Chatbots

Description

This n8n template demonstrates one approach to achieve a more natural and less frustration conversations with AI agents by reducing interrupts by predicting the end of user utterances.

When we text or chat casually, it’s not uncommon to break our sentences over multiple messages or when it comes to voice, break our speech with the odd pause or umms and ahhs. If an agent replies to every message, it’s likely to interrupt us before we finish our thoughts and it can get very annoying!

Previously, I demonstrated a simple technique for buffering each incoming message by 5 seconds but that approach still suffers in some scenarios when more time is needed. This technique has no arbitrary time limit and instead uses AI to figure out when its the agent’s turn based on the user’s message, allowing for the user to take all the time they need.

How it works

How to use

Requirements

đź”— Nodes Used

HTTP Request, Redis, Telegram, Telegram Trigger, Execute Sub-workflow, Execute Workflow Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup