It shall be the duty of the county or district attorney or the county or district attorney's designee to prepare and file the petition alleging a child to be a child in need of care, and to appear at the hearing on the petition and to present evidence as necessary, at all stages of the proceedings, that will aid the court in making appropriate decisions. The county or district attorney or the county or district attorney's designee shall also have the other duties required by this code. Pursuant to a written agreement between the secretary and the county or district attorney, the attorneys for the secretary may perform the duties of the county or district attorney after disposition has been determined by the court.
K.S.A. 38-2214