How can i add some delay in response of AI agent?
# ask-ai
w
How can i add some delay in response of AI agent?
t
Thanks for reaching out, Rahul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
If you want to add a little delay in the response of an AI agent in LiveKit, here are some friendly ways to do it: • System Prompt Instructions: You can tweak the system prompt so the agent lets users know it’s searching for info. For example, it might say, "Let me look that up for you." • Static Text Messages: Use simple messages like "One moment while I check..." to keep users in the loop during any wait time. • Dynamic LLM Responses: Create short, on-the-spot messages that fit the context, gently informing users there’s a little delay. • Audio File Playback: Play fun pre-recorded clips like "let_me_check_that.wav" to keep things engaging while the agent processes. Also, LiveKit has cool background audio features that let you play “thinking” sounds during longer tasks, making the experience smoother and more natural. If you want, I’d be happy to walk you through how to set any of this up! Sources: delay-handling/agent.py | External data and RAG | LiveKit Docs
w
This response doesn't help I want that if i am speaking by taking some 1-2 second pauses, AI should not interrupt me
t
Hey there! To make sure the AI agent doesn’t jump in while you’re pausing, here are a few settings you can tweak: • Turn Detection Model: Try using LiveKit’s turn detection model—it helps the agent tell the difference between natural pauses and when you’ve actually finished speaking, so it won’t interrupt mid-sentence. • Adjust VAD Endpointing Delay: You can increase the
min_endpointing_delay
(maybe to 1–2 seconds) so the agent waits a bit longer after it detects silence before responding. • Max Endpointing Delay: Setting
max_endpointing_delay
lets the agent hang on during longer pauses without cutting you off. • Session-Level Interruption Settings: Flip
allow_interruptions=False
to stop the agent from interrupting you while you’re talking. • Noise Suppression: Tools like Krisp can help reduce false alarms caused by background noise. If you want, I’m happy to walk you through the exact steps to set any of these up—just let me know! Sources: Improving voice AI's turn detection with transformers | livekit-agents/livekit/agents/voice/agent_session.py | pipeline-llm/interrupt_user.py | Turn detection and interruptions | LiveKit Docs | AI voice agents | LiveKit Docs