This morning, I was sitting under the shade of a burdock plant that I've let grow far beyond what a lot of people would tolerate (these start out as small rhubarb-like "weeds" but will grow to human-height very quickly if allowed, and throw out huge umbrella-like leaves that are quite nice to sit under in the absence of other shade. Also, you can eat the roots.
I noticed ants crawling up and down the stem, onto each leaf, and around the perimeter of the top and underside of each leaf, as if they were on a racing circuit. They didn't seem to be eating the leaves at all, more like doing some kind of security surveillance. When I looked a bit further, I noticed a gathering near the top of the plant attacking (eating, presumably) what looked like a group of small black eggs that some other parasite had laid near the top of the plant. They were slowly eliminating this parasite.
In another spot in my garden, ants show up in large quantities. Whenever you walk nearby and just slightly disturb the soil, swams of them are apparent. It's actually quite worrying at first because the sight of so many in one place can be surprising. Since these ants tunnel into the soil and make mounds of decompacted soil that develop over time as the ants come and go from the surface, they had pretty much buried an entire rock border in my garden. Rocks that used to be on top of the soil were now underneath it. When I set about correcting this situation by levering the rocks up to re-seat them, underneath I noticed that the ants were voraciosly devouring what looked like maggot larvae. In the centre of the small garden surrounded by the rocks is an old tree stump on which a whiskey barrel planter sits. My guess is that the maggots are attracted to the decaying wood from the old tree under the soil, and that the ants are attacking the maggots.
I have no idea what type of maggots they are, but I know that some maggots can eat the roots of plants, but ants generally don't. They must have been in "attack" mode when I disturbed them because a bunch of them tried to eat my legs. My legs do look a bit like maggots, colour-wise.
In both cases, the ants are doing a good and positive job. and they are a symptom of a deeper problem and aren't a problem in themselves. When their job is done, they'll move on to something else. True to their reputation as hard and organized workers, it seems like they only really stay around as long as necessary and then move onto something else.