improved error handling for registering agent types