One of the last industries where blue-collar labourers can earn high salaries is being transformed as artificial intelligence and automation replace workers.

For decades, high school graduates could jump into a job on a drilling rig with few technical skills and expect a well-paid career. The allure of the often dangerous life of a roughneck attracted generations of workers from Oklahoma to Wyoming. A few highly active pockets with labour shortages, such as the Permian Basin in West Texas and New Mexico, retain this boom feel. Truckers, for example, are so in-demand there they can command bidding wars.

But the march of new technology that has already transformed labour needs in most of the world’s manufacturing is now upending the energy business, foretelling the end for one of the last sectors in America where blue-collar workers could depend on jobs paying six-figure salaries.

The changes could reduce the number of jobs by more than 25 percent, analysts said. Automated control systems and smaller teams of technical specialists located in remote operations centers are replacing laborers on the ground, who in the past made adjustments manually.

The energy sector had been shielded from pressure to innovate by high oil prices. When prices fell 75 percent beginning in 2014, oil and gas companies were finally forced to modernize to squeeze out profits. Many found they could use new technologies to do the work better and cheaper, with fewer people. They have since invested billions of dollars on what the industry dubs “digital oil fields,” embracing artificial intelligence, automation and other technologies.

Oil prices are back up to their highest levels in more than three years. But as of May, nationwide oil and gas employment is down 21 percent since 2014, according to state and federal data.

For example, Baker Hughes, a GE company that is the successor to GE Oil & Gas, is focusing on recruiting high-tech workers, increasingly from Silicon Valley. “You need to combine talent from the tech industry with oil and gas expertise,” said Binu Mathew, who was hired from Oracle in 2013 and heads the company’s newly created digital products division. “[Everyone] understands this is going to change the industry,” he told the Wall Street Journal in an interview.

At Devon Energy’s WellCon centre (short for well construction)  in Oklahoma City, a small team of engineers and scientists monitor every well the company is drilling and fracking across the US.

The centre was manned by about 80 people monitoring 40 rigs before the 2014 oil bust. Today, roughly a dozen people monitor the company’s 21 active rigs. Tony Vaughn, Devon’s chief operating officer, said the transition was difficult but has improved the company’s operational efficiency. “It required a lot of people with an old-school mind-set to leave the company, frankly,” he told the WSJ.

Devon has around 3,100 employees, down from 5,500 in December 2014. The company laid off 300 workers in April, its drilling and construction costs per well are down 40 percent since 2014, and it has improved its initial production rates by 450 percent since 2012.

About 80 miles south, in Duncan, Oklahoma, Halliburton had 3,000 workers at the end of 2014 but laid off around 2,000 when oil prices dropped. The company’s biggest business in Duncan — manufacturing and repairing fracking equipment — has come back, but employment has crept up to only 1,300. Instead, Halliburton is using new automation and artificial intelligence tools to design and build. In Duncan, about 1,500 laid-off workers left town permanently.

In Wamsutter, Wyo., BP has about 2,000 wells. Site manager Henry Hopkins used to drive to a group of wells every morning, prioritized by instinct, and check if pump jacks and other equipment were working. These days, Mr. Hopkins gets his marching orders from a computer algorithm that maps his route every morning, telling him which wells need maintenance or repairs based on sensors installed in the wells. The more virtual way of working has allowed BP to reduce its head count in the Wyoming field to around 100.

The company’s production unit for the contiguous US has reduced its noncontractor workforce by 40 percent, largely through technology updates, and has cut lease operating expenses 48 percent since 2014, the company estimates. Few BP workers live in Wamsutter anymore, instead commuting from larger towns nearby, residents said.