AIBehaviours

Okay so I’ve been working on a game that starts by having a panda wander around until you get within a certain distance, and then it follows you, however, i don’t know how to make it stop following my player, like, if it gets a certain distance away the panda returns to its aimless wandering. Any ideas on how to stop the pursue behavior?