O'fielly agrees to deal with Royals