Uipath agent getting closed automatically

i am running one workflow in UiPath studio for legacy java based windows application on local system in that have many activities, once one activity failed UiPath agent get shutdown automatically.
i want like if activity get fail still agent must remain connected so that i can open failed activity and check what was error then resume flow to save time.
please anyone can help me here.

@sharad_p

Looks like you are not running in debug mode..try to run in debug mode its an option you get in the top menu

Cheers