In order to get a divorce, you need to involve the courts. Filing with the court begins their process.
I suggest that you file with the court after you have a signed written agreement detailing all of your decisions about what the court requires and any other issues you feel are important. I suggest this for the following reasons.
First, the court assumes that you need them. To be helpful, they may send you to their evaluators or referees. In order to track your progress and offer assistance they schedule hearings. There goal is for you to reach agreement without the need for a trial. They schedule hearings to see how you are doing. If you can show them a signed agreement at the first opportunity, they will know that your issues are resolved and they will leave you alone. In this way you can keep your involvement with the court system to a minimum.
Secondly, the court has a timetable for moving your case through their system. In the State of Michigan, as an example, the State Court Administration evaluates the courts by how quickly cases progress, sets timelines for various requirements to occur and when cases should be resolved. By filing after you have an agreement, you can make decisions at your own pace rather than to meet the courts deadlines.
Lastly, often spouses file without talking about it first, which often contributes to conflict. I encourage you to plan who will file and when it will occur together. Divorce is a scary experience and planning the process together will reduce your fear and anxiety.