The two largest U.S. airlines have found an ally to prevent passengers from getting stranded: Each other.

American Airlines, the biggest U.S. carrier, and the No. 2 airline, Delta, on Wednesday are resuming an agreement that allows the airlines to rebook their passengers on each other's flights during travel disruptions.

The decision comes after costly and highly visible travel chaos in recent years, from computer failures to power outages to bad weather, all made more noticeable to the public through social media.

Delta and American had an agreement until 2015 that allowed them to rebook each other's passengers. Delta said that so-called interline agreement was scrapped after more American passengers were sent to Delta than vice versa.

"At that rate the industry agreement was no longer mutually beneficial," Eric Phillips, Delta's senior vice president of revenue management, said in September 2015, when that agreement was halted.

@AmericanAir (2/3) so basically you've forced my hand and I've had to pay out of pocket to get on a Delta flight (since you won't book the people you've screwed on another airline with availability!) because I need to get to LAX today instead of >24 hrs later

The new agreement stops short of a traditional interline pact because it won't allow travel agencies to book itineraries that include both airlines.

"This is strictly an irregular-operations ticketing and baggage reaccommodation agreement," said Delta spokesman Morgan Durrant. "A true interline means things like fare combinability for travel agency and third-party sales. That's not what this is."

Both Delta and American have similar agreements with other airlines, such as United.

The new agreement is "a tool that will give our employees more options to reaccommodate customers whose flights are canceled during weather and other uncommon scenarios when Delta flights are canceled," Durrant said.

The agreement could end up both saving airlines money and tamping down social-media outcry during travel disruptions, instead of having passengers stranded and possibly due compensation.

While the agreement will allow airlines to ticket passengers on the other's planes, "our priority will be always to keep customers on American or our alliance and joint-business partners," said American spokesman Matt Miller.