When an invading insect threatens an ant colony' s territory or food sources, the ants will vigorously swarm over the invader, biting or stinging it  This defensive tactic can effectively deter even aggressive flying insects, such as wasps  Ants do not attack all insects within their territory, however  For example, riodinid caterpillars commonly live harmoniously among South American ants
These caterpillars, which are a favorite prey of wasps, produce secretions the ants consume as food
With the sole exception of riodinid caterpillars, South American ants will vigorously attack any organism other than ants that use riodinids as a source of food.