Refactor, Add 3 tests for AgentManager