My Agents are choppy this week. For example, if ...
# ask-ai
b
My Agents are choppy this week. For example, if a user says: "I am having trouble with this thing..." then sometimes the agent says "I understand how that can be frustrating" and other times the agent skips "I", and just says "understand how that can be frustrating". When it happens it has a glitchy vibe where you can tell the "I" got skipped or cut off. Other times an agent will start a sentence, then stop, then start a new sentence. I was curious if could be related to the VAD settings, but no luck there so far. Claude said to use
session.say()
instead of
session.generate_reply(tool_choice="none")
and that did clean up the initial greetings, but probably because they're hard coded now. For context this is with the restaurant starter recipe that was converted to use inference. This issue happens locally without SIP, and when calling livekit cloud sip / telnyx. I am just wondering where to optimize or fix here. Could it be related to using inference, or maybe VAD, or is it the actual STT and TTS models? I was also curious if it could be because I moved my prompts over to separate yaml files. Claude code was saying that's not the culprit. What do you recommend?
t
Thanks for reaching out, Matt. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I completely understand how choppy or incomplete agent responses can be frustrating. Let’s walk through some key areas together that might help improve your experience: • Latency: It’s a good idea to make sure your agent servers are located close to the AI service providers. Also, tweaking endpointing settings like
silence_duration_ms
and
prefix_padding_ms
in the VAD configuration can make a noticeable difference. • AI Service Constraints: Sometimes, responses get cut off if they hit the
max_output_tokens
limit or if content filters are triggered. Adjusting these settings or fine-tuning your prompts might help avoid that. • Infrastructure: Double-check that you have enough agent workers running and consider using load balancing to spread the workload smoothly. • Real-time Configuration: You can use
pg.updateConfig
to tweak agent settings like voice and temperature on the fly, which often leads to better responsiveness. • Local Audio Buffering: Using
LocalTrackRecorder
from the LiveKit SDK to buffer audio locally can help replay audio smoothly and enhance interactions. I hope these suggestions help you move forward! If you want to dive deeper into any of these points or need more personalized advice, just let me know—I’m here to help. Sources: Operational Best Practices | livekit/livekit_composite | DeepWiki | agent/main.py | Knowledge Base Content | livekit/livekit_composite | DeepWiki | Voice Assistant Examples | livekit/livekit_composite | DeepWiki
b
I am hosting these on livekit cloud, so in theory that should rule on infrastructure issues unless something is not working right on that end. I don't think it's max_output_tokens constraints. I haven't done many calls, and my prompts are not huge. This has nothing to do with replays. The issue happens during the real time conversation. So it could possibly be real time config or latency
t
Since you're hosting on LiveKit Cloud, infrastructure issues are less likely, but there are some great ways to optimize your real-time configuration and reduce latency. I’d love to share a few recommendations that might help: • Leverage LiveKit Inference: Try to have your agents co-located with STT, LLM, and TTS services. This can really cut down on network hops and help reduce latency. • Use Real-Time AI Models: Integrating models like OpenAI’s Realtime or Google Gemini can make a big difference for low-latency streaming interactions. • Optimize Network Proximity: Deploying agents in regions closest to your users and AI services can help lower the Time To First Token (TTFT), making things feel snappier. • Monitor Metrics: Keep an eye on latency indicators like TTFT and Time To First Byte (TTFB) using LiveKit’s metrics API and Cloud dashboard. It’s a great way to stay informed. • Elastic Scaling: Make sure your plan includes provisioned capacity so your agents stay warm and ready for instant connections. I hope these tips help improve your real-time performance! Please feel free to reach out if you’d like me to walk you through any of these points in more detail — I’m here to help. Sources: How can I reduce latency in voice agents using STT, TTS and LLM? | Deploy and scale agents on LiveKit Cloud | delay-handling/raw_data.txt | examples/voice_agents/llamaindex-rag/data/raw_data.txt | Introducing LiveKit Inference: A unified model interface for voice AI