Packing online orders into boxes for shipping—so-called picking—has been a major area of job growth in recent years. Warehouse fulfillment now employs nearly a million Americans, helping offset massive job losses in brick-and-mortar retail.

But those warehouse workers may soon be under threat themselves, as engineers get closer to developing robots that can do the job more cheaply and reliably.

The complexity of sorting through hundreds of thousands of different products has made automation impractical so far. But according to a new report in the Wall Street Journal, machine learning is now making the robots more flexible and effective.

Some of them are already inching into service. A subsidiary of robotics company Kuka sold its first picking…