Acoustic homing torpedoes.
If we go to historical precedents, probably Russian swarming anti-ship missiles are the cut point. They can discriminate with carrier and it's companions, so the individual missile will make "I will not kill that" decision about individual ship. https://en.wikipedia.org/wiki/P-500_Bazalt