The 31-year-old playmaker appears to be on the verge of a return to Milan after falling out of favour in Madrid.
Kaka left San Siro to head to Spain in 2009, but injury hampered him and he will be hoping the move back to Italy can kickstart his career should the transfer be completed.
Milan manager Allegri said: "(Milan vice-president Adriano) Galliani told me before the game that we have an agreement with Real Madrid and now need to agree personal terms with Kaka.
"There are another 24 hours to the transfer deadline, so we'll see what happens."
Allegri also refused to rule out the possibility of Cagliari defender Davide Astori joining Milan before the transfer window closes on Monday. Astori was benched against Milan on Sunday by Ivo Pulga, leading to speculation that he may be on the move.
Allegri added: "I think Davide is one of the best Italian defenders in circulation.
"We have good defenders anyway and I am happy with what we’ve got. Astori would be useful for many clubs, so we’ll see what happens."
Stephan El Shaarawy was left on the bench against Cagliari by Allegri, who was forced to explain the decision.
"With Kevin-Prince Boateng leaving I lacked a wide attacker, plus my idea was to go back to two strikers because Mario Balotelli needs a partner who runs into space. Riccardo Montolivo did very well as a trequartista," he said.
"We didn't have much time to test out this new system and I think El Shaarawy can learn to be a support striker, but of course it’ll take some more practice.
"There is absolutely no El Shaarawy problem."
Goals from Robinho, Philippe Mexes and Mario Balotelli helped Milan to victory over Cagliari, for whom Marco Sau netted.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.