Right-hander Ross Stripling and the Giants have agreed to a two-year, $25 million deal that includes an opt-out after the first season.