nemo_voice_agent.evaluation.tools.tau2_airline_tools

View as Markdown

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):

  1. Live agent — pipecat invokes await tool(params), which routes through StandardSchemaTool.__call___execute(**arguments)_do_work(p). _execute only returns the result; __call__ owns delivery to pipecat.
  2. Gold replayTau2BaseScenario._gold_replay invokes tool.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

NameDescription
BookReservationTool-
CalculateTool-
CancelReservationTool-
GetFlightStatusTool-
GetReservationDetailsTool-
GetUserDetailsTool-
ListAllAirportsTool-
SearchDirectFlightTool-
SearchOnestopFlightTool-
SendCertificateTool-
TransferToHumanAgentsTool-
UpdateReservationBaggagesTool-
UpdateReservationFlightsTool-
UpdateReservationPassengersTool-
_Tau2InvokeMixinProvides sync invoke(**kwargs) + async _execute(**kwargs) routing.
_Tau2ReadToolBase for tau2 read-only tools — inherits StandardSchemaTool (no action recording).
_Tau2WriteToolBase for tau2 write tools — inherits WriteScenarioTool (_record_action + ACTION_TYPES).

Functions

NameDescription
_current_datetimeMirror tau2’s _get_datetime.
_db_not_initialized-
_get_flight_dict-
_get_flight_instance_dict-
_get_new_reservation_idMirror tau2: try HATHAT/HATHAU/HATHAV in order; first unused wins.
_get_reservation_dict-
_get_user_dict-
_payment_for_updateValidate a payment method and (if applicable) deduct from a gift card.
_search_direct_flightsMirror tau2’s _search_direct_flight helper.

Data

TAU2_AIRLINE_ACTION_TYPES

TAU2_AIRLINE_TOOL_CLASSES

TAU2_AIRLINE_TOOL_NAME_TO_CLASS

_ALL_AIRPORTS

_NEW_PAYMENT_IDS

API

class nemo_voice_agent.evaluation.tools.tau2_airline_tools.BookReservationTool()

Bases: _Tau2WriteTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.BookReservationTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.BookReservationParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.CalculateTool()

Bases: _Tau2ReadTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.CalculateTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.CalculateParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.CancelReservationTool()

Bases: _Tau2WriteTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.CancelReservationTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.CancelReservationParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetFlightStatusTool()

Bases: _Tau2ReadTool

DESCRIPTION
= 'Get the status of a flight on a given date.'
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetFlightStatusTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.GetFlightStatusParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetReservationDetailsTool()

Bases: _Tau2ReadTool

DESCRIPTION
= 'Get the details of a reservation.'
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetReservationDetailsTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.GetReservationDetailsParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetUserDetailsTool()

Bases: _Tau2ReadTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetUserDetailsTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.GetUserDetailsParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.ListAllAirportsTool()

Bases: _Tau2ReadTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.ListAllAirportsTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.ListAllAirportsParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.SearchDirectFlightTool()

Bases: _Tau2ReadTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.SearchDirectFlightTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.SearchDirectFlightParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.SearchOnestopFlightTool()

Bases: _Tau2ReadTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.SearchOnestopFlightTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.SearchOnestopFlightParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.SendCertificateTool()

Bases: _Tau2WriteTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.SendCertificateTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.SendCertificateParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.TransferToHumanAgentsTool()

Bases: _Tau2WriteTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TransferToHumanAgentsTool._after_result(
params: pipecat.services.llm_service.FunctionCallParams
) -> None
async

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.

nemo_voice_agent.evaluation.tools.tau2_airline_tools.TransferToHumanAgentsTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.TransferToHumanAgentsParams
) -> dict
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TransferToHumanAgentsTool._execute(
kwargs = {}
) -> dict
async
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationBaggagesTool()

Bases: _Tau2WriteTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationBaggagesTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.UpdateReservationBaggagesParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationFlightsTool()

Bases: _Tau2WriteTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationFlightsTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.UpdateReservationFlightsParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationPassengersTool()

Bases: _Tau2WriteTool

DESCRIPTION
properties
Dict[str, Any]
required_properties
List[str]
nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationPassengersTool._do_work(
p: nemo_voice_agent.evaluation.tools.tau2_airline_params.UpdateReservationPassengersParams
) -> dict
class nemo_voice_agent.evaluation.tools.tau2_airline_tools._Tau2InvokeMixin()

