Using factory for create Agent