This paper describes the Mediating Agent, an animated pedagogical agent inserted in a computational system for distance learning, which has the goal of motivating the student to learn as well as promoting a positive mood in the student, which is more appropriate to learning. In order to accomplish its function, the agent should recognize the student’s emotions to respond appropriately. Thus, it catches some information from observing the student’s behaviour in the interface of the educational system, which allows it to infer the student’s affective states according to the cognitive approach of emotion. This information is stored in an affective model and it is used so that the agent may choose an affective pedagogical tactic to be applied.