The workers of the first shift had just finished their morning cigarettes and settled into place when one last car pulled into the factory parking lot. Out came two men, who opened up the trunk, and then out came four cardboard boxes labeled "Fragile."

"We've got the robots," one of the men said.

They watched as a forklift hoisted the boxes and drove into a building where old mechanical presses shook the floor. The forklift carried the boxes past workers wearing steel-toed boots and earplugs, rounded a bend, and arrived at the end of an assembly line.

The line was intended for 12 workers, but two were no-shows. Another had just been jailed for drug possession and violating probation. Three other spots were empty because the company hadn't found anybody to do the work. That left six people on the line jumping from spot to spot, snapping parts into place and building metal containers by hand, too busy to look up.

In factory after American factory, the surrender of the industrial age to the age of automation continues at a record pace. The transformation is decades along, its primary reasons well-established: a search for cost-cutting and efficiency.

But as one factory in Wisconsin is showing, the forces driving automation can evolve — for reasons having to do with the condition of the American workforce. The robots were coming in not to replace humans, but because reliable humans had become so hard to find. It was part of a labor shortage spreading across America, one that economists said is stemming from so many things at once. A low unemployment rate. The retirement of Baby Boomers. A younger generation that doesn't want factory jobs. And, more and more, a workforce in declining health: because of alcohol, because of depression, because of a spike in the use of opioids and other drugs.

In earlier decades, companies would have responded to such a shortage by either giving up on expansion hopes or boosting wages. But now, they had another option. Robots had become more affordable. No longer did machines require six-figure investments; they could be purchased for $30,000, or even leased at an hourly rate. As a result, a new generation of robots was winding up on the floors of small- and medium-size companies. And at Tenere Inc., where 132 jobs were unfilled on the week the robots arrived, the balance was beginning to shift.

"Right here, okay?" the forklift driver yelled over the noise of the factory, placing on the ground the boxes containing the two newest employees at Tenere: Robot 1 and Robot 2.

Tenere Manufactures custom-made metal and plastic parts, mostly for the tech industry. Five years earlier, a private-equity firm acquired the company, expanded to Mexico, and ushered in what the company called "a new era of growth." In Wisconsin, where it has 550 employees, all nonunion, wages started at $10.50 per hour for first shift and $13 per hour for overnight. Counting health insurance and retirement benefits, even the lowest-paid worker was more expensive than the robots, which Tenere was leasing from a Nashville-based startup, Hirebotics, for $15 per hour.

Hirebotics co-founder Matt Bush said that before coming to Tenere he'd been all across America installing robots at factories with similar hiring problems. "Everybody is struggling to find people," he said.

Inside the factory, there have been no major issues with quality control, plant managers say, only with filling its job openings. In the front office, the general manager had nudged up wages for second- and third-shift workers, and was wondering if he'd have to do it again in the next few months. Over in HR, an administrator was saying that finding people was like trying to "climb Everest" — even after the company had loosened policies on hiring people with criminal records. The new hires who were coaxed through the door often didn't last long, with the warning signs beginning when they filed in for orientation in a second-floor office that overlooked the factory floor.

"How's everybody doing?" asked Matt Bader, as four new workers walked in. "All good?"

"Maybe," one person said.

Bader, who worked for a staffing agency, scanned the room. There was somebody in torn jeans. Somebody who drove a school bus and needed summer work only. Somebody without a car.

Bader told them that once they started at Tenere they had to follow a few important rules, including one saying they couldn't drink alcohol or use illegal substances at work. "Apparently, we need to tell people that," Bader said, not mentioning that just a few days before he had driven two employees to a medical center for drug tests after managers suspected they'd shown up high.

A worker yawned. Another asked about getting personal calls during the shift. Another raised his hand. "Yes?" Bader asked.

"Do you have any coffee?" the worker said.

The new robots had been made in Denmark, shipped to North Carolina, sold to engineers in Nashville, and then driven to Wisconsin. The robots had no faces, no bodies; if anything, they looked like human arms. They had been specifically designed to replicate movements with such precision that any deviation was no greater than the thickness of a human hair — a skill particularly helpful for Robot 1, which had been brought in to perform one of the most repetitive jobs in the factory, making a part that Tenere refers to as the claw.

The claw's purpose was to holster a disk drive. Tenere had been making them at two separate mechanical presses, where workers fed 6-by-7-inch pieces of flat aluminum into the machine, pressed two buttons simultaneously, and then extracted the metal — now bent at the edges. Tenere's workers were supposed to do this 1,760 times per shift.

Robot 1, almost programmed, started trying it out. "How fast do you want it?" Hirebotics co-founder Rob Goldiez asked a plant manager.

First the robot was cycling every 20 seconds, and then every 14.9 seconds, and then every 10 seconds. An engineer toggled with the settings, and the speed bumped up again. A claw was being produced every 9.5 seconds. Or 379 every hour; 3,032 every shift.

