During photosynthesis, the light-dependent reactions in the chloroplast produce ATP, NADPH, and O$_2$. Of these, oxygen (O$_2$) diffuses out of the chloroplast as a byproduct. ATP and NADPH are used within the chloroplast to drive the light-independent reactions (Calvin cycle), which produce sugars.