Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Mastering Real-Time Voice AI Agents: Barge-In to Production
Hot & New
New
Rating: 4.0 out of 5(15 ratings)
138 students

Mastering Real-Time Voice AI Agents: Barge-In to Production

Build voice agents that listen while they speak: AEC, VAD, barge-in, tool calls, WebRTC and Twilio, with hands-on labs
Created byVinit Singh
Last updated 10/2026
English
English [Auto],

What you'll learn

  • Explain why half-duplex voice agents break conversation, and choose between a cascaded duplex stack and an end-to-end multi-stream model
  • Build an always-on audio I/O loop with an async event bus, mic and speaker threads, and a self-echo acceptance test
  • Remove the agent’s own voice from the mic with acoustic echo cancellation, and solve the timing alignment problem
  • Tune streaming VAD (onset, hold, hangover) and run incremental ASR with stability filtering under self-noise
  • Classify backchannels, overlaps, interruptions, and barge-in, then build a barge-in that cancels TTS on a real interruption but not on “mm-hmm”
  • Design one turn-taking state machine that fuses silence, semantics, and prosody inside a 200 to 400 ms latency budget
  • Implement interruption policies (ignore, yield, hard stop, negotiated overlap) and swap a learned end-of-turn head into a rule-based policy
  • Keep the floor while the agent thinks: delegated reasoning, streaming tool calls, filler speech, and async RAG
  • Prevent double-speak, stale audio, and race conditions with cancellation tokens, turn UUIDs, and guarded audio queues
  • Build WebRTC and Twilio telephony transports behind one interface, handling clocks, jitter, codecs, and remote buffer flushes
  • Trace every turn (time-to-first-audio, interruption recovery, dropped frames) and score calls on overlap, jump-in rate, and backchannel quality
  • Ship safely with zero-turn guardrails, recovery supervisors, consent and recording-law compliance, fault injection, cost gating, and a capstone

Course content

6 sections • 254 lectures • 21h 26m total length
  • Introduction Module 1: Why Turn-Based Voice Agents Feel Fake3:47
  • Introduction 1.1 Half-duplex failure modes: dead air, cut-off, no backchannel2:19
  • 1111 Introduction – The Half‑Duplex Bottleneck9:28
  • 1112 Why the Naive Cascade Fails3:47
  • 1113 The Engineer's Burden Explicit Controls vs. Learned Behavior4:00
  • 1121 The Mutually Exclusive State Machine5:05
  • 1122 The Four Cardinal Failures – Why Half-Duplex Breaks Conversation2:23
  • 1123 The Naive Half-Duplex Loop – The Anti-Pattern You Must Escape3:31
  • 1131 The Duplex Event Bus Foundation – Decoupling IO from Processing7:58
  • 1141 The Engineering Reality of Full-Duplex5:55
  • 1142 Diagnosing the Transition to Full-Duplex4:22
  • 1143 The Real‑World Cost of Full‑Duplex3:53
  • Code Eg Half-duplex failure modes: dead air, cut-off, no backchannel, no mid-sen12:07
  • Introduction Lect 1.2 The 2026 fork: cascaded duplex vs End-to-end (E2E)3:16
  • 1211 The 2026 Fork Cascaded vs. End-to-End Full-Duplex2:46
  • 1212 End to End (E2E) multi-stream model9:34
  • 1221 The Course Structure - Four Phased Development3:31
  • 1231 The Cascaded Duplex Event Bus3:33
  • 1232 The Policy Worker4:27
  • 1233 The End-to-End Multi-Stream Architecture – Neural Turn-Taking4:29
  • 1234 Cascaded vs. End-to-End Native Agents2:06
  • Code Eg The 2026 fork12:48
  • Introduction 1.3 Anatomy of a cascaded stack you will actually build: always-on2:48
  • 1311 Cascaded Duplex Stack Anatomy – The Production Blueprint9:39
  • 1312 The Complete Event flow step by step1:54
  • 1331 The Cascaded Duplex PubSub System10:03
  • 1332 Component Data Flow – Full‑Duplex Voice Agent Architecture2:13
  • 1333 Event Bus Communication & Interruption handling3:08
  • 1334 The Event Bus Architecture3:06
  • 1335 The Cancellable TTS & Playback Worker – Instant Interruption2:19
  • 1341 Engineering the Full-Duplex Agent6:16
  • 1342 Real-Time Voice Agent in the Wild6:12
  • Code Eg 1.3 Anatomy of a cascaded stack you will actually build: always-on11:27
  • Introduction Lect 1.4 Anatomy of an E2E duplex model: parallel user/agent1:17
  • 1411 Anatomy of an E2E Duplex Model Parallel UserAgent Streams, Inner Monologue,4:07
  • 1412 Inner Monologue maintaining semantic coherence2:41
  • 1413 Architectural deployment - webRTC Integration3:07
  • 1414 E2E Stack Your New Responsibilities1:59
  • 1421 Dual‑Stream Autoregressive Transformer5:29
  • 1422 The Inner Monologue – Reasoning in Text, Speaking in Sound5:26
  • 1431 WebRTC Peer Connection with aiortc4:57
  • 1432 Key Implementation Considerations1:39
  • 1441 E2E Multi‑Stream vs. Cascaded Stack7:41
  • 1442 E2E Multi‑Stream Models in the Wild5:08
  • Code Eg 1.4 Anatomy of an E2E duplex model: parallel user/agent streams, inner m11:16

