def agent_type(type, name)
      unless type
        if name =~ /^(.*)_[0-9]+$/
          type = Regexp.last_match(1)
        else
          type = name || "instance"
        end
      end
      type
    end
def agent_type(type, name)
      unless type
        if name =~ /^(.*)_[0-9]+$/
          type = Regexp.last_match(1)
        else
          type = name || "instance"
        end
      end
      type
    end
Determine agent type

 === Parameters
 type(String):: Agent type
 name(String):: Agent name

 === Return
 (String):: Agent type