A seismic shift is happening in rural America. The opioid epidemic is disabling a segment of the workforce, retail jobs are giving way to ecommerce platforms, and college graduates are moving to cities in search of higher pay.

But arguably the biggest change is workforce automation, and rural communities simply don’t have the tools they need to adapt to rapidly changing economies and new modes of work.

Industries historically concentrated in rural areas are already being touched by automation. The first driverless tractors were introduced 15 years ago. On many dairy farms, milking is done entirely by robots; humans don’t get involved unless a cow’s smart collar (think Fitbit for cows) determines the animal is sick. Mining and forestry are performed by stunningly efficient machines. And that’s not to mention the manufacturing sector, where a re-programmable robotic arm able to sense and avoid nearby human movement now costs around $20,000.

The disruption is only just beginning. Many traditionally middle class jobs in rural America involve a CDL license, but autonomous trucks will soon be the norm on open highways. Drone delivery will be used first for package drop-offs that are farther apart, where human delivery would be more expensive. Buildings will be 3D-printed first in rural America, where building codes and zoning regulations are often less strict.

Productivity gains boost our GDP, and no farmer would tell you they wanted to return to the days of waking up at 3:30 a.m. to milk the herd. But predictions of labor force disruption due to automation in the coming decades range from 9 percent to 47 percent, and a recent Ball State University and Rural Policy Research Institute study found that the jobs most easily displaced are concentrated in rural areas.

Rural America will need to adapt fast in coming years — but, distressingly, indicators of the region’s resilience are faltering. Rural entrepreneurship rates are declining, even in proportion to population. The majority of rural counties saw more businesses close than open during the economic recovery period from 2010 to 2014. A critical segment of the economy — today’s startups and tomorrow’s employers — is missing in our small towns.

How do we empower rural Americans to be adaptable, inventive, and self-reliant in the face of changing economies? As this isn’t the first time our country has undergone a significant workforce disruption, history can be our guide.

When farming equipment became more efficient and the number of Americans working in agriculture dropped steadily through the 1900s, two practices made the loss of farm jobs less painful. First, high school education became widespread and mandated. Second, the Rural Electrification Administration brought electricity to small towns by giving 35-year, low-interest loans to municipal electric cooperatives. High schools prepared a generation of rural Americans to meet the emerging demands of manufacturing and machine operations, and electricity allowed people to experiment with the latest technology — not to mention read and study — in their homes, day or night.

Today’s corollaries to high school and electricity? Digital skills and broadband internet.

Computer science education gives students a path to some of the highest-paying, most in-demand jobs of today, but — equally as important — it introduces students to the tools used to create and innovate in the information age. Broadband opens up remote work opportunities, videoconferencing, and other business tools, along with access to customers around the world, so small town businesses can better export value and import cash.

Finding or training qualified computer science teachers is harder for rural schools with fewer students and tighter budgets, but some are rightly making it a priority. AdvanceKentucky and Code.org are working to train 50 computer science teachers a year for three years in Kentucky. Last month, Wyoming set one year of computer science coursework as a graduation requirement for high school students. This is not California or Massachusetts, but Wyoming — known for beef farming and mining and for being one of the most rural states in the nation.

Broadband deployment faces some the same barriers that electricity deployment faced in the early 1900s, like smaller customer bases, higher costs per house served, and smaller profit margins. As of 2016, 39 percent of rural areas still lacked access to broadband internet. However, many of the same municipal and cooperative electric companies that first brought power to rural areas in the 1900s are building out the fastest internet in the country in places like Muscatine, Iowa; Red Wing, Minnesota; and Wilson, North Carolina.

As in the beginning of the 20th century, the United States today is grappling with serious economic challenges in our small communities. We need to pursue investments and policies that spur economic adaptation and innovation — especially in rural areas, where the 2008 recession isn’t over. The recent $600 million allocation to support rural broadband expansion in the omnibus spending bill is further progress, but updating pole attachment laws to allow faster, cheaper deployment of fiber along existing telephone lines would be better.

And whether through full-time computer science faculty or a combination of in-person and online classes, we need to make sure our children gain experience with the digital building blocks of our society before they graduate high school. Hopefully, states across the nation — including California and Massachusetts — will follow Wyoming and Kentucky’s lead.

The old saying that necessity is the mother of invention has always been true for rural America, but the other prerequisites are access to the right tools and the know-how to make use of them. With a New Deal for our century, providing the levers for aggressive broadband expansion and computer science training for high school students everywhere, we could address the opportunity gap between rural and urban areas and build the foundation for a resilient economy that will last the next hundred years.

Matt Dunne is the founder and executive director for the Center on Rural Innovation.