AI does not walk off ledges

Maybe the AI needs a behaviour that if anything obstructs the direct path (like a ledge or a drop??) it can try and do a jump towards the player? Surly that would make it “jump off” the ledge unintentionally, but still do what you want it to.