We all know that when bees swarm they are in defensive mode. However, not all species of bees have stinging in mind when they swarm.
We did a program about an Asian honeybee species that engulfs an invading wasp and cooks it to death. That's what scientists thought Cyprian honeybees were doing when they engulf an invading hornet. However, further study showed that the bees could not kill the attacking hornet with heat. They simply didn't generate enough heat to kill it in the hour they were observed killing a hornet.
Further observation showed that the bees favored encasing the hornet's abdomen. It appeared that they knew that the hornets have an unusual breathing arrangement for insects. The hornet in question actually breathes through holes in its abdomen by contracting the abdomen. The bees appeared to be suffocating the hornet. So researchers placed tiny plastic blocks under a hornet's abdominal plates. This propped the hornet's breathing pores open when the bees tried to smother it. Sure enough, the next time the bees attacked, the hornet survived twice as long.
In His love for His creation, God knew that when sin entered His creation, His creatures would need to know how to defend themselves. So He gave the Cyprian honeybee the knowledge to protect itself against its worst foe.