Additionally workers or caravan are a real burden when at peace.
I had a game where alliance became peace (due to diplomacy changes). My country was flooded with caravans and i could no more move my units, i could not kill them or capture them or bribe them ! I needed to declare war several turn later to get rid of this !
The AI does not seem to withdraw its troops before the start of a peace treaty, so all its troops in your territory are lost.