Best way to play AI animation

Hi,
So I’m making a game where an enemy AI chases the player. I want the AI to play some animations like an Aggro one when it sees the player for example. I have the logic already done for the AI to see the player and chase them. What I’m confused about is the best way to have the enemy go from its walking/idle animation to the aggro one and then back once it sees the player after it is searching for the player. I guess the part that I’m stuck at is how or where I would set a boolean to transition between animation states. Ideally, I’d want to have the player rotate to face the player, run the behavior tree task to play an animation, and then have it go back to the walking/idle animation when it goes to move to the player. I have a very generalized idea of how I could do this and I’ve done it before, but it was kind of messy and I wanted to know if there was a cleaner way to implement this.