Function useAgentManager