zeph-bench 0.21.2

Benchmark harness for evaluating Zeph agent performance on standardized datasets
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
// SPDX-License-Identifier: MIT OR Apache-2.0

//! Tool definitions for tau2-bench retail and airline domains.
//!
//! Each domain exposes a set of structured tools the agent can invoke.
//! Definitions follow the schemars 1.x pattern used by `zeph-tools`.

// Param structs exist solely for schemars schema derivation; their fields are
// intentionally not read by Rust code — they are read by the LLM via JSON schema.
#![allow(dead_code)]

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use zeph_tools::registry::{InvocationHint, ToolDef};

// ─── Airline nested types ────────────────────────────────────────────────────

/// A single flight leg in a reservation (flight number + departure date).
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct FlightSegment {
    /// IATA or internal flight number (e.g. `"AA123"`).
    pub flight_number: String,
    /// Departure date in `YYYY-MM-DD` format.
    pub date: String,
}

/// Passenger identity data required when booking or updating a reservation.
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct Passenger {
    /// Passenger's given name.
    pub first_name: String,
    /// Passenger's family name.
    pub last_name: String,
    /// Date of birth in `YYYY-MM-DD` format.
    pub dob: String,
}

// ─── Retail shared params ────────────────────────────────────────────────────

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct CalculateParams {
    /// Mathematical expression to evaluate (e.g. `"1 + 2 * 3"`).
    pub expression: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct CancelPendingOrderParams {
    /// Order id (e.g. `"#W1234567"`).
    pub order_id: String,
    /// Reason for cancellation: one of `no_longer_needed`, `ordered_by_mistake`.
    pub reason: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ExchangeDeliveredOrderItemsParams {
    /// Order id (e.g. `"#W1234567"`).
    pub order_id: String,
    /// List of item ids to exchange.
    pub item_ids: Vec<String>,
    /// New item ids to exchange into.
    pub new_item_ids: Vec<String>,
    /// Payment method id to charge any delta.
    pub payment_method_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct FindUserIdByEmailParams {
    /// User's email address.
    pub email: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct FindUserIdByNameZipParams {
    /// User's first name.
    pub first_name: String,
    /// User's last name.
    pub last_name: String,
    /// User's ZIP code.
    pub zip: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetOrderDetailsParams {
    /// Order id (e.g. `"#W1234567"`).
    pub order_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetProductDetailsParams {
    /// Product id.
    pub product_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetItemDetailsParams {
    /// Item id (variant id).
    pub item_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetUserDetailsParams {
    /// User id.
    pub user_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ModifyPendingOrderAddressParams {
    /// Order id.
    pub order_id: String,
    /// New address line 1.
    pub address1: String,
    /// New address line 2.
    pub address2: String,
    /// City.
    pub city: String,
    /// State.
    pub state: String,
    /// ZIP code.
    pub zip: String,
    /// Country.
    pub country: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ModifyPendingOrderItemsParams {
    /// Order id.
    pub order_id: String,
    /// Item ids to remove.
    pub item_ids: Vec<String>,
    /// New item ids to add.
    pub new_item_ids: Vec<String>,
    /// Payment method id to charge any delta.
    pub payment_method_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ModifyPendingOrderPaymentParams {
    /// Order id.
    pub order_id: String,
    /// New payment method id.
    pub payment_method_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ModifyUserAddressParams {
    /// User id.
    pub user_id: String,
    /// New address line 1.
    pub address1: String,
    /// New address line 2.
    pub address2: String,
    /// City.
    pub city: String,
    /// State.
    pub state: String,
    /// ZIP code.
    pub zip: String,
    /// Country.
    pub country: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ReturnDeliveredOrderItemsParams {
    /// Order id.
    pub order_id: String,
    /// List of item ids to return.
    pub item_ids: Vec<String>,
    /// Payment method id for refund.
    pub payment_method_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct TransferToHumanAgentsParams {
    /// Reason for transfer.
    pub summary: String,
}

/// Empty-object schema for tools that take no parameters.
///
/// LLM providers require `type: "object"` even for no-arg tools; `schemars::schema_for!(())`
/// produces `type: "null"` which most providers reject.
fn empty_object_schema() -> schemars::Schema {
    serde_json::from_value(serde_json::json!({"type": "object", "properties": {}}))
        .expect("static schema is valid")
}

/// Return all tool definitions for the retail domain.
#[must_use]
#[allow(clippy::too_many_lines)]
pub fn retail_definitions() -> Vec<ToolDef> {
    vec![
        ToolDef {
            id: "calculate".into(),
            description: "Calculate the result of a mathematical expression.".into(),
            schema: schemars::schema_for!(CalculateParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "cancel_pending_order".into(),
            description: "Cancel a pending order. Returns updated order details.".into(),
            schema: schemars::schema_for!(CancelPendingOrderParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "exchange_delivered_order_items".into(),
            description: "Exchange items in a delivered order.".into(),
            schema: schemars::schema_for!(ExchangeDeliveredOrderItemsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "find_user_id_by_email".into(),
            description: "Look up a user ID by email address.".into(),
            schema: schemars::schema_for!(FindUserIdByEmailParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "find_user_id_by_name_zip".into(),
            description: "Look up a user ID by first name, last name, and ZIP code.".into(),
            schema: schemars::schema_for!(FindUserIdByNameZipParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "get_order_details".into(),
            description: "Get details of an order by order ID.".into(),
            schema: schemars::schema_for!(GetOrderDetailsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "get_product_details".into(),
            description: "Get all variants and pricing for a product.".into(),
            schema: schemars::schema_for!(GetProductDetailsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "get_item_details".into(),
            description: "Get details of a specific item variant.".into(),
            schema: schemars::schema_for!(GetItemDetailsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "get_user_details".into(),
            description: "Get details of a user by user ID.".into(),
            schema: schemars::schema_for!(GetUserDetailsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "list_all_product_types".into(),
            description: "List all available product type names.".into(),
            schema: empty_object_schema(),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "modify_pending_order_address".into(),
            description: "Modify the shipping address of a pending order.".into(),
            schema: schemars::schema_for!(ModifyPendingOrderAddressParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "modify_pending_order_items".into(),
            description: "Modify items in a pending order.".into(),
            schema: schemars::schema_for!(ModifyPendingOrderItemsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "modify_pending_order_payment".into(),
            description: "Change the payment method for a pending order.".into(),
            schema: schemars::schema_for!(ModifyPendingOrderPaymentParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "modify_user_address".into(),
            description: "Update the address on file for a user.".into(),
            schema: schemars::schema_for!(ModifyUserAddressParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "return_delivered_order_items".into(),
            description: "Return items from a delivered order and issue a refund.".into(),
            schema: schemars::schema_for!(ReturnDeliveredOrderItemsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "transfer_to_human_agents".into(),
            description: "Escalate the conversation to a human agent.".into(),
            schema: schemars::schema_for!(TransferToHumanAgentsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
    ]
}

// ─── Airline params ──────────────────────────────────────────────────────────

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct BookReservationParams {
    /// User id of the passenger.
    pub user_id: String,
    /// Origin airport code.
    pub origin: String,
    /// Destination airport code.
    pub destination: String,
    /// Flight type: `one_way` or `round_trip`.
    pub flight_type: String,
    /// Cabin class: `basic_economy`, `economy`, `business`.
    pub cabin: String,
    /// List of flights to include.
    pub flights: Vec<FlightSegment>,
    /// List of passengers.
    pub passengers: Vec<Passenger>,
    /// Payment method id.
    pub payment_method_id: String,
    /// Total number of checked bags.
    pub total_baggages: u32,
    /// Number of non-free (charged) bags.
    pub nonfree_baggages: u32,
    /// Whether travel insurance is included: `yes` or `no`.
    pub insurance: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct CancelReservationParams {
    /// Reservation id.
    pub reservation_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetReservationDetailsParams {
    /// Reservation id.
    pub reservation_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetAirlineUserDetailsParams {
    /// User id.
    pub user_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct SearchDirectFlightParams {
    /// Origin airport code.
    pub origin: String,
    /// Destination airport code.
    pub destination: String,
    /// Departure date (YYYY-MM-DD).
    pub date: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct SearchOnestopFlightParams {
    /// Origin airport code.
    pub origin: String,
    /// Destination airport code.
    pub destination: String,
    /// Departure date (YYYY-MM-DD).
    pub date: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct SendCertificateParams {
    /// User id to send the certificate to.
    pub user_id: String,
    /// Dollar amount of the certificate.
    pub amount: f64,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct UpdateReservationBaggagesParams {
    /// Reservation id.
    pub reservation_id: String,
    /// New total number of bags.
    pub total_baggages: u32,
    /// New number of non-free bags.
    pub nonfree_baggages: u32,
    /// Payment method id to charge extra bag fees.
    pub payment_method_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct UpdateReservationFlightsParams {
    /// Reservation id.
    pub reservation_id: String,
    /// Cabin class for the updated flights.
    pub cabin: String,
    /// New list of flights.
    pub flights: Vec<FlightSegment>,
    /// Payment method id.
    pub payment_method_id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct UpdateReservationPassengersParams {
    /// Reservation id.
    pub reservation_id: String,
    /// Updated passenger list.
    pub passengers: Vec<Passenger>,
}

#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetFlightStatusParams {
    /// Flight number.
    pub flight_number: String,
    /// Flight date (YYYY-MM-DD).
    pub date: String,
}

/// Return all tool definitions for the airline domain.
#[must_use]
pub fn airline_definitions() -> Vec<ToolDef> {
    vec![
        ToolDef {
            id: "book_reservation".into(),
            description: "Book a new flight reservation for a user.".into(),
            schema: schemars::schema_for!(BookReservationParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "calculate".into(),
            description: "Calculate the result of a mathematical expression.".into(),
            schema: schemars::schema_for!(CalculateParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "cancel_reservation".into(),
            description: "Cancel an existing flight reservation and process refund.".into(),
            schema: schemars::schema_for!(CancelReservationParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "get_reservation_details".into(),
            description: "Get details of a reservation by reservation ID.".into(),
            schema: schemars::schema_for!(GetReservationDetailsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "get_user_details".into(),
            description: "Get details of a user by user ID.".into(),
            schema: schemars::schema_for!(GetAirlineUserDetailsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "list_all_airports".into(),
            description: "List all airports with their city, country, and code.".into(),
            schema: empty_object_schema(),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "search_direct_flight".into(),
            description: "Search for direct flights between two airports on a given date.".into(),
            schema: schemars::schema_for!(SearchDirectFlightParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "search_onestop_flight".into(),
            description: "Search for one-stop flights between two airports on a given date.".into(),
            schema: schemars::schema_for!(SearchOnestopFlightParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "send_certificate".into(),
            description: "Send a travel certificate to a user as compensation.".into(),
            schema: schemars::schema_for!(SendCertificateParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "transfer_to_human_agents".into(),
            description: "Escalate the conversation to a human agent.".into(),
            schema: schemars::schema_for!(TransferToHumanAgentsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "update_reservation_baggages".into(),
            description: "Update the baggage allowance on a reservation.".into(),
            schema: schemars::schema_for!(UpdateReservationBaggagesParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "update_reservation_flights".into(),
            description: "Change the flights on an existing reservation.".into(),
            schema: schemars::schema_for!(UpdateReservationFlightsParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "update_reservation_passengers".into(),
            description: "Update passenger information on a reservation.".into(),
            schema: schemars::schema_for!(UpdateReservationPassengersParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
        ToolDef {
            id: "get_flight_status".into(),
            description: "Get the status of a flight by flight number and date.".into(),
            schema: schemars::schema_for!(GetFlightStatusParams),
            invocation: InvocationHint::ToolCall,
            output_schema: None,
        },
    ]
}