Knowing when to head out looking for food and when to stop and eat instead is an important judgment call for any species that wants to survive for an extended period of time – and the switch in the brain managing these behaviors has just been identified.

While the discovery was made in the relatively simple brain of the Caenorhabditis elegans worm, researchers are confident that understanding these complicated brain wirings can provide us with insight into how these processes might work in other animals too, including humans.

It all ties in to something scientists don't understand much about right now: how brains can learn persistent, long-term behavioral habits while also staying flexible enough to change those habits if the current situation warrants it.

"For a foraging worm, the decision to roam or to dwell is one that will strongly impact its survival," says neuroscientist Steven Flavell from the Massachusetts Institute of Technology (MIT).

"We thought that studying how the brain controls this crucial decision-making process could uncover fundamental circuit elements that may be deployed in many animals' brains."

There are only 302 neurons in the C. elegans brain, but tracking down this feast vs forage switch was still a considerable challenge: the team went as far as developing a whole new type of microscope that enabled them to track neuron activity through calcium traces that triggered flashes of light, while the animals moved freely.

Software algorithms were then used to map this activity to the behaviors of the worm and find the links between the two. After the software was trained, it could predict with 95 percent accuracy what a worm would do based on how its neurons were firing.

The process was able to identify four neurons in particular associated with the act of roaming around hunting for food. Dwelling in places instead, meanwhile, coincided with the firing of a single neuron called NSM – a neuron previously linked to telling the brain whether food has been ingested.

Neurons under the microscope. (MIT)

Digging deeper into the neuron activity, the team worked out both these processes inhibited each other. The four foraging cells produced a chemical called PDF to suppress NSM, and NSM produced serotonin to suppress the roaming cells. But what controlled which circuit was in charge?

Further analysis revealed that a neuron known as AIA was responsible for flipping the switch between the four neurons (for foraging) and NSM (for feasting). Past studies have linked AIA with the smelling of food, which seems to be an important trigger.

"To a foraging worm, food odors are an important, but ambiguous, sensory cue," says Flavell.

"AIA's ability to detect food odors and to transmit that information to these different downstream circuits, dependent on other incoming cues, allows animals to contextualize the smell and make adaptive foraging decisions."

When triggered by food smells, AIA will work with either the roaming or feeding brain circuits, depending on other feedback. The researchers suspect if the worm can smell food but also knows it's eating (via feedback from NSM), AIA will continue working with NSM to keep feeding.

But if the worm can smell food and isn't eating, AIA will switch to the roaming circuit so the worm can find out where the food is.

And the more we know about the brain – in worms and in other animals – the better we can understand how behaviors are controlled. Discoveries like this can help with everything from exploring evolutionary history to treating brain disorders.

"If you are looking for circuit elements that could also be operating in bigger brains, [AIA] stands out as a basic motif that might allow for context-dependent behaviors," says Flavell.

The research has been published in eLife.