In this thesis I describe the identification of olfactory circuits underlying avoidance of Leptopilina wasps in Drosophila adults and larvae. The larval olfactory sensory neuron (OSN) expresses the olfactory receptor Or49a and is tuned to the waps’ sex pheromone iridomyrmecin exclusively, while the adult OSN expressing both Or49a and Or85f detects in addition to iridomyrmecin, the wasp odors actinidine and nepetalactol. The OSN type expressing Or49a and Or85f is both necessary and sufficient to govern the parasitoid avoidance behavior, and is conserved across several Drosophila species. I also contributed to the demonstration that Drosophila adults prefer Citrus fruits as oviposition substrates. This preference is due to the high content of terpenes in the flavedo. Flies detect these terpenes via only a single class of OSNs, which in this case express the odorant receptor Or19a. This preference has likely been driven by the need to avoid parasitism from endoparasitoid wasps, since the same terpene ligands that mediate fly oviposition are also potent repellents for parasitic wasps that oviposit in fly larvae. Furthermore, this thesis describes that flies are attracted to dietary antioxidants. Adult flies are more attracted towards, feed and lay eggs on yeast-inoculated media containing the common hydroxycinnamic acids (HCAs) p-coumaric acid and ferrulic acid. Fly larvae, too, are attracted to media containing these acids. Flies detect the presence of HCAs via ethylphenols, which are exclusively derived from the yeast metabolism of these acids. Adult flies use a different olfactory receptor (Or71a) that is expressed in OSNs on the maxillary palps than larval flies (Or94b) to detect these compounds. These neurons in both adult and larval flies are necessary and sufficient for the proxy detection of dietary antioxidants. These results provide the first indication that animals are able to use olfactory cues to judge content of dietary antioxidants. Moreover, I contributed to the identification and behavioral characterization of the three novel volatile pheromones methyl laurate, methyl myristate and methyl palmitate. Finally, I contributed to the dissection of the functional significance of the maxillary palp in Drosophila. In conclusion, the findings of this thesis clarify how the antennae and the palps as well as specific olfactory circuit contribute to the decision of a fly, whether or not to feed, oviposit or mate.