Go crazy, Bay Area: BART trains will start rolling again — this time for good.

After more than six months of talks, two crippling rail shutdowns and a half-dozen more threatened strikes, management and union negotiators finally reached a deal Monday night.

BART said it would be able to restart limited train service Tuesday morning after 2,300 union workers get back on the job, fire up dormant systems and run test trains to ensure they are safe. Reduced service on each line was expected to start at 4 a.m., when trains usually begin operating, with BART hoping its full schedule will be intact by the afternoon commute.

The announcement just after 10 p.m. ended the strike after 3 days and 22 hours — the exact same length as the first strike in July.

Details of the settlement were not immediately released. The BART Board of Directors and the members of the agency’s two large unions still need to approve the tentative contract agreement.

“This offer is more than we wanted to pay,” BART General Manager Grace Crunican said. “We compromised to get to this place, as did our union members.”

In a joint press conference with unions, management and local politicians, workers apologized for the strike but said the deal would keep important work rules intact for employees.

“We will go back to work and continue our efforts to keep the Bay Area moving,” said Antonette Bryant, president of the local Amalgamated Transit Union.

Appropriately, before the deal was announced, commuters had to sweat out one last late-night showdown.

Monday marked the 10th strike showdown since late June that came down to the last minute, and the seventh since the 60-day cooling-off period ordered by Gov. Jerry Brown ended on Oct. 10. In the last two weeks, the announcements on whether a strike will take place the following morning came after 10 p.m. each night. That infuriated commuters who grew just as angry over losing sleep keeping up with the drama as they did with the stalled trains and heavy traffic.

The labor dispute also struck a chord with many in the Bay Area who quickly took sides.

In one camp were many who thought the workers were overpaid and should just be happy for what they have. BART union workers already make an average gross pay of $76,500 — the best among California transit agencies — do not contribute toward their pensions and pay $92 monthly for health care. The new contract is expected to give workers at least a 12 percent total raise, start a 4 percent pension contribution and increase the medical premiums by about $50 a month.

On the other side were Bay Area residents who sympathized with workers who had not received a meaningful raise in four years. BART employees were adamant that they were fighting not just for themselves but for all blue-collar union workers who risked seeing their jobs weakened or lost altogether to new technologies.

“Let’s not see this happen again,” said Lt. Gov. Gavin Newsom.

Monday night’s development brought an uplifting end to an evening that started with a sobering revelation: officials investigating Saturday’s deadly accident announced the train that struck and killed two workers during a maintenance run was being driven by an inexperienced employee learning how to operate a train.

On Monday, the workers who were killed were identified as 58-year-old Christopher Sheppard, a BART employee in a management union that asked workers to honor the picket lines, and Laurence Daniels, a 66-year-old rail contractor.

Most of the questions about what happened remain unanswered. But the circumstances leading up to the accident are becoming clearer after a Monday afternoon briefing from the National Transportation Safety Board.

While BART initially said the train was running under computer control with an “experienced” operator in the driver’s seat, the NTSB said Monday that a “trainee” who works at BART was operating the train on autopilot. A trainer was also on board, but officials would not say whether the operator was being trained to help run service during a strike.

Investigator-in-charge Jim Southworth said when it became clear two people were on the tracks, someone inside the train cab sounded the horn and hit the emergency brake. But the train was going 60 to 70 mph and could not stop in time.

Unions had warned that it would be unsafe for nonexperienced train operators to take control of trains so BART could shuttle riders between the Transbay Tube during rush hour, as management has hinted it might do during a prolonged strike. But management on Friday vehemently denied it was training operators on the tracks, saying only experienced ex-operators were running trains and only for maintenance purposes.

The four-car train, which also was carrying one additional trainee and two or three maintenance workers, was on its way back from dropping off cars that had been defaced with graffiti. Sheppard and Daniels were responding to a report of a “dip” in tracks, which run at-grade north of the Walnut Creek station.

Sheppard joined BART two years ago but had started with Amtrak in 1977.

Daniels, a longtime Fair Oaks residents who recently moved to Oakland, was a BART contractor who started his own firm in 1994, according to friends and his online biography. His work as a track designer took him from Portland, Ore., to Baltimore to Singapore and neighbor Irma Valencia said he “worked into the wee hours to help maintain the tracks” during the July BART strike.

“The absolute engineer,” said George Calderon, another neighbor. “It would definitely show in his face. You could tell he was very devoted to his job. The rail system was in his blood.”

BART workers are supposed to complete extensive safety training for working along the tracks, according to the last California Public Utilities Commission report on the rail agency’s safety programs, published three years ago. It also requires workers assigned to track repairs and access alongside tracks to pass a safety test that includes hand signals meant to communicate with train operators.

Federal Railroad Administration data shows at least 273 railroad workers around the country died on the job since 2000. Most involved freight train accidents, including 15 fatalities in California, the second highest total of any state. BART has now had eight deaths on the job in 41 years of service.

Southworth said the NTSB spent Monday interviewing dispatchers, the trainee driver and other workers. Investigators will also review videos and examine signal systems during their 10-day investigation.

Staff writers Natalie Neysa Alund, Matt Artz, David DeBolt, Jennifer Modenessi, Doug Oakley and Thomas Peele contributed to this report. Contact Mike Rosenberg at 408-920-5705. Follow him at twitter.com/RosenbergMerc.