🎤Micdrop

Reliability of a Micdrop Voice Call

A voice call depends on several providers and on the code of your tools, and any of them can fail, hang or be cut short by the user. Micdrop keeps two promises whatever happens: the call never goes silent for good, and a call that ends leaves nothing behind in the process. Each case below is a scenario test of the repository, run on every change with scripted fakes in place of the providers, so you can read exactly what is checked.

What the scenarios cover

The scenarios live in packages/server/tests/scenarios, plus one file for the client in packages/client/tests/scenarios.test.ts. Most of them end the same way: one more turn of the user gets a spoken answer, which proves the call is still alive.

To run the same kind of scenarios on your own agent, see Testing a voice agent.

The user interrupts the assistant

ScenarioWhat happens
The user talks over the assistant mid-sentenceThe voice stops at once, the far end is told to drop the audio it still holds, and the new turn is answered
The user speaks while a tool runsThe answer stops without waiting for the tool. The call gets an error as its result right away, then the real result in its place once the tool returns
The user speaks while a tool never returnsThe call is free again and answers the new turn
The user speaks while the model is still thinkingThe first answer is dropped before a word of it is heard, and only the second one completes
The user takes several turns in a row, quicklyA single answer follows the last turn
The transcript of a turn lands after the next turn endedThe server waits for the transcript of the last turn, and answers both at once
The user mutes during an answerThe voice stops, the turn is forgotten, and the call answers once the user speaks again

A tool or the model fails

ScenarioWhat happens
A tool throwsThe model gets { error } as the result of the call and answers
A tool outlasts its timeoutThe model gets an error as the result and answers. A result that comes later replaces the error, for the next turn
The model writes tool parameters that are not JSONThe call gets an error as its result
The model request failsThe client gets the turn back, and the next turn is answered
The model never answersThe user speaking again frees the call
The model writes nothing within answerTimeoutThe agent emits Failed and the client gets the turn back
The first model of a FallbackAgent hangsThe next model answers the same turn
The model fails halfway through its answerWhat was said is kept, and the call goes on

In every case, each tool call of the conversation has its result right after it. Most model APIs refuse a request otherwise, which would leave every later turn unanswered.

A speech provider fails

ScenarioWhat happens
The speech to text failsThe client gets the turn back
The transcript never comesAfter 10 seconds the client gets the turn back, and the next turn does not wait for it
The transcript comes after those 10 secondsIt is still answered
The text to speech failsThe answer reaches the client as text, and the client gets the turn back
A synthesis never returnsThe user speaking again frees the voice, and the next answer is spoken

The call ends

ScenarioWhat happens
The user hangs up while the assistant speaksThe speech to text, the agent and the voice are released, and nothing more is sent
The user hangs up during a tool call, or while a tool never returnsSame, and the late result of the tool goes nowhere
The user hangs up while speakingThe audio stream of the turn ends, and a transcript arriving afterwards changes nothing
The user hangs up on a model that hangsSame release
The line closes several timesEnd is emitted once
The agent ends the call during its answerThe client hears EndCall and finishes the answer
The agent ends a phone callThe line hangs up once every word of the goodbye has been played
The connection drops mid-answer, or while the user speaksThe client reconnects to a new server, the old one ends its call, and the next turn is answered

Turns

ScenarioWhat happens
A one word turn, “OK”, in a single chunk of audioIt is answered
A turn without audio, or in which the speech to text heard nothingThe client gets the turn back
The transcript lands before the end of the turnOne answer, once the turn ends
The end of a turn is sent twice, or answer() is called during an answerOne answer
Twenty turns in a rowEvery message is kept, in order

With a speech to speech model

The same scenarios run with a realtime model in place of the speech to text, the agent and the text to speech. The model stops speaking when the user talks over it or mutes, and what the user heard of the interrupted answer is kept. A tool that throws or outlasts its timeout gives the model an error as its result, and a hang up in the middle of an answer releases the model.

Timeouts

Micdrop gives up on what it waits for, so a provider that never answers cannot hold a call forever. Two limits are built in, and two are yours to set, since only you know how long your model and your tools may take.

LimitDefaultWhat happens past it
Transcript of a finished turn10 sThe client gets the turn back
Goodbye before a phone line hangs up30 sThe line hangs up
answerTimeout, an option of every agentNo limitThe agent gives up and emits Failed, see FallbackAgent
timeout, an option of every toolNo limitThe model gets an error as the result

The user can always take the call back: speaking over the assistant cancels whatever it was waiting for.

Many calls in one process

A Micdrop server runs every call of the process side by side, each in its own MicdropServer. The scenario tests run 50 calls at once and check that each keeps its own conversation. After 50 calls hang up in the middle of an answer, every timer they started is cleared and every object they held is collected by the garbage collector. The same check runs on 20 calls carried by real WebSockets.

Load test

The load test runs the server in its own process, one MicdropServer per WebSocket, on providers that answer at once, so the numbers show what Micdrop adds and nothing else. Each call speaks five turns of one second of audio at real time pace, and waits for an answer of one second of voice.

Terminal window
pnpm build:vad && pnpm build:server
pnpm bench:load --calls 1000 --turns 5

Measured on an Apple M2 with Node 24, a laptop shared with other work:

Measure100 calls1000 calls
Heap of the server for each open call8 KB7 KB
Peak RSS of the server under load106 MB140 MB
CPU of the server while the calls speak7 % of one core30 % of one core
Event loop lag, median and 99th percentile0.66 ms and 4.8 ms0.22 ms and 2.1 ms
End of a turn to the first byte of the answer, median and 99th percentile0.48 ms and 10.9 ms0.43 ms and 7.2 ms
Calls still open after every client left00
Heap left over after every client left275 KBnone

The latency is measured by the load generator, which runs every client in one process over loopback: it adds its own delays to those of the server. The tail grows when the machine is busy with other work. With 2000 calls on the same laptop under heavy load from other processes, a load average around 20 on 8 cores, the median ranged from 6 to 160 ms between runs, and the 99th percentile reached 640 ms. Memory per call and the clean state after the calls end did not change between runs. Your providers add their own latency on top, which these numbers leave out.