My understanding is that the AI cannot attack you if you have an Open Borders agreement... if war is declared, all units must first be removed from your territory.
I have a saved game in which the Romans 1) move a Pratorean unit along my road until it's next to my capitol 2) attack and seize the capitol 3) declare war and drop the Open Border agreement.
I have a saved game in which the Romans 1) move a Pratorean unit along my road until it's next to my capitol 2) attack and seize the capitol 3) declare war and drop the Open Border agreement.