agent reconnect logic.