Dead Stream
The dead stream metric checks whether your voice agent's audio goes completely dead partway through a reply: the stream drops to exact digital silence, not a pause with room noise. It returns the share of agent replies with no dead stretch, between 0 and 1.
Required Arguments
To use the DeadStreamMetric, you'll have to provide a ConversationalTestCase with audio on the agent's turns, or on the test case as a stereo recording of the whole call*.
With per-turn audio, give every clip an Audio.start_time. Without it, the metric can't tell whether the caller was talking during a dead stretch, and the stt_model check is skipped.
* Full call audio has to be stereo, with the caller and agent on separate channels, and is only used when no turn has audio. Each agent reply is then heard on the agent's channel, from its first sound until the caller speaks.
Usage
The DeadStreamMetric() can be used for end-to-end evaluation of voice calls, such as ones produced by the ConversationSimulator in voice mode:
from deepeval import evaluate
from deepeval.dataset import ConversationalGolden
from deepeval.metrics import DeadStreamMetric
from deepeval.simulator import ConversationSimulator
from deepeval.voice import ElevenLabsConnector, VoiceConfig
golden = ConversationalGolden(
scenario="The user asks the agent to look up an order by its number.",
expected_outcome="The agent reads back the order status.",
)
simulator = ConversationSimulator(
voice_config=VoiceConfig(
connector=ElevenLabsConnector(agent_id="your-agent-id"),
)
)
test_cases = simulator.simulate([golden])
metric = DeadStreamMetric(threshold=0.8)
evaluate(test_cases=test_cases, metrics=[metric])There are FOUR optional parameters specific to the DeadStreamMetric, on top of the common voice metric parameters:
- [Optional]
use_speech_detection: a boolean which when set toTrue, only counts the caller as talking when speech is detected, so background noise isn't mistaken for the caller speaking during a dead stretch. Defaulted toTrue. - [Optional]
stt_model: the speech-to-text model that transcribes the agent's audio around each dead stretch, as a string or aDeepEvalBaseSTT. When set, a dead stretch after a finished sentence isn't counted (see Dead stream criteria). Only used when the test case has stereo full call audio, since that's what is transcribed. With per-turn audio as well, the clip also needs anAudio.start_time. Defaulted toNone, which skips that check. - [Optional]
eval_mode:"deterministic"or"hybrid". In"hybrid", each dead stretch is double-checked by an audio decision model before it counts. Defaulted to the configured voice eval mode ("deterministic"unless set). - [Optional]
audio_decision_model: the model that does the second check in"hybrid"mode. Defaulted toHumeDecisionModel().
As a standalone
You can also run the DeadStreamMetric on a single test case as a standalone, one-off execution:
metric.measure(test_cases[0])
print(metric.score, metric.reason)
print(metric.score_breakdown)See Events for what score_breakdown contains.
Events
Each dead stretch shows up in score_breakdown as its own event. Here is what the example call returns:
{
"eligible_turns": 5,
"turns_with_events": 1,
"events": [
{
"type": "dead_stream",
"turn": 5,
"role": "assistant",
"offset_seconds": 1.0,
"duration_seconds": 0.7,
"start_time": 13.8,
"mark": "range",
"timing_source": "turn_timestamps",
"description": "Agent's audio went dead for 0.7s",
"position": "middle",
"runs_to_end": False,
}
],
"skipped": [],
}| Field | What it means |
|---|---|
runs_to_end | Always False here, since silence that runs to the end of the clip isn't counted |
position | Whether the dead stretch is near the start, middle or end of the clip |
Clips that can't be decoded are listed under skipped. Every event also has the fields all voice events share, such as mark and description.
eligible_turns is how many agent replies were counted and turns_with_events how many went dead. The score is the share that didn't.
How Is It Calculated?
The DeadStreamMetric score is calculated according to the following equation:
Dead stream criteria
A pause in a recorded voice keeps some room noise. A stream that drops leaves exact zeros.
A dead stretch is a run of 20 ms frames where every sample is within 2 of zero. It counts when it comes after the agent has started talking and passes these checks:
| Check | Rule |
|---|---|
| Mid-reply | At least 0.5 seconds, with sound after it in the clip |
| Caller not talking | The caller made less than 0.2 seconds of sound during it. An agent that goes quiet while the caller talks is listening, even if the caller only says "yes". Only checked when the clip has an Audio.start_time |
Silence that runs to the end of a clip isn't counted here. When the agent's own clip is next on the call, within 15 seconds, it's a stream cut, which Abrupt Cut-off reports instead.
Exceptions:
- If the agent's typical pause, across all its clips in the call, is at least 20% exact zeros, its voice writes pauses as silence, so nothing is reported for it.
- With an
stt_model, a dead stretch isn't counted when the agent's last word before it ends a sentence, with.,?or!. The agent paused after a finished sentence, for example to look something up or wait for an answer, rather than its audio dying. To read that word's punctuation, the metric transcribes about 4 seconds of the agent's audio before the stretch, and the span from there to 3 seconds after it. Speech that trails off, ending in...or…, still counts as unfinished.
If there's nothing to count, the metric is skipped.
Second check
In the hybrid eval mode, each dead stretch is double-checked before it counts. The audio decision model hears about 5 seconds of the agent's side of the call around it and is asked:
Does the speaker's audio go completely dead partway through, as if the line dropped?
If the model judges "no" more likely than "yes", the dead stretch is dismissed and doesn't count against the score.
Example call
A call where the agent's stream goes dead mid-reply once, and drops at the end of another reply before picking back up.
| Agent turn | What happens | Dead stream? |
|---|---|---|
| 1 | Normal speech | No |
| 3 | 0.3 s of exact silence mid-reply, under the 0.5 s minimum | No |
| 5 | 0.7 s of exact silence mid-reply | Yes |
| 7 | 1.2 s of exact silence at the end of the clip, then the agent resumes in turn 8 | No: it runs to the end of the clip, so it's a stream cut for Abrupt Cut-off |
| 8 | Normal speech | No |
| 5 replies | 1 dead stream → 4/5 = 0.8 |
FAQs
Why are silent pauses ignored for some voices?
Why is a stream cut not counted here?
Does this metric call an LLM or an external speech model?
stt_model, the agent's audio around each dead stretch is transcribed, at up to two requests per stretch. In the "hybrid" eval mode, each dead stretch is also checked by an audio decision model, at one paid request per stretch. The cost is added to evaluation_cost.