The Pittsburgh Pirates were seeking to add another power bat to their lineup, preferably one who could fill a corner infield or outfield spot or serve as a designated hitter.

They got all three in Ryan O’Hearn.

Sources confirmed to TribLive that the Pirates agreed to a two-year, $29 million contract Tuesday with O’Hearn, a 2025 All-Star who can play first base, right field and DH. The deal is pending the passing of a physical exam. The Pirates expect to use O’Hearn at all three spots.

It marks the first multi-year free agent deal for the Pirates since December 2016, when they signed reliever Daniel Hudson to a two-year, $11 million deal and starter Ivan Nova to a three-year, $26 million deal three days later.

The 32-year-old O’Hearn, a left-handed hitter, batted .281/.366/.437 with 21 doubles, 17 home runs and 63 RBIs last season split between the Baltimore Orioles and San Diego Padres, who acquired O’Hearn and Ramon Laureano at the trade deadline for six minor leaguers on July 31.

In eight major league seasons, O’Hearn has a .252/.321/.421 slash line and 84 career homers. Always a hitter able to drive in runs — he had 38 homers and 131 RBIs in 342 games over five seaons with Kansas City — O’Hearn revived his career in Baltimore after being acquired for cash considerations in January 2023,. He went from a negative WAR player (minus-2.6 with the Royals) to a 5.2 WAR in three seasons with the Orioles by improving his pitch selection and increased his batting average by 58 points, his on-base percentage by 49 and his OPS by 113.

The Pirates signing O’Hearn continues an eventful offseason that involves some dealing and spending. They added outfielder Jhostynxon Garcia, a top-100 prospect, in a trade that sent starting pitcher Johan Oviedo to the Boston Red Sox. They signed left-handed high-leverage reliever Gregory Soto to a one-year, $7.75 million contract. They acquired two-time All-Star second baseman Brandon Lowe, who will make $11.5 million, outfielder Jake Mangum and lefty reliever Mason Montgomery from the Tampa Bay Rays in a three-team deal that sent starting pitcher Mike Burrows to the Houston Astros.

O’Hearn and Lowe will provide some much-needed pop from the left side to pair with a lineup that features switch-hitting right fielder Bryan Reynolds, who led the team in RBIs, and lefty center fielder Oneil Cruz, who led the Pirates in homers.