def confirm_booking_node(state: AgentState) -> dict[str, Any]: option = state.get("selected_slot") if option is None: raise ValueError("A slot must be selected before confirmation.") booking = repository.create_booking( option, state["booking_details"], float(state["calculated_price"]) ) return { "booking_id": booking.id, "status": "confirmed", "messages": [ AIMessage( content=( f"Confirmed! Booking {booking.id} is scheduled for " f"{option.start_at}. Your total is ${booking.price:.2f}." ) ) ], }