Liverpool agree Bayern deal for Thiago