new functionality: automatic agent reconnect to server