Asymptotic giant branch (AGB) stars synthetise a variety of elements in their deep hot layers, mix them to the stellar surface, and shed them into their surrounding by stellar winds. Through this series of processes (nucleosynthesis, mixing, and winds) they contribute to the chemical evolution of stellar groups and galaxies. Specifically, they significantly produce a number of light elements (such as C an N), as well as roughly half of the cosmic abundances of the elements from Sr to Bi via slow neutron captures (the s process). This peculiar nucleosynthesis is strictly dependent on the initial stellar mass and the metallicity. In particular, as the stellar mass increases towards the AGB-Supernova transition limit the signature of H burning becomes predominant with respect to that of He burning and neutron captures. We discuss the origin of these differences and their implications on observational constraints from spectroscopic observations of AGB stars and meteoritic stardust.