Take a honeybee worker from almost anywhere on Earth, look inside its guts, and you’ll most likely find just nine types of bacteria.

The remarkable consistency of this microbial package across the planet—similar across species, including social bumblebees—is a sign that the bacteria play some fundamental part in the survival of honeybees. Research published earlier this week in the journal Nature Ecology and Evolution may partly explain why: Bees with healthy microbial partners grow up to have more complex social relationships and even different brain chemistry from bees with sterile guts.

The gut biome—the community of bacteria, fungi, and other microbes that live inside us—plays a potentially enormous, but mysterious, role in many animals. It might even shape human cognition. “The gut-brain axis is highly interesting from an evolutionary perspective, because gut symbionts were likely there when the first neural systems evolved,” says Joanito Liberti, the paper’s lead author, and an evolutionary biologist at the University of Lausanne in Switzerland. There are some signs that the microbes might affect our behavior—but unlike honeybees, we have hundreds of organisms inside us, making it hard to match cause to effect.

And in this study, the role of gut bacteria was stark. “This [finding] really shows that the gut microbiome may be vital to the functioning of the hive,” Liberti says. The essential role of those gut bacteria may also help explain bees’ vulnerability to human threats—particularly agricultural chemicals.

Honeybees are particularly well-suited to microbial experiments because they’re born sterile, unlike human babies. Bees only pick up their microbial package as they hit adulthood and begin interacting with other members of the hive. By plucking days-old grubs from the hive and incubating them in sterile conditions, the researchers can grow blank-slate bees without a drop of antibiotics. In half, the team reintroduced bacteria from the lab’s microbial bank. The rest grew up sterile.

[Related: 5 ways to keep bees buzzing that don’t require a hive]

Those sterile bees didn’t show obvious signs of distress, like flying badly or keeling over dead, at least not during the 10-day study period. They just didn’t socialize like their microbially-complete siblings. They were much less likely to brush heads with other bees—which, in bee terms, means exchanging food or information. “They also interacted more randomly, more equally, with the rest of the group,” Liberti says. “It seems like the gut microbiome made these bees make ‘friendships.’”

It might sound like a good thing to have egalitarian bees, but Liberti says that a colony with lots of specialized relationships is actually better at navigating the complexities of the world. “Not everybody is doing everything at the same time,” he says. “If you are doing brood care, you don’t care whether foragers found a food patch—you want information about the brood.”

When the team looked inside the bees, they found differences down to the function of their DNA. Of 60 different chemicals they measured in bee brains, a third were less abundant in the sterile population. Four specific amino acids that were much more common in bacterial-bees were specifically involved in the neurotransmission or brain fuel supplies. In brain tissue itself, genes involved in memory, vision, smell, and taste were all affected—essentially, the microbiome fiddled with the copying machinery that translated those genes into chemicals.

“Maybe the microbiome doesn’t have a direct effect on the survival of bees,” Liberti says. “But if they’re not working very well in their brain, then of course they will be less efficient at storing the food they collect, producing the honey they need, and that will eventually have effects on the survival of the entire hive.”

[Related: Do we still need to save the bees?]

That could help explain why wild and domestic bee populations are under such stress. Over the past decade, research has shown that high doses of a common herbicide disrupt honeybee microbiomes. The weedkiller may affect learning and sensory skills without killing the bees outright.

While some agricultural exposures may be altering the insects indirectly through the microbiome, they can also have direct effects depending on the dose, Liberti says. Research he co-authored earlier this year found that chronic, low-level exposure to pesticides and herbicides—which might be closer to real-world doses—messed up honeybee metabolisms without changing their microbiomes. Scientists have already shown that many common pesticides, herbicides, fungicides, and even antibiotics can directly poison honeybees. 

It may be that the microbiome is another essential feature of honeybee biology that we’ve been unknowingly disrupting.