The agent will try to connect to the server every time the connection is lost, so if your internet connection is interrupted it is not a problem. The agent will reconnect by itself.
If the server appears as down, it may be because it is saving energy and network functions are sleeping. In this case, you may need to reconfigure it to so it does not enter sleep mode, or that only the monitor enters sleep mode.