AI have a randon war declaration variable that has a prob of being activated modulated by a lot of factors ( especially the power rating and the status of the relationships... all of that is defined in the XML and there are intel sheets on that in the forums, by ori and dj_anion ). After the war decision is made ( that you can check easily.... if the AI is planning a war it will awser "We are with our hands full" if you ask them to war someone else ) the AI will normally take a while making a military buildup until it thinks it is ready for the war ( again , there are diferences between the AI. Sitting Bull, for a example, will war someone with 130% of its power ... most of the others are more wise )...it is very rare that a AI will make a cold start ( I only saw it once: Sal demanded Natio from me, I refused and he DoweD me in the moment ) and sometimes it may take centuries until the AI feels ready ( I had another game where hammurabi was preparing a war vs me for more than 300 turns, because he couldn't reach his power ratio threshold .... I won that one by space btw )...... In between, obviously that the relations may change, but it is extremely rare that a AI gives up of a planned war.