nemo_voice_agent.evaluation.tools.tau2_airline_tools
nemo_voice_agent.evaluation.tools.tau2_airline_tools
Tau2-airline tool ports.
Each LLM-exposed tool from tau2’s AirlineTools class becomes a
StandardSchemaTool or WriteScenarioTool subclass. The DB lives in
self.state["db"] as a raw dict (loaded from nemo_voice_agent/evaluation/data/tau2_airline/db.json);
tools mutate it in place. Write-tools call self._record_action({...}) with an
action_type matching one of TAU2_AIRLINE_ACTION_TYPES.
Two parallel call paths exist, both routing through _do_work(p):
- Live agent — pipecat invokes
await tool(params), which routes throughStandardSchemaTool.__call__→_execute(**arguments)→_do_work(p)._executeonly returns the result;__call__owns delivery to pipecat. - Gold replay —
Tau2BaseScenario._gold_replayinvokestool.invoke(**arguments)→_do_work(p)synchronously, returning the result directly.
The _Tau2InvokeMixin handles both routings so each individual tool only
implements _do_work.
Module Contents
Classes
Functions
Data
TAU2_AIRLINE_TOOL_NAME_TO_CLASS
API
Bases: _Tau2WriteTool
Emit <exit> only after the tool result has been delivered.
Ordering matters: pipecat must commit the tool-call record before the bridge tears the session down.
Provides sync invoke(**kwargs) + async _execute(**kwargs) routing.
Subclasses set PARAMS_MODEL = MyParams and implement _do_work(p).
Async entry — invoked by pipecat on live LLM tool calls.
Pure: returns the result. StandardSchemaTool.__call__ owns delivery
and applies the empty-result normalization (a falsy result such as an
empty match list would otherwise be masked as the literal “COMPLETED”,
which the LLM reads as success).
Synchronous entry — used by Tau2BaseScenario._gold_replay.
Bases: _Tau2InvokeMixin, StandardSchemaTool
Base for tau2 read-only tools — inherits StandardSchemaTool (no action recording).
Bases: _Tau2InvokeMixin, WriteScenarioTool
Base for tau2 write tools — inherits WriteScenarioTool (_record_action + ACTION_TYPES).
Mirror tau2’s _get_datetime.
Mirror tau2: try HATHAT/HATHAU/HATHAV in order; first unused wins.
Validate a payment method and (if applicable) deduct from a gift card.
Returns a dict with either {"status": "ok", "payment": {...} | None} or
a structured error. Mirrors tau2’s _payment_for_update semantics:
- certificate cannot be used for updates (always error)
- gift_card requires sufficient balance
- credit_card has no balance check Mutates the user dict in place when deducting from a gift card.
Mirror tau2’s _search_direct_flight helper.
Returns DirectFlight-shaped dicts: {flight_number, origin, destination, status="available", scheduled_departure_time_est, scheduled_arrival_time_est, available_seats, prices}. Date is not stamped here — callers (e.g.
search_onestop_flight) attach it.