
Report on Agent Work object/entity can be used to calculate Agent total spent time on Chat in Salesforce.
1. Create a Report Type on Agent Work entity.

2. Create a formula field on the report to calculate the duration in Seconds.
Formula for reference:
( TIMEVALUE( AgentWork.CloseDateTime ) -
TIMEVALUE( AgentWork.AcceptDateTime )
) / 1000
