A 15pxnon-aggression pact may be agreed between two factions via diplomacy as a statement of mutual trust. It is usually the first step in building relations towards trade and, eventually, an alliance.
A faction breaking a non-aggression pact will incur significant diplomatic penalties which make it less likely that other factions will trust them in future.
A non-aggression pact does not prevent raiding as it is not seen as a violation of the treaty. Attacking the raiding army is seen as a declaration of war and will incure reliability penalties.