Standing Orders Flow
Sequence
Section titled “Sequence”Create Standing Order
Section titled “Create Standing Order”verify_member --> set_booking_details (trip_type="standing_order" + RRULE) --> review_trip --> confirm_tripv2.0 change: the standalone create_standing_order tool was removed. confirm_trip now handles BOTH single trips AND recurring standing orders — it dispatches based on the draft’s trip_type (standing_order → standing-order creator; otherwise → trip creator). Agents have a single confirmation surface for both flows.
- verify_member — Establish session
- set_booking_details — Set
trip_type = "standing_order"along with pickup, dropoff, appointment time, and the recurrence rule (RRULE) - review_trip — Review the standing order summary (the formatter shows the schedule when
trip_type=standing_order) - confirm_trip — Routes to
nemt-standing-orderservice when the draft is recurring. Returnsstanding_order_id,days_of_week,start_date,end_date,so_appointment_time,recurring=true.
The RRULE defines the recurrence pattern (e.g., every Mon/Wed/Fri) and date range. The standing-order service generates individual trip instances from the rule.
After successful creation, the session is updated with IsStandingOrder=true, StandingOrderID, and StandingOrderMeta — send_confirmation reads these to render the schedule email + PDF attachments.
List Standing Orders
Section titled “List Standing Orders”verify_member --> get_standing_ordersReturns all standing orders for the member with order_id, status, treatment_type, schedule, start_date, and end_date.
Cancel Standing Order
Section titled “Cancel Standing Order”verify_member --> get_standing_orders --> cancel_standing_order(order_id) # Step 1: returns reasons --> cancel_standing_order(order_id, reason) # Step 2: cancelsSame two-step pattern as cancel_trip — see the Cancellation Flow.
Cancelling a standing order stops future trip generation. Already-created trips from the order are not automatically cancelled.
Error Scenarios
Section titled “Error Scenarios”| Error | Recovery |
|---|---|
MISSING_PREREQUISITE (no review) |
Call review_trip before confirm_trip |
MISSING_PREREQUISITE (recurrence rule) |
Re-call set_booking_details with trip_type=standing_order and the RRULE |
| Order not found | Re-fetch with get_standing_orders |