Host group selection, which includes selection of the agent for a task, is made before its script is processed.:PUT_ATT can be used to define a different agent but not a different AgentGroup. The script functionPREP_PROCESS_AGENTGROUP can be used to read the agents of an AgentGroup.