Calculate the prompt token for each and every tasks in agent

How to get the prompt token after each and every task? → I need this to raise the userdeifned exception if the token limit exceeded.

TaskOutput doesn’t have the attribute of usage metrics. Help me on this.