State agrees in plea deal