The deal is pending a physical, the source said. The Athletic was the first to report the agreement.
Castro had a .270 batting average with 22 home runs and 86 RBIs last season for the Miami Marlins, who declined his $16 million option and instead paid a $1 million buyout on Nov. 1.
The 10-year veteran spent the first six seasons of his career with the Chicago Cubs before playing two seasons each with the New York Yankees and the Marlins. Castro has a .280 career average with 133 home runs and 636 RBIs.