On a windy morning in California’s Salinas Valley, a tractor pulled a wheeled, refrigerator-sized contraption over rows of budding iceberg lettuce plants. Engineers from Silicon Valley tinkered with the software on a laptop to ensure the machine was eliminating the right leafy buds. Hired by a Salinas-based agricultural produce company, the engineers were testing the Lettuce Bot, a machine that can “thin” a field of lettuce in the time it takes about 20 workers to do the job by hand. The thinner is part of a new generation of machines that target the last frontier of agricultural mechanization—fruits and vegetables...