I am not sure about the restricting an agent to logout. But I have put catches in my scripts in the past to loop through the queue like 3 time, then check for NotLogged in agents. If this is true, then I would send calls to vm or afterhours prompts. If false, then send to queueloop..