Pedro Baez, who spent the first seven years of his career with the Dodgers before becoming a free agent, has agreed to a two-year deal with the Houston Astros.