The general rule is that past participles taking 'avoir' as the auxiliary do not agree. However, consider this example:"Avez-vous acheté la voiture?" "Oui, je l'ai achetée hier."You will see that in the question, the past participle does not agree, following the general rule. But in the response, the past participle does agree. This is because the direct object pronoun "l'" (referring to the car as 'it') precedes the verb. When this happens, the past participle must agree.