nemo_voice_agent.evaluation.scenarios.classes
nemo_voice_agent.evaluation.scenarios.classes
Module Contents
Classes
API
Actions configuration for the scenario.
Render these actions as a prompt section.
Persona configuration for the scenario.
Render this persona as a prompt section.
Resources configuration for the scenario.
Render this resource set as a prompt section.
Get the tools for the scenario as a JSON string.
Base class for all evaluation scenarios.
Instructions and guidelines for the agent. Override in subclasses.
Persona for the agent under test. Override in subclasses.
Resources (tools, documents, information) available to the agent. Override in subclasses.
The Task for the agent under test. Override in subclasses.
Instructions and guidelines for the user. Override in subclasses.
Persona for the simulated user. Override in subclasses.
Resources (tools, documents, information) available to the user. Override in subclasses.
The Task for the simulated user. Override in subclasses.
Combine per-signal verdicts into the composite is_successful.
Default behavior: strict AND over the intersection of
self.success_signals and the signals that produced a non-None
value for this scenario.
Parameters:
Mapping of every known SuccessSignal to its verdict
for this scenario. None means the signal was not
applicable (e.g., the scenario didn’t opt in, or the run
config didn’t enable it — judge disabled, etc.).
Returns: Union[bool, str]
True / False when at least one signal in
Raises:
ValueError: ifsuccess_signalsreferences a name that’s not a validSuccessSignalmember.
Get the agent prompt for the scenario.
Get the tools for the agent in a json string.
The json string should be in the following format:
Get the user prompt for the scenario.
Get the tools for the user in a json string. The json string should be in the following format:
Save the scenario to a file.
Populate per-side shared_state before tools are instantiated.
Called by the runner once per scenario, separately for side="user"
and side="agent". The resulting state is JSON-serialized and sent
to the corresponding bot server via the shared_state_init arg of
update_system_prompt.
Default no-op. Override in subclasses to seed scenario fixtures (e.g., a database path that the action handler resolves and loads).
Convention: any *_path keys placed in state are treated as
relative to get_eval_data_root() and resolved/loaded by the action
handler. state["db_path"] becomes state["db"] after resolution.
Reconcile cross-side state after a write action fired on either side.
Mirrors upstream tau2’s Environment.sync_tools() — both DBs
live in different processes in voice mode (each bot owns one),
so this function runs on the bridge’s in-process shadow copies
and returns per-side deltas the bridge pushes back to the bots.
Default no-op: returns {"agent": {}, "user": {}}. Single-side
domains (eva, tau2_airline, tau2_retail) keep the default —
their scenarios never have user-side LLM tools so there’s
nothing to propagate.
Contract for overrides (currently only Tau2TelecomBaseScenario):
- Inputs
agent_dbanduser_dbare the bridge’s shadow dicts, already updated by replaying the just-fired action. - The override MAY mutate both dicts in place AND MUST return
the per-side delta dicts the bridge dispatches via
apply_sync_delta. - A scenario that overrides
sync_stateMUST also provide_build_tool_map(state) → {name: tool}where each tool has a syncinvoke(**kwargs)method. The bridge uses this to replay actions onto the shadow DBs before callingsync_state. Tau2 satisfies this via_Tau2InvokeMixin.
Delta shape is domain-defined — the bridge transports it
verbatim to the registered apply_sync_delta applier on the
receiving bot. See evaluation/sync_appliers.py for the
generic default applier (dotted-path field set) and per-domain
ports (e.g. tau2_telecom_sync.apply_telecom_sync_delta).
Bases: enum.Enum
Per-scenario scoring signals that participate in the is_successful composite.
Single source of truth: scenarios reference these members in their
success_signals whitelist; the runner uses the same members as the
keys of its per-signal verdict dict. Values are the canonical JSON keys
written to metrics.json / success_breakdown — StrEnum members
are string-equal to their values so the on-disk format is byte-stable
across renames.
To rename a signal: edit the value here, update the corresponding
metrics.get(<old>) lookup in the runner, and every scenario
declaration auto-picks up the new value because they reference the
enum member (not the literal string).
Task configuration for the scenario.
Render this task as a prompt section.