[Added] support for agents to reconnect
[Changed] AgentService refactoring