nemo_voice_agent.evaluation.runner
nemo_voice_agent.evaluation.runner
Dynamic Voice Agent Evaluation Runner
Runs evaluation scenarios with dynamic system prompt updates. Accepts structured Scenario objects instead of raw dicts.
Module Contents
Classes
Functions
API
Run-level metric accumulator.
Holds per-signal pass-rate buckets + per-domain breakdowns + per-side
token totals across all scenarios in a run. add_scenario(metrics, domain)
folds a per-scenario metrics dict into all buckets uniformly — used by
both the freshly-run path (after computing metrics) and the resume-skip
path (after loading metrics.json from disk for an already-completed
scenario). Centralizing this logic guarantees the final all_summary.txt
aggregate is identical regardless of whether a scenario ran live or was
loaded from a prior session.
Bucket lists are kept as flat List[bool|float] (not keyed by
SuccessSignal) so the existing downstream consumers in
run_dynamic_evaluation (summary writer, per-domain rollups) can
reference them by name without changing 100+ call sites. Dict-key
lookups on incoming metrics use SuccessSignal.* members directly
(StrEnum makes them str-equal to their JSON-key values).
Append one scenario’s metrics into all run-level + per-domain buckets.
Idempotent against incomplete metrics dicts — each signal is only
appended when its corresponding key is present and well-typed in
metrics. Signals not opted into by the scenario (no
expected_scenario_db, no NL assertions, etc.) simply don’t
contribute to their bucket.
SuccessSignal enum members are used as the dict keys when
looking up signal values in metrics — StrEnum members compare
equal to their string values, so this preserves byte-stability of
the on-disk metrics.json format while pinning the lookup to a
typo-resistant symbol.
When min_agent_turns > 0, scenarios with fewer agent LLM responses
(stalled agent) are counted as failures in the composite success/task
buckets, skipped in the per-signal buckets (those measurements are
meaningless for a run that stalled), and recorded in
insufficient_turns_skipped for the resume warning. Token usage is
still rolled up so cost accounting stays accurate.
Run evaluation with dynamic scenario switching and latency measurement.
Parameters:
WebSocket URL of user (simulated user)
WebSocket URL of agent being tested
Output directory for results
List of Scenario objects defining each evaluation scenario
Audio chunk in seconds for the audio stream (default: 0.016)
Maximum duration per scenario in seconds, which overrides the scenario’s own max_duration if set.
Seconds to pause between scenarios
User TTS output sample rate (default: 24000)
Agent TTS output sample rate (default: 24000)
User STT input sample rate (default: 16000)
Agent STT input sample rate (default: 16000)
Output sample rate for recorded audio (default: 24000)
Timestamp string for output file naming
FileLogger instance for logging
LLMJudge instance for judging the scenario
Threshold for judging the scenario if binary result is desired, None for score based result
If True, include bridge transcript turns in the judge input. Disabled by default because interrupted/cross-talk segments can make these turns noisy.
If True, force disallow_extra_items=True on every scenario for this run,
overriding each scenario’s own setting. Default False respects per-scenario flags.
scenarios with agent turns less than this number will be treated as incomplete