how to get AI to track player then switch to wonder when close to the player?

so I’m trying to get an AI to track the player but once its close enough id like it to switch to like a wondering mode.

I tried placing a box collision over the ai and check if a player is within it but I’m not sure how to get that to work or if that would even work in the first place

Any help or insight on how to make this work or if I should work on this another way would be awesome!