1. A sixteen-turn live DecisionHotelGraph replay
Read this first. This is a complete passing provider-backed run with HOTEL_GRAPH_CURRENT_DATE frozen to 2027-07-15. It exercises a chat model (gpt-4o) and the Jev decision model together. Model wording can vary; normalized criteria, decision boundaries, hotel results, and completion are the durable contracts.
Run it yourself
- 1
- 2
cd ezgraph-demo
npm run test2:decision-hotel-graph
The script sets USE_ENV=1 KEEP_SESSION=1. The test sends all sixteen turns through one session, semantically judges every reply, and verifies the final durable booking state. It is skipped unless TYPESAFE_API_KEY (for Jev decisions) and OPENAI_API_KEY are set.
Captured live transcript
-
1 · date range prompt
BotWhat are your Portland check-in and checkout dates?
-
2 · invalid calendar date
YouFebruary 30, 2027 through March 5, 2027
BotFebruary 30, 2027 is not a valid date. Could you please provide valid check-in and checkout dates for your stay in Portland?
-
3 · valid date range
YouAugust 1 through August 8, 2027
BotWhat nightly budget range should I use?
-
4 · invalid inverted budget
Youminimum 800 and maximum 500 per night
BotIt seems like there’s a contradiction in your budget range, as the minimum is higher than the maximum. Could you please clarify your intended budget range per night?
-
5 · valid maximum budget
Youmaximum 700 per night, with no minimum
BotWould you like one bed, two beds, or a suite?
-
6 · suite selection
BotWhich hotel amenities do you require?
-
7 · cross-step date correction
YouActually change my dates to August 3 through August 9, 2027
BotWhich hotel amenities do you require?
-
8 · amenity selection
Youfree wifi and free parking
BotDo you have an airport or city-center distance limit?
-
9 · no distance preference
Youdistance does not matter
BotCurrent Portland hotel criteria:
- Dates: 2027-08-03 to 2027-08-09
- Nightly budget: no minimum to $700
- Room type: suite
- Amenities: freeWiFi, freeParking
- Distance: no preference
Tell me what to revise, or say “search” when ready.
-
10 · criteria review
BotCurrent Portland hotel criteria:
- Dates: 2027-08-03 to 2027-08-09
- Nightly budget: no minimum to $700
- Room type: suite
- Amenities: freeWiFi, freeParking
- Distance: no preference
Tell me what to revise, or say “search” when ready.
-
11 · first grounded hotel search
Bot
-
Hampton Inn & Suites Portland Tigard
- Address: 11799 SW 69th Ave, Tigard, OR 97223
- Nightly Price Range: $522 - $600.3
- Total Price: $3810.60
-
Hilton Garden Inn Portland Airport
- Address: 12048 NE Airport Way, Portland, OR 97220
- Nightly Price Range: $576 - $662.4
- Total Price: $4204.80
-
Hilton Garden Inn Beaverton
- Address: 15520 NW Gateway Ct, Beaverton, OR 97006
- Nightly Price Range: $459 - $527.85
- Total Price: $3350.70
-
Hampton Inn Sherwood Portland
- Address: 22000 SW Meinecke Parkway Sherwood, Oregon 97140 USA
- Nightly Price Range: $486 - $558.9
- Total Price: $3547.80
Please review the options and let me know if you would like to book one of these hotels or revise your search criteria.
-
12 · revise to restrictive budget
Youchange maximum budget to 500 per night
BotCurrent Portland hotel criteria:
- Dates: 2027-08-03 to 2027-08-09
- Nightly budget: no minimum to $500
- Room type: suite
- Amenities: freeWiFi, freeParking
- Distance: no preference
Tell me what to revise, or say “search” when ready.
-
13 · empty hotel search
BotNo hotels matched all current criteria. Tell me whether to revise budget, room type, amenities, or distance.
-
14 · restore viable budget
Youchange maximum budget to 750 per night
BotCurrent Portland hotel criteria:
- Dates: 2027-08-03 to 2027-08-09
- Nightly budget: no minimum to $750
- Room type: suite
- Amenities: freeWiFi, freeParking
- Distance: no preference
Tell me what to revise, or say “search” when ready.
-
15 · second grounded hotel search
BotHere are the matching Portland hotels:
- Hampton Inn & Suites Portland Tigard — 11799 SW 69th Ave, Tigard, OR 97223 — nightly $522.00–$600.30 — total $3,810.60
- Hilton Garden Inn Portland Airport — 12048 NE Airport Way, Portland, OR 97220 — nightly $576.00–$662.40 — total $4,204.80
- Hilton Garden Inn Beaverton — 15520 NW Gateway Ct, Beaverton, OR 97006 — nightly $459.00–$527.85 — total $3,350.70
- Hampton Inn Sherwood Portland — 22000 SW Meinecke Parkway Sherwood, Oregon 97140 USA — nightly $486.00–$558.90 — total $3,547.80
Reply with a hotel name or number to book, or tell me which search criterion to revise.
-
16 · validated hotel booking · completed
BotHampton Inn & Suites Portland Tigard is booked with confirmation #785427. Thank you for choosing Hilton.
The replay includes an invalid date, inverted budget, cross-node date correction, criteria review, empty search, budget recovery, grounded hotel results, and a validated booking.
Under the hood
The transcript shows what the customer saw. This table shows the path through the graph that produced each reply, and how many Jev calls it made. J marks a decision node that called Jev. The paths are derived from each turn's response and the node code, since the replay records replies rather than raw decisions, and they add up to the 22 decision calls the final session recorded.
| Turn | Customer | Path through the graph | Jev calls |
| 1 | Hi | RouterJ → directTo(DateRangeNode) | 1 |
| 2 | February 30, 2027 through March 5, 2027 | DateRangeNode (invalid date not saved; asks again) | 0 |
| 3 | August 1 through August 8, 2027 | DateRangeNode saves → RouterJ → directTo(BudgetNode) | 1 |
| 4 | minimum 800 and maximum 500 per night | BudgetNode (inverted range not saved; asks again) | 0 |
| 5 | maximum 700 per night, with no minimum | BudgetNode saves → RouterJ → directTo(RoomTypeNode) | 1 |
| 6 | a suite | RoomTypeNode saves → RouterJ → directTo(AmenityNode) | 1 |
| 7 | Actually change my dates to August 3 through August 9, 2027 | AmenityNode reroute_request → RouterJ → DateRangeNode saves → RouterJ → directTo(AmenityNode) | 2 |
| 8 | free wifi and free parking | AmenityNode saves → RouterJ → directTo(DistanceNode) | 1 |
| 9 | distance does not matter | DistanceNode saves → RouterJ → summary; resumes at the router | 1 |
| 10 | show my criteria | RouterJ (review) → summary | 1 |
| 11 | search | RouterJ → ReadinessJ → SearchHotelsNode → PresentNode drafts → PresentationJ accepts the draft | 3 |
| 12 | change maximum budget to 500 per night | PresentNode revise_search → RouterJ → BudgetNode saves → RouterJ → summary | 2 |
| 13 | search | RouterJ → ReadinessJ → SearchHotelsNode finds nothing → RouterJ shows the notice | 3 |
| 14 | change maximum budget to 750 per night | RouterJ → BudgetNode saves → RouterJ → summary | 2 |
| 15 | search | RouterJ → ReadinessJ → SearchHotelsNode → PresentNode drafts → PresentationJ; the code-rendered list is shown | 3 |
| 16 | book hotel 1 | PresentNode chosen_hotel → finish() | 0 |
Four patterns account for almost everything:
- Every saved value sends the router back to Jev in the same turn, to choose the next question. That is the only call on turns 3, 5, 6, 8, and 9, and the second call on turns 7, 12, and 14.
- Invalid values never reach a decision node. Turns 2 and 4 stay inside a collector, whose model asks again after the handler returns
stay() or after it declines to call the tool.
- A correction is one turn (turn 7), because the router can forward the customer's message to another collector.
- Every search costs three decision calls: the router, the readiness judge, and either the presentation judge or the router again for the no-match notice.
The final session also recorded 30,693 decision tokens and 11,473 chat-model tokens. Lesson 9 breaks the decision calls down by node.
Next
2. Graph, state, and history spaces maps the nodes and state owners behind the replay.