public synchronized void runAgent(PerfTest perfTest, final SingleConsole singleConsole,
									  final GrinderProperties grinderProperties, final Integer agentCount) {
		User user = perfTest.getCreatedBy();
		final Set<AgentInfo> allFreeAgents = getAllAttachedFreeApprovedAgentsForUser(user.getUserId(), perfTest.getRegion());
		final Set<AgentInfo> necessaryAgents = selectAgent(user, allFreeAgents, agentCount);

		if (hasOldVersionAgent(necessaryAgents)) {
			for (AgentInfo agentInfo : necessaryAgents) {
				if (!agentInfo.getVersion().equals(nGrinderVersion)) {
					update(agentInfo.getIp(), agentInfo.getName());
				}
			}
			throw new NGrinderRuntimeException("Old version agent is detected so, update message has been sent automatically." +
				"\nPlease restart perftest after few minutes.");
		}

		hazelcastService.put(DIST_MAP_NAME_RECENTLY_USED_AGENTS, user.getUserId(), necessaryAgents);

		LOGGER.info(format(perfTest, "{} agents are starting.", agentCount));
		for (AgentInfo agentInfo : necessaryAgents) {
			LOGGER.info(format(perfTest, "- Agent {}", agentInfo.getName()));
		}
		agentManager.runAgent(singleConsole, grinderProperties, necessaryAgents);
	}
Assign the agents on the given console.

@param perfTest          current performance test.
@param singleConsole     {@link SingleConsole} to which agents will be assigned.
@param grinderProperties {@link GrinderProperties} to be distributed.
@param agentCount        the count of agents.
ngrinder-controller/src/main/java/org/ngrinder/agent/service/AgentService.java