Register the agent in the platform

@param agent_name
The name of the agent to be registered
@param agent
The agent to register.
@throws FIPAException
321181
public static void registerAgent(Agent agent, String serviceName, String serviceType) throws FIPAException{
        DFAgentDescription dfd = new DFAgentDescription();
        ServiceDescription sd = new ServiceDescription();
        
        sd.setType(serviceType);
        sd.setName(serviceName);
        
        //NOTE El serviceType es un string que define el tipo de servicio publicado en el DF por el Agente X. 
        //     He escogido crear nombres en clave en jade.common.Definitions para este campo. 
        //NOTE El serviceName es el nombre efectivo del servicio. 
        //     Esto es lo que el usuario va a definir en MockConfiguration.DFNameService y no el tipo como estaba puesto. 
        //        sd.setType(agentType);
        //        sd.setName(agent.getLocalName());
        
        //Add services??
        
        // Sets the agent description
        dfd.setName(agent.getAID());
        dfd.addServices(sd);
        
        // Register the agent
        DFService.register(agent, dfd);
    }
1032375
def agent():
  """"""
  agent_module, agent_name = FLAGS.agent.rsplit(".", 1)
  agent_cls = getattr(importlib.import_module(agent_module), agent_name)

  logging.info("Starting agent:")
  with remote_sc2_env.RemoteSC2Env(
      map_name=FLAGS.map,
      host=FLAGS.host,
      host_port=FLAGS.host_port,
      lan_port=FLAGS.lan_port,
      name=FLAGS.agent_name or agent_name,
      race=sc2_env.Race[FLAGS.agent_race],
      step_mul=FLAGS.step_mul,
      agent_interface_format=sc2_env.parse_agent_interface_format(
          feature_screen=FLAGS.feature_screen_size,
          feature_minimap=FLAGS.feature_minimap_size,
          rgb_screen=FLAGS.rgb_screen_size,
          rgb_minimap=FLAGS.rgb_minimap_size,
          action_space=FLAGS.action_space,
          use_feature_units=FLAGS.use_feature_units),
      visualize=FLAGS.render) as env:
    agents = [agent_cls()]
    logging.info("Connected, starting run_loop.")
    try:
      run_loop.run_loop(agents, env)
    except remote_sc2_env.RestartException:
      pass
  logging.info("Done.")
832353
def start_agent(agent_name, agent_class = Agent)
      puts "#{human_readable_name} being started"

      if @options[:fiber_pool_size]
        require 'fiber_pool'
        @options[:fiber_pool] = FiberPool.new(@options[:fiber_pool_size])
        EM_S.fiber_pool = @options[:fiber_pool]
      end

      EM.error_handler do |e|
        Log.error("EM block execution failed with exception", e, :trace)
        Log.error("\n\n===== Exiting due to EM block exception =====\n\n")
        # Cannot rely on EM.stop at this point, so exit to give chance for monitor restart
        exit(1)
      end

      EM_S.run do
        begin
          @@agent = agent_class.start(@options)
        rescue SystemExit
          raise # Let parents of forked (daemonized) processes die
        rescue PidFile::AlreadyRunning
          puts "#{human_readable_name} already running"
          EM.stop
        rescue Exception => e
          puts Log.format("#{human_readable_name} failed", e, :trace)
          EM.stop
        end
      end
      true
    end
259970
async def set_agent(self, msg, context):
        """"""

        service = msg.get('name')
        client = context.user_data

        self.service_manager.set_agent(service, client)
203019
public function register(string $name, ServiceManager $service_manager)
    {
        $this->service_managers[$name] = $service_manager;
        if (Core::i()->log) {
            Core::i()->log->debug('Registered service manager: ' . $name);
        }
    }
