The first thing Jose Halloy wants you to know is that he will not help you get rid of the cockroaches in your apartment. It's true that he and his colleagues at the Free University of Brussels and several other European institutions have created a set of tiny robotic Pied Pipers that can trick roaches into following them  even to places where a sensible roach would never venture. But the research they've just described in Science has to do not with extermination strategy but with understanding how roaches make decisions. "When you observe cockroaches," says Halloy, "you see that they act as a group; they tend to stay together. So how do they do that? Is there a leader? What kind of information do they use? How do they share it?"

To observe ordinary roach behavior, Halloy and his colleagues created an enclosure with two "shelters" inside  red-tinted plastic disks mounted so that roaches could scurry underneath to avoid bright light, which they do instinctively. When the insects were dumped into the enclosure, they scrambled around randomly for a while, but eventually all huddled under the same shelter. That they huddled is no surprise, since roaches like to gather in crowds. But since cockroaches don't have enough intelligence to allow for leadership skills or even communication, the fact that they collectively decide on one shelter looks, says Halloy, "like a kind of magic trick."

Veteran roach-watchers have a more mundane explanation. Cockroaches, they hypothesize, use just two pieces of information to decide where to go: how dark it is and how many of their friends are there. At first, the roaches will wander arbitrarily into one shelter or the other  but at some point, enough of them will end up under one shelter to reach a critical mass, which then becomes more attractive to the others.

If it the critical-mass hypothesis has merit, Halloy and his co-workers figured they should be able to trick the roaches into doing something unnatural. To do that, they would need a rogue roach to infiltrate the herd. "One way to get them," Halloy says, "would be to create mutants somehow, with abnormal behavior. But we don't have a genetic institute for cockroaches." Instead, the researchers recruited some engineers to build them roach robots that would slip into the crowd and manipulate it from within. "It turns out," he says, "that roaches aren't very discriminating"  they'll accept anything of roughly the right size and smell. In the end, the engineers came up with little wheeled robots shaped like matchboxes and perfumed with eau de roach. They were programmed to have the same likes and dislikes as roaches  that is, to prefer crowds and darkness.

When introduced to the real roaches, the robots fit right in  the gathering behavior of the horde was pretty much unchanged. Researchers then reprogrammed the robots to prefer a less-dark hiding place  unnatural for a roach. The insects and the infiltrators were put back into the enclosure, except this time one of their hiding places was more lightly tinted than the other: It was brighter inside. Again, all the roaches scurried around randomly for a while, but the robots eventually settled under the lighter, less shadowy disk  and the real cockroaches followed. Which means that the hypothesis  that a group of individual bugs, each with just two cognitive "rules," can make a collective decision about shelter  appears to be correct.

In principle, say the researchers, the idea could be extended to other, more complex group-living animals. Although robots would obviously have to be more sophisticated to penetrate and alter the behavior of a herd of sheep or a flock of geese, for example, it's at least conceivable that this could someday be done. In fact, Halloy and his colleagues are already working on a robot chicken to try and manipulate the behavior of chicks.

No comment from Halloy, though, on whether his robots could trick a million or so roaches into leaving your apartment and infesting the neighbors'.