In Freshservice, from the agent side there is an option to switch to end user portal

Why not add an option to switch to agent portal?
jQuery("#user-dropdown").append('<a href="/helpdesk" role="menuitem" aria-controls="page-main">Visit Agent Portal</a>');
This does it for you

