📍 Join the 1st DeepEval meetup in SF, this Friday 5pm PT. RSVP on Luma →
💥 Introducing JevEval: Jev-as-a-Judge for LLM evaluation. Read the post →
Voice AgentsResponsiveness

Unexpected Call End

Beta
Multi-turn
Referenceless
Chatbot
Voice

The unexpected call end metric checks whether your voice agent's call ended properly, not with the agent hanging up mid-conversation or with an error or timeout. It returns 1 when the call ended normally and 0 when it did not.

CallerAgent
0.0s / 9.5s

Required Arguments

To use the UnexpectedCallEndMetric, you'll have to provide a ConversationalTestCase with:

  • content on each turn, to tell whether the call wrapped up
  • metadata saying how the call ended, as the ConversationSimulator records it under "Stop reason", or as your platform records it under "end_reason"
  • audio on at least one turn, or on the test case as a stereo recording of the whole call*, so it is a voice call

The audio is only used to place where the call ended.

* Full call audio has to be a 16-bit stereo WAV, with the caller and agent on separate channels, and is only used when no turn has audio. The call's end is then placed at the end of the recording.

Usage

The UnexpectedCallEndMetric() 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 UnexpectedCallEndMetric
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 = UnexpectedCallEndMetric(threshold=1.0)
evaluate(test_cases=test_cases, metrics=[metric])

The UnexpectedCallEndMetric takes only the common voice metric parameters.

As a standalone

You can also run the UnexpectedCallEndMetric 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

A call that ended badly shows up in score_breakdown as one event. Here is what the example call returns:

{
    "eligible_turns": 1,
    "turns_with_events": 1,
    "events": [
        {
            "type": "unexpected_end",
            "turn": 3,
            "duration_seconds": 0.0,
            "start_time": 11.0,
            "mark": "moment",
            "timing_source": "turn_timestamps",
            "description": "Call ended unexpectedly (agent_ended_call)",
            "end_reason": "agent_ended_call",
        }
    ],
    "skipped": [],
}
FieldWhat it means
end_reasonagent_ended_call when the simulator recorded the agent hanging up. Otherwise the test case's own end_reason, such as ERROR
turnThe call's last turn, counting from 0. Missing with full call audio only
reply_startFull call audio only, in place of turn. Where the agent's last reply on the recording starts, in seconds into the call
start_timeWhere the call's last timed audio ends, in seconds into the call. With full call audio only, the end of the recording. Missing when no turn has an Audio.start_time
duration_secondsAlways 0: the end is a single moment

Every event also has the fields all voice events share, such as mark and description.

eligible_turns is always 1, the call, and turns_with_events is 1 when it ended badly.

How Is It Calculated?

The UnexpectedCallEndMetric score is calculated according to the following equation:

Unexpected Call End={0if the call ended unexpectedly1otherwise\text{Unexpected Call End} = \begin{cases} 0 & \text{if the call ended unexpectedly} \\ 1 & \text{otherwise} \end{cases}

Counting calls

Each test case is one call, so there is one thing to judge: how it ended.

Ending criteria

CallerquestiongoodbyeAgentreplyhang-up: unexpectedhang-up: normal0s2s4s6s8s

The agent hanging up is only a problem if the call hadn't wrapped up. Above, a hang-up right after the question is unexpected, while one after the caller's goodbye is normal. The checks run in this order:

CheckRule
Error or timeoutThe metadata end_reason (or endReason) is ERROR or IDLE_TIMEOUT, in any letter case. Always unexpected, however the call went
Wrapped upThe caller's last line ends in "bye", "goodbye", "thank you", "thanks", "that's all" or "that is all", ignoring trailing periods and exclamation marks, or the agent's last line contains the word "bye" or "goodbye". Then the end is normal
Agent hung upThe metadata "Stop reason" is "The agent ended the call", or end_reason is AGENT_HANGUP. Unexpected

A call with none of these, such as a simulation that ran its full number of turns, ended normally. If neither the turns nor the test case have audio, the metric is skipped.

Example call

The caller asks a question and the agent hangs up instead of answering. Each row is one check and how this call fares on it.

CallerAgentagent hung up0s2s4s6s8s10s12s
CheckThis callResult
Error or timeoutNo end_reasonNo
Wrapped upCaller's last line is "Can I change the address?", agent's is "It ships tomorrow."No
Agent hung up"Stop reason" is "The agent ended the call"Yes
1 callEnded unexpectedly → 0

FAQs

How is this different from agent responsiveness?
AgentResponsivenessMetric runs this metric together with failed responses, silent replies and reprompts, and scores the share of exchanges none of them flagged, so a bad ending costs it one exchange. This metric judges only the ending.
Why does Failed Response fail too when the agent hangs up on a question?
They report two sides of one failure. This metric reports how the call ended, and FailedResponseMetric reports the question left unanswered.
Does this metric call an LLM or an external speech model?
No. It reads the call's recorded ending and the text of its last turns, so it has no model or token cost.

On this page