  We compute the gravitational effective action by integrating out quantum
matter fields in a weak gravitational field, using the Schwinger-Keldysh
(in-in) formalism. We pay particular attention to the role of the initial
quantum state in the structure of the nonlocal terms in the effective action,
with an eye to nonlinear completions of the theory that may be relevant in
astrophysics and cosmology. In this first paper we consider a quantum scalar
field in thermal equilibrium, in a stationary gravitational field. We obtain a
covariant expression for the nonlocal effective action, that can be expressed
in terms of the curvature tensor, the four-velocity of the thermal bath and the
local Tolman temperature. We discuss the connection between the results for
ultrastatic and static metrics through conformal transformations, and the main
features of the thermal corrections to the semiclassical Einstein equations.
