AI follow while she see player

Hello, I want to make an Ai who follow the player while she can see the player and when she lost the player she wait a X time to walk random.

You should take a look at

Everything you need should be int there.

This can become complex though so start small and build up.