> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/labs-voice-agent/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/labs-voice-agent/_mcp/server.

# 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(&#123;...&#125;)` 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 replay** — `Tau2BaseScenario._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

| Name                                                                                                                       | Description                                                                                   |
| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [`BookReservationTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-BookReservationTool)                         | -                                                                                             |
| [`CalculateTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-CalculateTool)                                     | -                                                                                             |
| [`CancelReservationTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-CancelReservationTool)                     | -                                                                                             |
| [`GetFlightStatusTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-GetFlightStatusTool)                         | -                                                                                             |
| [`GetReservationDetailsTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-GetReservationDetailsTool)             | -                                                                                             |
| [`GetUserDetailsTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-GetUserDetailsTool)                           | -                                                                                             |
| [`ListAllAirportsTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-ListAllAirportsTool)                         | -                                                                                             |
| [`SearchDirectFlightTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-SearchDirectFlightTool)                   | -                                                                                             |
| [`SearchOnestopFlightTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-SearchOnestopFlightTool)                 | -                                                                                             |
| [`SendCertificateTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-SendCertificateTool)                         | -                                                                                             |
| [`TransferToHumanAgentsTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-TransferToHumanAgentsTool)             | -                                                                                             |
| [`UpdateReservationBaggagesTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-UpdateReservationBaggagesTool)     | -                                                                                             |
| [`UpdateReservationFlightsTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-UpdateReservationFlightsTool)       | -                                                                                             |
| [`UpdateReservationPassengersTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-UpdateReservationPassengersTool) | -                                                                                             |
| [`_Tau2InvokeMixin`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2InvokeMixin)                               | Provides sync `invoke(**kwargs)` + async `_execute(**kwargs)` routing.                        |
| [`_Tau2ReadTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2ReadTool)                                     | Base for tau2 read-only tools — inherits `StandardSchemaTool` (no action recording).          |
| [`_Tau2WriteTool`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2WriteTool)                                   | Base for tau2 write tools — inherits `WriteScenarioTool` (`_record_action` + `ACTION_TYPES`). |

### Functions

| Name                                                                                                           | Description                                                            |
| -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [`_current_datetime`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_current_datetime)                 | Mirror tau2's `_get_datetime`.                                         |
| [`_db_not_initialized`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_db_not_initialized)             | -                                                                      |
| [`_get_flight_dict`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_get_flight_dict)                   | -                                                                      |
| [`_get_flight_instance_dict`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_get_flight_instance_dict) | -                                                                      |
| [`_get_new_reservation_id`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_get_new_reservation_id)     | Mirror tau2: try HATHAT/HATHAU/HATHAV in order; first unused wins.     |
| [`_get_reservation_dict`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_get_reservation_dict)         | -                                                                      |
| [`_get_user_dict`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_get_user_dict)                       | -                                                                      |
| [`_payment_for_update`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_payment_for_update)             | Validate a payment method and (if applicable) deduct from a gift card. |
| [`_search_direct_flights`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_search_direct_flights)       | Mirror tau2's `_search_direct_flight` helper.                          |

### Data

[`TAU2_AIRLINE_ACTION_TYPES`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-TAU2_AIRLINE_ACTION_TYPES)

[`TAU2_AIRLINE_TOOL_CLASSES`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-TAU2_AIRLINE_TOOL_CLASSES)

[`TAU2_AIRLINE_TOOL_NAME_TO_CLASS`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-TAU2_AIRLINE_TOOL_NAME_TO_CLASS)

[`_ALL_AIRPORTS`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_ALL_AIRPORTS)

[`_NEW_PAYMENT_IDS`](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_NEW_PAYMENT_IDS)

### API

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

**Bases:** [\_Tau2WriteTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2WriteTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.BookReservationTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.BookReservationParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.CalculateTool()
```

**Bases:** [\_Tau2ReadTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2ReadTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.CalculateTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.CalculateParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.CancelReservationTool()
```

**Bases:** [\_Tau2WriteTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2WriteTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.CancelReservationTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.CancelReservationParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetFlightStatusTool()
```

**Bases:** [\_Tau2ReadTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2ReadTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetFlightStatusTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.GetFlightStatusParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetReservationDetailsTool()
```

**Bases:** [\_Tau2ReadTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2ReadTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetReservationDetailsTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.GetReservationDetailsParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetUserDetailsTool()
```

**Bases:** [\_Tau2ReadTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2ReadTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.GetUserDetailsTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.GetUserDetailsParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.ListAllAirportsTool()
```

**Bases:** [\_Tau2ReadTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2ReadTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.ListAllAirportsTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.ListAllAirportsParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.SearchDirectFlightTool()
```

**Bases:** [\_Tau2ReadTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2ReadTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.SearchDirectFlightTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.SearchDirectFlightParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.SearchOnestopFlightTool()
```

**Bases:** [\_Tau2ReadTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2ReadTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.SearchOnestopFlightTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.SearchOnestopFlightParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.SendCertificateTool()
```

**Bases:** [\_Tau2WriteTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2WriteTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.SendCertificateTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.SendCertificateParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.TransferToHumanAgentsTool()
```

**Bases:** [\_Tau2WriteTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2WriteTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TransferToHumanAgentsTool._after_result(
    params: pipecat.services.llm_service.FunctionCallParams
) -> None
```

async

Emit `&lt;exit&gt;` only after the tool result has been delivered.

Ordering matters: pipecat must commit the tool-call record before the
bridge tears the session down.

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TransferToHumanAgentsTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.TransferToHumanAgentsParams
) -> dict
```

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TransferToHumanAgentsTool._execute(
    kwargs = {}
) -> dict
```

async

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationBaggagesTool()
```

**Bases:** [\_Tau2WriteTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2WriteTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationBaggagesTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.UpdateReservationBaggagesParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationFlightsTool()
```

**Bases:** [\_Tau2WriteTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2WriteTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationFlightsTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.UpdateReservationFlightsParams
) -> dict
```

```python
class nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationPassengersTool()
```

**Bases:** [\_Tau2WriteTool](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2WriteTool)

**`DESCRIPTION`**

---

**`properties`**

---

**`required_properties`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.UpdateReservationPassengersTool._do_work(
    p: nemo_voice_agent.evaluation.tools.tau2_airline_params.UpdateReservationPassengersParams
) -> dict
```

```python
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`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools._Tau2InvokeMixin._do_work(
    p
) -> dict
```

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

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

Synchronous entry — used by `Tau2BaseScenario._gold_replay`.

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

**Bases:** [\_Tau2InvokeMixin](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2InvokeMixin), [StandardSchemaTool](/nemo/labs-voice-agent/nemo-voice-agent/nemo_voice_agent/utils/tool_calling/base#nemo_voice_agent-utils-tool_calling-base-StandardSchemaTool)

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

**`DESCRIPTION`**

---

**`state`**

---

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

**Bases:** [\_Tau2InvokeMixin](#nemo_voice_agent-evaluation-tools-tau2_airline_tools-_Tau2InvokeMixin), [WriteScenarioTool](./_write_tool_base.mdx#nemo_voice_agent-evaluation-tools-_write_tool_base-WriteScenarioTool)

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

**`DESCRIPTION`**

---

**`state`**

---

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools._current_datetime() -> str
```

Mirror tau2's `_get_datetime`.

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools._db_not_initialized() -> dict
```

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools._get_flight_dict(
    db: dict,
    flight_number: str
) -> typing.Optional[dict]
```

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

```python
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.

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools._get_reservation_dict(
    db: dict,
    reservation_id: str
) -> typing.Optional[dict]
```

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools._get_user_dict(
    db: dict,
    user_id: str
) -> typing.Optional[dict]
```

```python
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 `&#123;"status": "ok", "payment": &#123;...&#125; | None&#125;` 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.

```python
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: `&#123;flight_number, origin, destination,
status="available", scheduled_departure_time_est, scheduled_arrival_time_est,
available_seats, prices&#125;`. Date is **not** stamped here — callers (e.g.
`search_onestop_flight`) attach it.

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TAU2_AIRLINE_ACTION_TYPES: List[str] = ['book_reservation', 'cancel_reservation', 'send_certificate', 'update_reservati...
```

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools.TAU2_AIRLINE_TOOL_CLASSES: List[Type[StandardSchemaTool]] = [GetUserDetailsTool, GetReservationDetailsTool, ListAllAirportsTool, SearchDirec...
```

```python
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...
```

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools._ALL_AIRPORTS: List[Dict[str, str]] = [{'iata': 'SFO', 'city': 'San Francisco'}, {'iata': 'JFK', 'city': 'New York'}, ...
```

```python
nemo_voice_agent.evaluation.tools.tau2_airline_tools._NEW_PAYMENT_IDS = (3221322, 3221323, 3221324)
```