It’s a dirty job, but somebody has to do it.

And when it comes to the expensive, claustrophobic and sometimes dangerous work of inspecting natural gas and oil pipelines, that somebody might be a robot.

“We can make sure that these critical elements of energy infrastructure operate more safely, more reliably, more economically,” said Edward Petit de Mange, managing director at the San Diego hub of Diakont, an international high-tech engineering and manufacturing company with offices in Russia, Italy and North America.

As pipelines age, they pose substantial risks. Since 2010, an average of 200 crude oil spills have been reported each year, according to the Pipeline and Hazardous Materials Safety Administration.

For years, energy companies and utilities inspected their pipelines by using techniques such as sending pressurized water to test a line’s strength or simply digging into the ground and performing spot inspections.

But pipeline owners often did not have a good idea how sturdy a pipeline was or how close it teetered toward failure. From its location in an unassuming office park, Diakont is one of the few companies that use robots to inspect for wear, tear and corrosion.

Called the Remotely Operated Diagnostic Inspection System, or RODIS, the contraption resembles the robot from the movie “WALL-E” and crawls through the pipeline via a horizontal set of traction wheels. A cable connects the robot to an operator, commonly stationed in a truck a safe distance from the pipeline, who monitors the sensor data.

A typical inspection covers about a quarter of a mile in one day — and it’s not cheap. But it’s accurate, Petit de Mange said.

“Pipelines are assets that operators keep in the ground for a long time, and they make money when the product is flowing through them,” Petit de Mange said. “So when you have downtime, or worse yet, a failure of that pipeline … that can be in the tens to hundreds of millions of dollars. So being able to perform inspections and get really valid data to ensure the pipeline is in good condition, that can save utility companies a lot of money.”