A petition must be filed requesting custody. If parents agree, they may sign an agreement (stipulation and consent agreement), and obtain the judge’s approval. That agreement can then be entered as a custody order.