(TMZ) -- Carmelo Anthony and La La are hashing out a temporary custody agreement in which she will get primary custody of their son ... TMZ has learned.

Sources close to the former couple tell TMZ 10-year-old Kiyan will live with La La in NYC. He'll spend a couple of days a week with Carmelo.

TMZ was told the two believe they can work out all the details without going to court ... it being done with their lawyers.

Both Carmelo and La La agree it's important they work out a structure for Kiyan so he's not whipsawed from place to place while they end their marriage. TMZ was told La La has issues with Carmelo for sure, but she's adamant he's a great dad and deserves time with his son.

TMZ was told they are absolutely getting divorced, even though legal docs haven't been filed ... yet.