Verify API is associated with a live agent

reference brazil Updated Sep 10, 2026 1 min read acc-api-live-agent.md
Raw file servicenow.com

Call the AgentNowHandler.hasAgent API to determine if the CI is associated with a live agent. The API gets a sys_id of the CI and returns a true/false result.

The hasAgent() method takes a sys_id of the CI as a string parameter and returns true when the CI fulfills one of the following conditions:

  • The CI is sn_agent_cmdb_ci_agent and this agent is alive.
  • The CI is a host (extends cmdb_ci_hardware) and is associated with a live agent.
  • The CI is an application (extends cmdb_ci_appl) and has a runs-on relation to a host associated with a live agent.

For example:

JavaScript
var agentNow = new sn_agent.AgentNowHandler(); gs.info(‘Agent assocation with CI? ‘ + agentNow.hasAgent(‘158279505372b30034b8ddeeff7b1270’); // sys_id of agent

Parent Topic:Agent Client Collector Framework reference

Search documentation
Search document titles and file paths on the brazil branch