Requirements

  • Intermediate Python: classes, dataclasses, and type hints
  • Working knowledge of asyncio (async/await, tasks, queues). Threads appear in the Module 1 lab, with a quick refresher.
  • Experience calling an LLM API
  • A computer with a microphone and headphones. Headphones matter for the echo labs.
  • No signal-processing or ML-research background needed

Description

Most voice agents feel fake because they can only do one thing at a time.

They either listen or speak. So they leave dead air, talk over you, ignore interruptions, and never say “mm-hmm”. This course teaches you to build full-duplex voice agents that listen while they speak, respond within a few hundred milliseconds, and hold up in production.

This is an engineering course. Almost every lesson walks through real implementation, then covers decision points, failure modes, and production notes. Each Lecture has a Coding Lab.

What you’ll build

  • An always-on audio loop on an async event bus, with mic publisher, speaker consumer, and a self-echo test

  • An echo-cancellation integration so the agent doesn’t hear itself

  • A VAD and incremental-ASR perception layer

  • A turn-taking policy as an explicit state machine, with rule-based and learned end-of-turn detection

  • A barge-in system that cancels speech on real interruptions, not on backchannels

  • An orchestrator-worker architecture where a fast model holds the floor while a slower one thinks

  • Streaming tool calls with spoken bridges, and async RAG that speaks a lead-in and splices in the answer

  • Transport adapters for WebRTC and Twilio telephony behind one interface

  • Turn tracing and stereo evaluation for time-to-first-audio, overlap, jump-in rate, and interruption recovery

  • Guardrails, recovery supervisors, consent flows, a fault-injection lab, and cost controls

Two architectures, compared throughout. Every module shows the cascaded stack (streaming ASR, policy, LLM, TTS) next to end-to-end multi-stream models, so you know when each wins and why cascade still carries most production traffic.

Who it’s for: intermediate Python developers comfortable with APIs and async code. No audio or ML research background required.

By the end, you’ll know how to design, build, measure, and ship a voice agent that behaves like a conversation partner.

Who this course is for:

  • Backend and AI engineers building voice agents, call-center automation, or voice assistants
  • Developers whose bots feel slow, talk over users, or can’t be interrupted
  • ML engineers comparing cascaded pipelines with end-to-end duplex models
  • Tech leads who need to decide on architecture, cost, compliance, and quality metric
  • Not for complete programming beginners, or anyone wanting a no-code voice-bot builder