How to make AI keep wandering after it can't find me?

First, don’t use tick. That’s like a kid nagging you in the back seat “Are we there yet?”. Instead make a custom event, name it WanderEvent, and connect it to"wander AI move to" and on fail call the WanderEvent so it’ll always wander. That’s your first loop. Second you have no way of telling the AI that the player is out of sight. It’s gonna chase your character forever unless you give it a range to stop or block it’s path or do a manual pawn sense to see if any pawn is sensed or line trace or endoverlap trigger. Once you make that trigger connect it to WanderEvent. Also on all your fails make it wander. That’s what fail mean. It fail to reach it’s target/location.

Good luck.