Robots filling orders for Amazon and apps planning business trips hardly spell the end of work but if we are not careful, those could foreshadow Chinese dominance of the global economy.

Alarmists remember elevator operators and bowling alley pin-setters and warn that artificial intelligence is now replacing knowledge workers — for example, insurance adjusters and financial advisers. They fear society will divide between those owning the intellectual property and the indolent masses dependent on government handouts.

More compelling is the example of the farmer.

Since ancient civilizations domesticated grains, humans have planted and harvested. Through the horse harness, plow and steel-edged sickle, then modern tractors, tillers and harvesters, and most recently hybrid and genetically-modified seeds, farmers have become relentlessly more productive.

We still have farmers — just fewer, and who feed more people.

Machines and the knowledge embedded in them really do three things: replace hands and muscle in repetitive and backbreaking tasks; enhance our senses of hearing, sight and feel; and, most recently through computers, process billions of bits of information to identify patterns, compare those to databases and run scenarios — if I do this, what options are eliminated and new ones created — to predict behavior or replicate the work of the human mind.

The latter is artificial intelligence. It permits marketers to build algorithms that quickly place ads for products we find attractive on our computer screens. Aided by cell-phone apps and high-resolution cameras, it permits dermatologists and oncologists to more quickly diagnose skin cancers and, with patients’ medical histories, prescribe the most effective treatments.

Computer programs are only as good as the information and algorithms we put into them. And only as effective as past experiences and case histories can predict future outcomes — ask any economist how risky that is!

People’s preferences change for all kinds of reasons — if Sally marries Sam or has a child, vacation destinations often change. Environments, organisms and diseases constantly evolve.

AI won’t replace doctors, but it will permit them to treat more patients more effectively and at lower costs. And somehow, I don’t think people are quite ready to leave life-and-death decisions to an iPhone app.

Similarly, I hardly believe most folks will be willing to put a six-year-old into a driverless car or school bus on a snowy, dark January morning. More likely, one driver will control several vehicles from a dispatch center and send assistance quickly if a problem emerges.

Historically, as machines and the software embedded in them have made people in specific occupations more productive, economies grow more quickly. People in legacy occupations make more stuff and displaced workers — or their children — move to occupations servicing and designing the new machines and other industries altogether.

The mechanization of agriculture freed workers to move to factories in cities and, in turn, improvements in mass production enabled the growth of the service sector — everything from dry cleaners to movie theaters.

The real problem is that each round of innovation eliminates work in semi-skilled occupations and creates more opportunities for workers with highly complex blue-collar skills — robot maintenance — or the design skills we associate with college degrees in fields like engineering, architecture and medicine.

America's problem is that we are embracing these changes too slowly — witness the declining pace of productivity growth and the shortage of skilled workers to bring manufacturing back to America.

Business taxes and regulations are too burdensome, and as most of our high-tech startups mature, they take production jobs offshore. And we are not effectively educating young people for the next generation of work.

Most high school students are ill-prepared either to enter demanding vocational or apprenticeship programs, or enroll in college curricula for engineering and the like.

The response of technology leaders like Tesla’s Elon Musk is to call for the government regulation of AI — essentially, put a brake on progress — or Facebook’s Mark Zuckerberg’s is to just surrender — forsake the notion of every adult having a job and guarantee every American a government-funded annual income.

We had better be careful.

China’s leadership correctly sees AI as the emerging lynchpin of global wealth. It is investing to dominate the field by 2030 and hardly tells its young people the world owes them a living.