This paper presents an exact probabilistic description of the work done by an external
agent on a two-level system. We first develop a general scheme which is suitable for the
treatment of functionals of the time-inhomogeneous Markov processes. Subsequently, we
apply the procedure to the analysis of the isothermal-work probability density and we
obtain its exact analytical forms in two specific settings. In both models, the state energies
change with a constant velocity. On the other hand, the two models differ in their
interstate transition rates. The explicit forms of the probability density allow a detailed
discussion of the mean work. Moreover, we discuss the weight of the trajectories which
display a smaller value of work than the corresponding equilibrium work. The results are
controlled by a single dimensionless parameter which expresses the ratio of two underlying
timescales: the velocity of the energy changes and the relaxation time in the case of
frozen energies. If this parameter is large, the process is a strongly irreversible one
and the work probability density differs substantially from a Gaussian curve.