1095673
public void startAgent (AgentObject agent)
    {
        agent.setLocal(AgentData.class, new AgentData());

        Bureau bureau = _bureaus.get(agent.bureauId);
        if (bureau != null && bureau.ready()) {
            _omgr.registerObject(agent);

            log.info("Bureau ready, sending createAgent", "agent", agent.which());
            BureauSender.createAgent(bureau.clientObj, agent.getOid());
            bureau.agentStates.put(agent, AgentState.STARTED);
            bureau.summarize();
            return;
        }

        if (bureau == null) {
            LauncherEntry launcherEntry = _launchers.get(agent.bureauType);
            if (launcherEntry == null) {
                log.warning("Launcher not found", "agent", agent.which());
                return;
            }

            log.info("Creating new bureau", "bureauId", agent.bureauId, "launcher", launcherEntry);
            bureau = new Bureau();
            bureau.bureauId = agent.bureauId;
            bureau.token = generateToken(bureau.bureauId);
            bureau.launcherEntry = launcherEntry;
            _invoker.postUnit(new LauncherUnit(bureau, _omgr));
            _bureaus.put(agent.bureauId, bureau);
        }

        _omgr.registerObject(agent);
        bureau.agentStates.put(agent, AgentState.PENDING);

        log.info("Bureau not ready, pending agent", "agent", agent.which());
        bureau.summarize();
    }
906546
def add_agent_preset(self, file_path):
        
        if file_path is not None and os.path.isfile(file_path):
            name = pathlib.Path(file_path).stem
        else:
            raise FileNotFoundError(f"File path {file_path} is not found!")

        if name in self.agent_presets:
            if self.agent_presets[name].config_path == file_path:
                return self.agent_presets[name]
            else:
                i = 1
                for preset_name in self.agent_presets:
                    if name in preset_name:
                        i += 1
                name = f"{name} ({i})"
        preset = AgentPreset(name, file_path)
        self.agent_presets[preset.get_name()] = preset
        return preset
1366426
private function action($action_name) {
    	// if no principal action is set yet or is the same
		if(!$this->Action || $action_name == $this->Action) {
			// set the main action
			$this->Action = $action_name;
		}
		// an action has already been set, this is impossible
		else { Throw new Exception("Query->action({$action_name}) : An incompatible action already exists : {$this->Action}"); }
    }
1103038
public void setUserAgent(String agent, String agentVersion) {
    userAgent = String.format("Algolia for Java (%s); JVM (%s); %s (%s)", version, System.getProperty("java.version"), agent, agentVersion);
  }
609143
def _verify_agents(self):
        
        #print('verifying...')
        nmes = []
        for agt_num, a in enumerate(self.agents):
            #print('agent#', agt_num, 'is type', type(a))
            nmes.append(a.name)
        if len(nmes) == len(set(nmes)):
            return True
        print('Error - you need to pass unique list of agent names to simulator')
        return False
492450
protected void genCounter(final String agent) {
        idsCounter.inc();
        if (!agentCounters.containsKey(agent)) {
            agentCounters.put(agent, registry.counter(MetricRegistry.name(
                    IdWorker.class, "ids_generated_" + agent)));
        }
        agentCounters.get(agent).inc();
    }
270844
public static void createAndRegister() {
    synchronized (monitor) {
      checkState(handler == null, "OC-Agent exporter is already registered.");
      OcAgentTraceExporterHandler newHandler = new OcAgentTraceExporterHandler();
      registerInternal(newHandler);
    }
  }
685735
def add_agent_cloud(self, agent_cloud):
        
        content = self._serialize.body(agent_cloud, 'TaskAgentCloud')
        response = self._send(http_method='POST',
                              location_id='bfa72b3d-0fc6-43fb-932b-a7f6559f93b9',
                              version='5.0-preview.1',
                              content=content)
        return self._deserialize('TaskAgentCloud', response)
444554
public function registerAssetJs($name, $position = CClientScript::POS_END) {
		
		$this->cs->registerScriptFile($this->getAssetsUrl() . "/js/{$name}", $position);
	}
581892
function Channel_addAgent(agent) {
  DEBUG("channel.addAgent(" + utils.JS(agent.info) + ")")
  this.agents.set(agent.info.id, agent)
  this.session.sendEvent("agentCreated", "server", agent.info)
}
1203193
public function user_agent($user_agent = NULL)
	{
		if ($user_agent !== NULL)
		{
			$this->_user_agent = $user_agent;
			return $this;
		}
		return $this->_user_agent;
	}
703037
def register_service(self, **kwargs):
        
        kwargs.setdefault('name', self.app.name)
        self.session.agent.service.register(**kwargs)