Provides sync invoke(**kwargs) + async _execute(**kwargs) routing.

Subclasses set PARAMS_MODEL = MyParams and implement _do_work(p).

PARAMS_MODEL
Optional[Type[BaseModel]] = None
nemo_voice_agent.evaluation.tools.tau2_airline_tools._Tau2InvokeMixin._do_work(
p
) -> dict
nemo_voice_agent.evaluation.tools.tau2_airline_tools._Tau2InvokeMixin._execute(
kwargs = {}
) -> dict
async

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).

nemo_voice_agent.evaluation.tools.tau2_airline_tools._Tau2InvokeMixin.invoke(
kwargs = {}
) -> dict

Synchronous entry — used by Tau2BaseScenario._gold_replay.

class nemo_voice_agent.evaluation.tools.tau2_airline_tools._Tau2ReadTool(
shared_state: typing.Optional[dict] = None,
description: typing.Optional[str] = None
)

Bases: _Tau2InvokeMixin, StandardSchemaTool

Base for tau2 read-only tools — inherits StandardSchemaTool (no action recording).

DESCRIPTION
str = ''
state
= shared_state if shared_state is not None else {}
class nemo_voice_agent.evaluation.tools.tau2_airline_tools._Tau2WriteTool(
shared_state: typing.Optional[dict] = None,
description: typing.Optional[str] = None
)

Bases: _Tau2InvokeMixin, WriteScenarioTool

Base for tau2 write tools — inherits WriteScenarioTool (_record_action + ACTION_TYPES).

DESCRIPTION
str = ''
state
= shared_state if shared_state is not None else {}
nemo_voice_agent.evaluation.tools.tau2_airline_tools._current_datetime() -> str

Mirror tau2’s _get_datetime.

nemo_voice_agent.evaluation.tools.tau2_airline_tools._db_not_initialized() -> dict
nemo_voice_agent.evaluation.tools.tau2_airline_tools._get_flight_dict(
db: dict,
flight_number: str
) -> typing.Optional[dict]
nemo_voice_agent.evaluation.tools.tau2_airline_tools._get_flight_instance_dict(
db: dict,
flight_number: str,
date: str
) -> typing.Optional[dict]
nemo_voice_agent.evaluation.tools.tau2_airline_tools._get_new_reservation_id(
db: dict
) -> typing.Optional[str]

Mirror tau2: try HATHAT/HATHAU/HATHAV in order; first unused wins.

nemo_voice_agent.evaluation.tools.tau2_airline_tools._get_reservation_dict(
db: dict,
reservation_id: str
) -> typing.Optional[dict]
nemo_voice_agent.evaluation.tools.tau2_airline_tools._get_user_dict(
db: dict,
user_id: str
) -> typing.Optional[dict]
nemo_voice_agent.evaluation.tools.tau2_airline_tools._payment_for_update(
user: dict,
payment_id: str,
total_price: int
) -> dict

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.
nemo_voice_agent.evaluation.tools.tau2_airline_tools._search_direct_flights(
db: dict,
date: str,
origin: typing.Optional[str] = None,
destination: typing.Optional[str] = None,
leave_after: typing.Optional[str] = None
) -> typing.List[dict]

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.

nemo_voice_agent.evaluation.tools.tau2_airline_tools.TAU2_AIRLINE_ACTION_TYPES: List[str] = ['book_reservation', 'cancel_reservation', 'send_certificate', 'update_reservati...
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TAU2_AIRLINE_TOOL_CLASSES: List[Type[StandardSchemaTool]] = [GetUserDetailsTool, GetReservationDetailsTool, ListAllAirportsTool, SearchDirec...
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TAU2_AIRLINE_TOOL_NAME_TO_CLASS: Dict[str, Type[StandardSchemaTool]] = {'get_user_details': GetUserDetailsTool, 'get_reservation_details': GetReservati...
nemo_voice_agent.evaluation.tools.tau2_airline_tools._ALL_AIRPORTS: List[Dict[str, str]] = [{'iata': 'SFO', 'city': 'San Francisco'}, {'iata': 'JFK', 'city': 'New York'}, ...
nemo_voice_agent.evaluation.tools.tau2_airline_tools._NEW_PAYMENT_IDS = (3221322, 3221323, 3221324)