Please check the timeout threshold set for each unavailable state. When the maximum time set has been reached, the agent will be automatically logged out. Many times adjusting this setting is what has to be corrected and the logout issue is resolved.