The state prosecutor, the victim and Dakota’s previous owner have reached an agreement that aims to keep the public safe and give the 4-year-old female dog another chance at life, Kennebec District Attorney Maeghan Maloney said late Thursday.