Some distance away, in front of another mechanical press, was a 51-year-old man named Bobby Campbell, who had the same job as Robot 1. "Beat that robot today," Campbell's supervisor said.

"Hah," Campbell said, turning his back and settling in at his station, where there were 1,760 claws to make and eight hours until he drove home. He set his canvas lunch container on a side table and oiled his mechanical press. He cut open a box of parts and placed the first flat piece of metal under the press. A gauge on the side of the press kept count. Wallop. "1," the counter said, and after Campbell had pressed the button 117 more times, there were seven hours to go.

Unlike the employees on the assembly line, Campbell worked alone. His press was off in a corner. There was no foot traffic, nobody to talk to, nothing to look at. Campbell stopped his work and removed a container of pills. He took a low-dose aspirin for his neck, another pill for high blood pressure. He snacked on some peppers and homemade pickles, fed 393 more parts into the machine, and then it was time for lunch. Four hours to go.

"Monday," he said with a little shrug. "I'll pick it up after I get some fuel."

Campbell had been at Tenere for three years. He earned $13.50 per hour. He had a bad back, a shaved head, a tear duct that perpetually leaked after orbital surgery, and aging biceps that he showed off with sleeveless shirts. He liked working at Tenere, he said. Good people. Good benefits. Some days he hit his targets, other days he didn't, but his supervisors never got on him.

He lived 31 miles and 40 minutes away, provided he didn't stop. The problem was, sometimes he did. Along the drive home there were a dozen gas stations and mini-marts selling beer, and Campbell said he couldn't figure out why some days he would turn in.

He hummed a song. He whistled. He fed 11 pieces of metal to the machine in a minute, and then 13, then nine. His eyes darted from left to right. He nodded his head.

Campbell added a last pump of oil to the machine with 15 minutes to go. Out came a few more parts, and he fed them into the hopper, checked the gauge, and shrugged. "Not so bad," he said. Time to go home. He had punched the buttons 1,376 times, 384 shy of his target, and now he got in the car.

Annie Larson was one of the steadiest parts of an assembly team in which so many other workers lasted weeks or months. Larson's supervisor called her "old school." Others moaned about the job during lunchtime breaks. Larson, wanting no part of that, pulled up a stool to the assembly line every day and ate by herself. "If the job is that bad, go!" she said.

She was 48, and she had no plans to leave. Rural Wisconsin was tough, but so what; she couldn't start over. Her roots were here. Her mother lived four blocks away; her father six. Her son, daughter, and grandchild were all within 15 miles.

But numbers at work had been leaving her feeling more drained than usual. The team felt as if it was forever in catch-up mode. She and her co-workers were supposed to snap and rivet metal pieces, building 2,250 silver, rectangular containers per week. But with so many jobs unfilled, they missed the mark by 170 the week before the robots arrived. They were off 130 the week prior.

Her co-workers were always changing. Larson told them sometimes how they could be more efficient. How they could line up rivets in parallel rows, for instance. But who was paying attention? "There's no caring," Larson said. "No pride."

Friday now, and Larson was tired. Midshift, she noticed an employee who'd missed the last few weeks with knee surgery wander over, stopping at Robot 2.

"Ohh," the employee said, "they're taking somebody's job."

"No, they're not," Larson said.

Larson was surprised that she had come to the robot's defense. But then she looked at what the robot was going to do: Put a claw in the slot. Put another claw in the slot. "It's not a good job for a person to have anyway," she said.

The end-of-the-shift buzzer sounded, and Larson got into her car. Then into her recliner at home, where she poured herself a drink and tried to think about how the assembly line was going to change. Maybe the robots would actually help. Maybe the numbers would get better. Maybe her next problem would be too many humans and not enough robots. "Me and Val and 12 robots," Larson said. "I would be happy with that."

Eight days later, the robots' first official day of work arrived. In came the workers, some of whom took a moment to stand nearby and watch. "It's pretty amazing," one said. "Gosh, it doesn't take breaks," said another.

In one corner, Robot 1 was pounding out claws, laying them on a conveyor belt. Along a half-empty row of workstations, six people were constructing containers. At the end of that row, Robot 2 was filling those containers with claws.

Within an hour, the workers had filled a box with finished containers — the first batch made by both humans and robots. A manager, Ed Moryn, grabbed the Hirebotics engineers and asked them to follow.

He took them into another building, stopping at two workstations. A press brake job. An assembly job. "Can we do these?" Moryn asked.

The engineers studied the work areas, took some measurements, and two days later offered Tenere one version of a solution for a company trying to fill 132 openings. In September, the engineers would be coming back, arriving this time with Robot 3 and Robot 4.

Excerpted from an article that originally appeared in The Washington Post. Reprinted with permission.