Three-level atoms in lambda configuration find diverse applications in quantum information processing, and a promising way to manipulate their quantum states is with single-photon pulses propagating in a waveguide (which can be theoretically regarded as a highly broadband regime of the Jaynes–Cummings model). Here, we analytically find the nonperturbative dynamics of a lambda atom driven by a two-photon wave packet, propagating in a 1D electromagnetic environment. We study the dynamics of a quantum state purification as an application. By comparing our exact model with an approximated model of two cascaded single-photon wave packets, we show how two-photon nonlinearities and stimulated emission affect the purification.