Echo
The echo metric checks whether the agent's own voice comes back through the caller's side of the call, as when the caller's speaker is loud enough for their microphone to pick the agent up again. It returns the share of the agent's speech that wasn't heard back, between 0 and 1.
Required Arguments
To use the EchoMetric, you'll have to provide a ConversationalTestCase with audio on the test case: a stereo recording of the whole call, with the caller and agent on separate channels.
This full call audio is required, since an echo is only heard on the caller's own channel. Without it the metric is skipped. Mono full call audio is ignored, because the two voices can't be told apart. Set agent_channel="left" on the test case if the agent is on the left.
Usage
The EchoMetric() can be used for end-to-end evaluation of voice calls, such as ones produced by the ConversationSimulator in voice mode with record_call=True, which records the full call:
from deepeval import evaluate
from deepeval.dataset import ConversationalGolden
from deepeval.metrics import EchoMetric
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"),
record_call=True,
)
)
test_cases = simulator.simulate([golden])
metric = EchoMetric(threshold=0.8)
evaluate(test_cases=test_cases, metrics=[metric])A simulated caller never plays the agent's voice back, so simulated calls are expected to pass. For a real call, attach its stereo recording as the test case's audio:
from deepeval.test_case import Audio, ConversationalTestCase, Turn
test_case = ConversationalTestCase(
turns=[
Turn(role="user", content="Can you look up order 4417?"),
Turn(role="assistant", content="Sure, it's out for delivery today."),
],
# One stereo file with both sides of the call
audio=Audio(url="call.wav"),
)
metric.measure(test_case)There are THREE optional parameters specific to the EchoMetric, on top of the common voice metric parameters:
- [Optional]
use_speech_detection: a boolean which when set toTrue, only counts a stretch when speech is detected in the agent's sound, so a chime or hold tone coming back isn't an echo. Defaulted toTrue. - [Optional]
eval_mode:"deterministic"or"hybrid". In"hybrid", each echo 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 EchoMetric 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 stretch of agent speech that came back shows up in score_breakdown as one event. Here is what the example call returns:
{
"eligible_turns": 3,
"turns_with_events": 1,
"events": [
{
"type": "echo",
"duration_seconds": 2.76,
"start_time": 10.45,
"mark": "whole_reply",
"timing_source": "call_recording",
"description": "Agent's voice echoed back from the caller's side",
"reply_start": 10.0,
"delay_seconds": 0.45,
"level_db": -14.0,
}
],
"skipped": [],
"timing_source": "call_recording",
}| Field | What it means |
|---|---|
reply_start | When the agent's echoed speech started, in seconds into the call |
start_time | Where the copy is heard on the caller's side: reply_start plus delay_seconds |
duration_seconds | How long that stretch of agent speech lasted |
delay_seconds | How long after the agent its voice came back on the caller's side |
level_db | How loud the copy was compared with the agent. 0 is as loud. Copies more than 17 dB down aren't counted |
Every event also has the fields all voice events share, such as mark and description.
eligible_turns is how many stretches of agent speech were counted and turns_with_events how many came back. The score is the share that didn't.
How Is It Calculated?
The EchoMetric score is calculated according to the following equation:
Counting agent sound
The metric checks each stretch of agent sound on the full call audio, not each reply. A gap under 0.3 seconds doesn't split a stretch, so a reply with longer pauses can be several stretches. Only stretches of 1 second or more are counted, since a shorter one is too little to match reliably.
Echo criteria
For each stretch, the metric looks for the same sound on the caller's channel, up to 1.75 seconds later. It compares only the timing of the two signals, so it doesn't matter how the phone line or the room changes the sound.
A stretch came back when all of these hold:
| Check | Rule |
|---|---|
| Delay | The copy arrives 0.15 to 1.75 seconds after the agent, the round trip out of the caller's speaker and into their microphone |
| Stands out | The match is at least 12 times stronger than the typical match, so noise that happens to line up doesn't count. A stretch under 2 seconds needs 30 times, since a short match is noisier |
| Loud enough | The copy is no more than 17 dB below the agent, in the speech band |
| Line loud enough | The caller's line, where the copy is heard, is no more than 8 dB quieter than the agent |
| Not talked over | The caller's line is no more than 9 dB louder than the copy. Any louder means the caller is talking, so the match is chance or buried under their voice |
| Speech | With use_speech_detection, at least half of the agent's stretch is speech, so a chime or hold tone coming back doesn't count |
These limits come from real phone calls labelled by human reviewers, where leaks came back 0.25 to 1.7 seconds after the agent. Reviewers heard copies down to about 16 dB below the agent, and called copies on a caller's line more than 8 dB quieter "barely there".
If there's nothing to count, the metric is skipped.
Second check
In the hybrid eval mode, each echo is double-checked before it counts. The audio decision model hears the caller's side of the call where the copy was heard, the whole stretch and at least 5 seconds, and is asked:
Can the AI agent's own voice be heard echoed back on this caller's line?
If the model judges "no" more likely than "yes", the echo is dismissed and doesn't count against the score.
Example call
A call where the agent's voice leaks back through the caller's speaker during one reply.
| Agent sound | What the caller's side hears | Echo? |
|---|---|---|
| 2.5 – 5.3 s | Nothing | No |
| 8.0 – 8.8 s | Under 1 second, not counted | – |
| 10.0 – 12.8 s | A copy of the agent's speech 0.45 s later, 14 dB quieter, on a caller's line 7 dB quieter than the agent | Yes |
| 14.0 – 16.3 s | Nothing | No |
| 3 stretches | 1 echo → 2/3 = 0.67 |
FAQs
Is this the agent's fault?
Will the caller talking over the agent be reported as an echo?
How is this different from Audio Loop?
Does this metric call an LLM or an external speech model?
"hybrid" eval mode, each echo is also checked by an audio decision model, at one paid request per echo.