Here is some basic information from the Missouri Bar regarding plea agreements:
What is a Plea Agreement? Sometimes the prosecutor and your lawyer negotiate an agreement to settle your case without a trial. If you agree to plead guilty to a certain charge, then in return the prosecutor agrees to recommend a specified punishment to the judge, which can either be a specific sentence or a recommendation for probation. Your lawyer will advise you whether it is a good idea to agree to the terms of the plea agreement and plead guilty, or whether you should refuse and go ahead with the trial.
Does the Judge Have To Accept The Plea Agreement? NO! The final decision on punishment is up to the judge. However, if the judge refuses to accept the plea agreement, the judge must allow you to withdraw your plea of guilty, and you still have the right to a trial.
Can You Answer “Not Guilty” Even If You Are Guilty? Yes. You are entering a plea, not giving testimony. Under the law, you are presumed to be innocent until you are proven guilty. Furthermore, you have the right to have your case decided by a trial. You may have a trial only if you plead “not guilty.” Your lawyer will advise you about whether you should plead “guilty” or “not guilty,” but the final decision is up to you.