Using the diagram technique for Matsubara Green's functions it is shown that the dynamics of the localized spin subsystem in the s-d(f) model can be described in terms of an effective spin model with multi-site spin-spin interactions. An exact representation of the action for the effective purely spin model is derived as an infinite series in powers of s-d(f) exchange interaction J. The indirect interactions of the 2-nd, 3-rd and 4-th order are discussed.