The AI-controlled characters (guards) will only be able to detect and capture you if you choose to intentionally move towards them. Otherwise, there's no logical reason for you to approach these non-player characters, making the encounter unnecessary.