Booking Assistant · Case study
A guided booking combines agenda data with decisions that change during the interaction: which time has been proposed, whether it offers the selected service and whether confirmation is still allowed. ExecKernel can evaluate those decisions and retain the path. Your application prepares the agenda, receives the choice and presents the outcome.
Booking Assistant applies that separation to a simulated workshop appointment. Its interface is called Milepost Motorworks. You can select a service and time, review the appointment, revise it once and finish by confirming, cancelling or closing an expired booking window. The backend uses the JavaScript SDK to communicate with the engine over HTTP.
Follow an appointment through confirmation
Section titled “Follow an appointment through confirmation”Open the demo and select Oil & filter service. Clicking Start booking creates a session at node 10, “Choose an appointment,” and displays the agenda. All dates and times in this demo use UTC.
Choose 09:00 on the second day after starting. The slot identifier is D2-0900: it expresses an offset of two days from the UTC start date, rather than a fixed calendar date.
Before submitting, compare Proposed appointment with the Your appointment summary. The proposal appears in the selection area; the summary’s time is still empty. Clicking a slot has not yet saved an engine decision.
Click Check selected time. The application submits the selection through edge 101. If the engine accepts it, node 20, “Review your appointment,” appears and 09:00 becomes the saved selection. Now click Confirm appointment: edge 201 leads to terminal 90.

The history connects your actions to the graph: 101 saved the time selection and 201 confirmed the example’s outcome. The application displays the service and date alongside the terminal content. No appointment has been made at a real workshop.
From agenda data to the context evaluated by the engine
Section titled “From agenda data to the context evaluated by the engine”This case applies the separation introduced in Context, session state and history: context holds the data used in decisions; the session adds the current node and the path taken. The complete agenda remains application data.
The example agenda defines three services and twelve slots relative to four days. The backend turns each slot into a UTC date using createdAt, the session creation time. It also calculates whether that slot offers the selected service. Reloading later therefore does not shift the agenda to a new reference day.
When the browser sends a slotId, the backend looks it up in the case’s agenda. It does not accept a browser-supplied claim about remaining time or availability. The slotFacts() function in backend/src/agenda.ts prepares the values to send to the engine:
return { slot_id: slot.id, slot_start_epoch: slot.startEpoch, slot_service_available: slot.offered, lead_seconds: slot.startEpoch - now, slot_reselected: reselected,};slot is the appointment slot resolved by the application; now is its current time observation, in seconds. lead_seconds measures the time until the appointment. reselected identifies the permitted revision. These are facts supplied by the application; graph conditions decide whether they allow the transition.
In BookingService.next(), s is the restored remote SDK session, edgeId identifies the requested action and updates contains those values:
await s.selectEdge(edgeId, updates);This uses the pattern described in the JavaScript and TypeScript SDK: the backend holds an SDK session associated with the remote engine session and requests an explicit transition. It then reads the saved state again and constructs the application’s response.
Selection and confirmation require a nonempty slot, a valid timestamp, availability for the service and at least 86400 seconds of notice. The backend recalculates lead_seconds when confirming. Accepting a slot a few seconds earlier does not skip that evaluation.
You can observe a rejection in the same demo: with Oil & filter service, try 11:00 on the second day after starting. That slot is not offered. The interface lets you propose it, but the engine rejects the transition and the saved selection stays unchanged. The application presents the rejection without inferring which particular condition caused a general rule error.
The interaction window is a separate decision
Section titled “The interaction window is a separate decision”Appointment notice and the time allowed to complete the interaction answer different questions:
| Data or rule | Question answered | Policy in this demo |
|---|---|---|
lead_seconds |
How long until the proposed appointment? | At least 24 hours when selecting and confirming |
session_age |
How long since this booking started? | Select, revise and confirm at age ≤ 120 seconds; close for expiry at age ≥ 121 seconds |
| Cancellation | Does the person want to finish without confirming? | Available at all four nonterminal nodes |
Here we use the rule explained in Temporal conditions and TimeDSL: session_age evaluates the session’s age during the current operation. The visible countdown helps the person keep track, while the engine evaluates the window again on each operation.
To compare outcomes, click Restart simulation, start another booking and select D2-0900 again. This time, remain at “Review your appointment” until the window expires. The interface reads the state and shows that the window has ended. Use Refresh state if you need to update that observation.
You are still at node 20: reading has not traversed an edge. Click Close expired booking. Edge 204 now leads to terminal 91, “Booking window expired.”

The saved time remains visible because it is part of what happened in this case. Elapsed time changes the outcome even though the same slot remains in the agenda. The interface timer only triggers reads; closure requires the person’s explicit action.
This business deadline also does not mean that the session store has deleted the state. The demo needs to retain it to display the closure. Session expiration, history and retention explains the distinction between temporal conditions, state expiration and retention.
Revise once while retaining the previous selection
Section titled “Revise once while retaining the previous selection”From the first review, Choose another appointment follows edge 202 to node 30. The interface keeps the previous time in the summary while allowing another proposal. Only after the engine accepts 301 does it reach the final review, node 40, with slot_reselected: true.
| Stage | Action | Result |
|---|---|---|
Initial review, 20 |
202: choose again |
Node 30; the previous selection remains saved |
New selection, 30 |
301: submit another slot |
Node 40; the new slot replaces the previous one |
Final review, 40 |
401: confirm |
Terminal 90 |
Final review, 40 |
402: cancel / 403: close expired booking |
Terminal 92 / 91, respectively |
Node 40 has no further revision action. The Booking Assistant graph expresses that limit through two review stages. Revising does not create another session or restart its window.
Agenda, application case and remote session
Section titled “Agenda, application case and remote session”The demo coordinates three pieces with different roles:
| Piece | What it stores or calculates | How it contributes to the interface |
|---|---|---|
| Application agenda | Services, slots, UTC dates and service availability | Supplies the calendar and appointment details |
| Backend case record | Case identity, owner, service and association with the remote session; revision and pending operation intent | Recovers the visitor’s case and checks which state is confirmed |
| ExecKernel session | Node, context, history and timestamps | Determines available actions and result content |
On reload, the backend restores the remote session and checks that it matches the case record. Changing language presents the same path again. The browser does not need to reconstruct it by repeating choices.
If a write response is lost, the application reads the state and attempts to reconcile the outcome. Until it can verify the result, it displays the uncertainty and blocks further actions. Concurrency and session revisions develops the distinction between a saved revision and a pending action.
This coordination protects the interaction for that case. A real booking application would also need to manage slot occupancy and confirm the effect in its business agenda. In this demo, independent visitors can choose the same synthetic slot: the terminal confirms the simulated path without reserving shared inventory.