Added setAgent to the configuration class. Also checks if the agent is already present before creating one when loading config.