An agreement has been reached!

Brad Pitt and Angelina Jolie have officially reached a temporary custody agreement in regards to their six kids, Us Weekly confirms.

The deal was suggested by L.A. County Department of Children and Family Services and recommended that the stars accept it to avoid a long court battle. The temporary agreement will last for three weeks, and then DCFS will create another arrangement or turn the jurisdiction over to the court.

In the temporary agreement, Jolie gets full physical custody of Maddox, 15, Pax, 12, Zahara, 11, Shiloh, 10, and twins Knox and Vivienne, 8. Pitt gets visitation rights, but the initial visit will be monitored by a therapist, who will then decide to allow or deny the A-list actor unmonitored visits. Both Jolie and Pitt will also go to individual counseling and family therapy with their kids.

Another part of the agreement is that Allied actor will have to go through random drugs and alcohol testing -- his first drug test showed he was negative for any drugs or alcohol.

A source said Jolie is pleased with the agreement, explaining, “She did get what she wanted out of this." The source added, “Now she wants to do what’s best for the kids. Yes, she is still upset but focused on family right now and got most of what she asked for.”

Jolie shocked the world when she filed for divorce on Monday, September 19, citing irreconcilable differences. The Salt star requested sole physical custody of her children.