The Phillies knew they could not win the National League East with a rotation like this.

So on Tuesday, they agreed to a trade.

Multiple sources told MLB.com that the Phillies agreed to acquire left-hander Tyler Anderson from the Pirates for mid-level prospects Cristian Hernandez and Abrahan Gutierrez. The Phillies, who have not confirmed the deal, remain in the hunt for more upgrades before Friday’s 4 p.m. Trade Deadline. But sources indicate they are unlikely to land some of the game’s biggest prizes, including Cubs closer Craig Kimbrel and infielder/outfielder Kris Bryant.

The Phillies entered Tuesday night’s game against the Nationals with a 50-49 record, 3 1/2 games behind the Mets in the NL East. They have a legitimate chance to make the postseason for the first time since 2011, but they are probably too flawed to go all-in on a run.

Anderson, 31, is 5-8 with a 4.35 ERA in 18 starts this season. He has pitched five or more innings in each one.

He is not a top-of-the-rotation starter, but he is an upgrade, similar to Jamie Moyer in 2006, Kyle Lohse in '07 and Joe Blanton in '08. Each of those three provided depth and stability to a shaky rotation. Anderson slots behind Zack Wheeler, Aaron Nola and Zach Eflin, who is on the 10-day injured list with tendinitis in his right knee. The Phillies hoped Eflin could rejoin the rotation as early as Friday, but that will not happen.

There is no timetable for Eflin’s return, which made Anderson’s expected acquisition more critical.