The termite, typically reviled as the wood-eating nemesis of buildings and homes, has ironically inspired a new batch of construction robots. The automated machines, each about the size of a small brick, can work as a team to build any predefined structure given to them — without a leader or step-by-step instructions, as termites are thought to do.

Instead of communicating directly with one another or following a central command, the robots coordinate their actions by assessing what work has already been done and adding to it. So, say the first robot puts down a block. As it leaves the site, another comes along and senses the block’s location. Based on this local information, as well as knowledge about the end product, it decides to put down its own load on top of the first.

Such a process keeps going — ideally with many robots toiling away at once to finish the job faster — until the structure is complete. This decentralized method of construction is very similar to how the tiny termite is thought to create huge, towering nests.

“Around here, you hear about termites destroying buildings,” said Justin Werfel, a Harvard University computer scientist and author of a study in the current issue of the journal Science. “But in Africa and Australia, they are known for building enormous, complicated mounds of soil.”

Those oddly shaped towers can be as tall as 40 feet — about the equivalent of a three-story building. And while they may look like big piles of dirt, their simple exterior hides a complex network of ­ever-evolving tunnels and chambers. Some biologists even believe they provide the colony with air conditioning and atmosphere control.

Termite inspired robots show how requested structures can be collectively built using specialized bricks. (Eliza Grinnell/Harvard School of Engineering and Applied Sciences)

Werfel and his colleagues wanted to use robotics to harness the power of stigmergy — a process in which agents communicate indirectly by sensing and modifying the immediate world around them.

“They’re all independent, with each termite doing what it wants to,” he said. “It’s not like they’re getting assigned instructions by the queen — they are just reacting to what they encounter.”

Each termite is an organism of fairly low complexity, but, using stigmergy, a colony can build a highly complex structure. So the team started with this simple framework: Each robot must have its own basic brain and sensors, and be programmed with certain “traffic rules” it must obey.

The sensors enable them to see bricks and robots next to them, and the traffic rules depend on the final structure. They prevent robots from placing bricks in places where they might easily collapse, or constructing a scenario in which a brick would have to be squished in between two others.

Each robot, about eight inches long, consists of internal metal gears and hardware as well as 3-D printed parts. The bricks themselves are also made in a way that helps the robots climb and align them better.

“In our system, each robot doesn’t know what others are doing or how many others there are — and it doesn’t matter,” Werfel said.

The main difference from the real-life insect is that termites don’t have a desired end product. Rather, there is a random component involved; given the same starting place, a colony will build a slightly different structure every time. But for constructing a house, for instance, the robots would need to follow a specific blueprint. So Werfel created the option for a user to input a picture of a predefined structure, and the robots will go to town on building it.

He envisions potential applications for his easily programmable team of robots to work in places where sending humans would be dangerous and expensive — underwater or on Mars, for instance. Or using robots for tedious tasks, like building levies with sandbags.

Werfel came up with the idea of programming termite-like robots more than 15 years ago and started work on them in 2003. Years later, he met study co-author Kirstin Petersen, a robotics engineer who had independently worked on a collaborative construction project for her master’s thesis in Denmark. The two came together, each using their individual expertise to make the insect-inspired robots a reality.

Then a few years ago, they teamed up with termite expert Scott Turner to try and get a deeper look inside the insect’s head. Turner, a biologist at the State University of New York College of Environmental Science and Forestry, has a lab in Namibia where he hopes to discover the purpose behind the mounds. So far, his investigations have found that they may help gas exchange more than temperature regulation.

“The authors have a proof of concept of a system that exhibits collective behavior, without a leader, using only local information,” roboticist Vijay Kumar of the University of Pennsylvania, who was not involved with the study, said in an e-mail. “This can have far reaching consequences as we try to create swarms of robots for search and rescue, and for first response.”

His lab has developed flying quadrotor robots capable of tightly controlled acrobatics, and he has also experimented with automated construction.

Kim is a freelance science journalist based in Philadelphia.