Agave fruit is obtained by harvesting sufficiently grown wild agave plants, which can be found in dry biomes (i.e. Arid Shrubland & Desert, but not Extreme Desert). Agave fruit can also be found in cargo pods in the same quantities that rice and corn can be found in.
Agave fruit gives a negative moodlet when consumed in its raw form; therefore it should ideally be cooked before consumption, or at least made into nutrient paste. It also has the same market value as corn, so it's better to sell than rice.