WhoBuilt

Building and Scaling an AI Agent Swarm of low latency real time voice bots

Oct 8, 2024· 1 h 7 min· 3.3K views·Watch on YouTube

Speaker

Damien Murphy, a senior applied engineer at Deepgram, leads an AI Engineer workshop on building and scaling low latency voice agents, from a live drive-through demo to multi-agent systems.

From separate services to one voice API

Traditional voice bots connect speech-to-text, an LLM, and text-to-speech, which can create latency and infrastructure challenges. Deepgram’s Voice Agent API combines those services and handles endpointing, so developers can stream audio in and receive audio out. Murphy notes that reducing latency too far can make an agent interrupt users, so systems may need deliberate delays.

Build the agent around tools and audio streaming

Murphy walks through a browser client that streams microphone audio over a WebSocket and a simple Express server that handles order operations. In the demo, an LLM uses a function call to add drive-through items, while the browser displays the order. The client downsamples browser audio from 48 kHz to 16 kHz, and smaller audio chunks can reduce latency.

Design for interruptions and focused tasks

Murphy describes endpointing as a mix of silence detection and semantic context, such as recognizing that someone is pausing to retrieve an account number. He recommends building focused agents for tasks like collecting payment details or taking orders, then composing them into larger flows. Long-running work can be handed to a secondary system, which can notify the agent when it is complete.

Scale across regions and traffic spikes

Self-hosting speech, language, and voice services can become a substantial infrastructure challenge, especially when serving users across regions or handling sudden demand. Murphy says distance can add at least a second of latency for a call from Asia to a US server, and describes scaling regional clusters with Kubernetes and autoscaling. He also suggests routing work to specialized agents and choosing the smallest model that can handle each task.

Monitor behavior and plan for failure cases

Voice activity detection can signal when speech begins and let the client stop playing the agent’s audio; Murphy estimates this event can arrive in under 100 milliseconds. He recommends monitoring conversation text and adding moderation because prompts alone cannot reliably prevent an agent from following malicious instructions. For longer calls, he says memory needs separate handling rather than an ever-growing system context.

Takeaways

  • Combine speech recognition, language generation, and speech output carefully; measure latency across the full path.
  • Keep each agent responsible for a focused task, and connect agents through explicit routing and tool calls.
  • Use small audio chunks and client-side interruption handling to make voice interactions feel more responsive.
  • Deploy services near users and prepare regional capacity for sudden traffic spikes.
  • Add monitoring and output checks because system prompts alone cannot guarantee safe agent behavior.

Mentioned in this talk

Search inside this talk

What was claimed 17

Show all 17 facts

Related talks