change to agentAlgorithm