Various logging-while-drilling (LWD) and seismic-while-drilling (SWD) tools offer opportunities to obtain geological information near the bottomhole assembly during the drilling process. These real-time in-situ data provide relatively high-resolution information around and possibly ahead of the drilling path compared with the data from a surface seismic survey. The use of these in-situ data offers substantial potential for improved recovery through continuous optimization of the remaining well path while drilling. We show an automated workflow for proactive geosteering through continuous updating of the estimates of the Earth model and robust optimization of the remaining well path under uncertainty. A synthetic example is shown to illustrate the proposed workflow. The estimates of the depths of the reservoir surfaces and the depth of the oil/water contact and their associated uncertainty are obtained through the ensemble Kalman filter by use of directional-resistivity measurements. A robust optimization is used to compute the well position that minimizes the average cost function evaluated on the ensemble of geological models estimated from the ensemble Kalman filter (EnKF). The effect of modeling errors and the effect of joint estimation of the depths of the boundaries and gridblock resistivity are also investigated.