added per_agent template support