Jesse Williams and estranged wife Aryn Drake-Lee have reached an agreement in their divorce ... at least temporarily on the subject of custody of their 2 children ... and there's an indirect connection to Minka Kelly.

The warring couple will share joint legal custody ... which means all decisions made regarding the health, welfare and upbringing will be made between the 2 of them.

The agreement, obtained by TMZ, provides neither parent can make derogatory remarks about the other in front of the children. They also can't use the children as messengers.

And, the agreement provides that neither Jesse nor Aryn "shall introduce a person with whom he or she has a romantic relationship to the children until the relationship has endured at least 6 months."

The agreement does not break down the physical custody arrangement.

TMZ broke the story ... Jesse has been linked to Minka Kelly.