Animator - Wait until animation finishes

Hello!
I’m writing a script which will handle monster attack. Script plays Attack animation in Animator component by trigger. I want to stop monster from moving before the animation start and resume his moves after animation ends. I wrote this so far, but agent starts before animation ends. I must add that during the fight monster may get pissed and start to move faster(animation play speed multiplier).

anim.SetTrigger("Attack");
agent.Stop();
yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length+anim.GetCurrentAnimatorStateInfo(0).normalizedTime);
Debug.Log("Attack has ended!");
agent.Resume();

If you need something more than this code please let me know.
I would really appreciate your help

Thanks so much @marcin107
This did the work for me: yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length+anim.GetCurrentAnimatorStateInfo(0).normalizedTime);

Try this code. I was using it for my game and it work perfectly. But I was using it at Update method. Haven’t try this code at IEnumerator though

           //if animation with name "Attack" finished
           if (anim.GetCurrentAnimatorStateInfo(0).IsName("Attack"))
            {
                // do something
            }

@marcin107 This worked for me as well: yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length+anim.GetCurrentAnimatorStateInfo(0).normalizedTime);,@marcin107 this worked for me as well thank you
yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length+anim.GetCurrentAnimatorStateInfo(0).normalizedTime);