create factory for creating agent