LevelUpWith

Explore / Voice and Realtime AI Agents: From Mic to Phone Line / Lesson 1

Lesson 1: Anatomy of a Spoken Conversation

Learn what makes voice harder than chat: people expect a reply within a fraction of a second, they interrupt and talk over each other, and an agent has to listen, think and speak in an unbroken loop.

Free to read, no account needed. Part of Voice and Realtime AI Agents: From Mic to Phone Line.

By the end of this level you'll be able to

  • Describe the listen, think, speak loop of a voice agent and the job each stage does
  • Explain why the wait that feels fine in a chat window feels broken on a call
  • Record a short human conversation and mark its turn gaps and overlaps on a timeline

Why voice is a different problem

You have probably called a model API, watched the tokens stream into a terminal and thought: voice is the same thing with a microphone attached. Most engineers start there. Then they build a first voice agent and it feels wrong. The answers are fine, but the call is awkward. There are long silences, the agent talks over you, and it can't take "no, wait" for an answer.

The problem is not intelligence. A spoken conversation runs on a clock that chat never had to keep. This level covers that clock: what a voice agent does in each moment, and why a delay that is fine in a chat window feels broken on a call.

The listen, think, speak loop

Every voice agent runs one loop with three stages. Some products split the stages across separate services. Others merge them into a single speech-to-speech model, such as OpenAI's realtime models or Google's Gemini Live API. Either way, the jobs are the same:

Stage Job What goes wrong if it's weak
Listen Hear the caller, turn speech into something the model can use, and decide when they have finished their turn Cuts people off mid-sentence, or waits forever
Think Choose what to say, and maybe call a tool (look up an order, book a slot) Slow or wrong answers, dead air while a tool runs
Speak Turn the reply into audio and play it, while staying ready to stop Robotic audio, or keeps talking after the caller interrupts

The important word is loop. Chat is request then response: the user presses Enter, so you always know when the turn ends. Voice has no Enter key. The agent has to keep listening while it thinks and while it speaks. Here is the shape in Python-flavoured pseudocode. It isn't runnable yet; later levels fill it in.

# Conceptual shape of a voice agent; every stage runs concurrently.
async def conversation_loop(mic, speaker, brain):
    async for event in mic.listen():          # LISTEN: never stops
        if event.type == "user_started_speaking" and speaker.is_playing():
            speaker.stop()                    # barge-in: the caller interrupted us
            brain.cancel_current_reply()      # drop the half-finished answer
        elif event.type == "user_finished_turn":
            reply = brain.respond(event.text)  # THINK: may call tools
            await speaker.play(reply)          # SPEAK: streamed, interruptible

Compare it with the chat loop you already know:

// Chat: strictly one thing at a time. The user can't interrupt a reply that is being generated.
while (true) {
  const msg = await readLine();          // turn end is explicit (Enter)
  const reply = await model.respond(msg); // a 2-second wait is fine; a spinner shows progress
  print(reply);
}

Gotcha: the hardest line above is user_finished_turn. A pause might mean "I'm done" or "I'm thinking". Get it wrong one way and you interrupt people. Get it wrong the other way and you leave dead air. This one decision comes up throughout the course.

The clock humans keep

Conversation researchers have measured the clock. Stivers and colleagues (PNAS, 2009) recorded informal conversations in 10 languages on five continents and timed how quickly people answered yes/no questions:

  • In every language, the most common response came within 0 to 200 ms of the question ending. The overall mean was about 208 ms.
  • Cultures do differ. Japanese speakers averaged about 7 ms, the fastest in the study, and Danish speakers about 469 ms, the slowest. But every language avoided both long silences and talking at the same time.

Also, this is faster than people can produce speech from scratch. Levinson and Torreira (2015) point out that typical gaps are around 200 ms, while planning and starting an utterance takes over 600 ms. So listeners must plan their reply while the other person is still talking, by predicting where the turn is heading. Humans think in overlap. A naive agent waits for silence and only then starts thinking.

Why the chat wait feels broken on a call

In a chat window, a 2–3 second wait is fine because the screen gives feedback: a typing indicator, your sent message, a spinner. You can see the system is working.

On a phone line, the silence is all you get. Silence is ambiguous. Did it hear me? Did the call drop? Is it my turn again? Callers fill the silence by repeating themselves or saying "hello?". That speech lands just as the agent starts answering, and now the agent has to deal with an interruption it caused. Where a chat user would get a spinner, a voice agent produces a collision.

Trade-off: you can't just answer faster by deciding sooner that the caller has finished. Decide too early and you talk over people who pause mid-thought. Every voice agent has to balance responsiveness against politeness, and the right setting depends on the use case.

Hands-on: measure a real conversation

You will measure human turn-taking yourself, so you have a target in your own numbers.

  1. Record two people (with their consent) chatting naturally for 2–3 minutes, such as planning a weekend. A phone voice-memo app is fine.
  2. Open the file in Audacity. Add a label track and select each stretch of speech. Label it A or B. Then use File → Export → Export Labels, which writes tab-separated start end label lines in seconds.
  3. Run this script on the exported file:
# turn_gaps.py: usage: python turn_gaps.py labels.txt
import sys

turns = []
for line in open(sys.argv[1]):
    start, end, who = line.strip().split("\t")
    turns.append((float(start), float(end), who))
turns.sort()                                   # order by start time

for prev, nxt in zip(turns, turns[1:]):
    if prev[2] == nxt[2]:
        continue                               # same speaker: a pause, not a turn change
    offset_ms = (nxt[0] - prev[1]) * 1000      # next start minus previous end
    kind = "OVERLAP" if offset_ms < 0 else "gap"
    print(f"{prev[2]}->{nxt[2]} at {nxt[0]:6.2f}s  {offset_ms:+5.0f} ms  {kind}")

Realistic output:

A->B at   3.42s   +180 ms  gap
B->A at   7.95s   -240 ms  OVERLAP
A->B at  12.10s    +90 ms  gap
B->A at  15.61s   +620 ms  gap

A negative offset means the next speaker started before the previous one finished. These overlaps are often "mm-hm" backchannels or a speaker jumping in early. Count your gaps and overlaps, find your median gap, and look at the longest gap. Did it feel awkward when it happened? Keep these numbers. Later in the course you will hold your agent to them.

Key takeaways

  • A voice agent runs a continuous listen, think, speak loop, and it keeps listening while it thinks and speaks so it can be interrupted.
  • Chat has an explicit end-of-turn (Enter). Voice has to infer it from pauses, which is where many failures start.
  • Across 10 languages, the most common gap between turns is 0–200 ms. Cultures differ (Japanese about 7 ms on average, Danish about 469 ms), but all of them avoid long silences and talking at the same time.
  • Humans plan replies while the other person is still speaking, because producing speech takes longer than a typical gap.
  • Silence on a call has no spinner. Callers fill it, and their extra speech creates interruptions.
  • Measure real conversations: negative offsets are overlaps, positive ones are gaps.

A 6-question knowledge check follows this lesson in the app, free and without an account.

More like this