How to create a new agent using a template