It appears that the installer of the engine has made an error either during the installing engine or installing the incorrect/incompatible part.
Is the engine the only thing that was replaced or did they replace any other parts with it? Did they get the parts from a reputable supplier or from a second hand/used parts facility?
Whatever the answer to these questions, I know I would be taking it back to whoever installed this engine for you and having them check it out.
At the very least, have the diagnostic trouble codes (DTC's) pulled and we will be able to better assist. The fact that you are able to disconnect the battery and then it works for an hour tells me that this is more then likely a compatibility issue as if they installed the incorrect parts. Disconnecting the battery is erasing the DTC's and then it takes that amount of time for them to reset.
Let me know if we can be of more assistance.
Tuesday, April 9th, 2019 AT 9:09 PM