You are pretty close, actually, the caterpillars have a honey gland, an organ that secretes an amino acid and carbohydrate liquid. The caterpillars secretes the liquid from the honey gland, rather large quantities, enough to feed several ants. But what makes this relationship obligatory for the caterpillar? And the ants do this because they get an easy meal out of it, right?