Verify API is associated with a live agent
reference australia Updated Sep 10, 2026 1 min read acc-api-live-agent.md
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_agentand 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 agentParent Topic:Agent Client Collector Framework reference
36 lines · 1.7 KB
--- title: Verify API is associated with a live agent description: 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. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/it-operations-management/agent-client-collector/acc-api-live-agent.html release: australia product: Agent Client Collector classification: agent-client-collector topic_type: reference last_updated: "2026-09-10" reading_time_minutes: 1 breadcrumb: [ACC-F reference, Agent Client Collector reference, Agent Client Collector, IT Operations Management] --- # Verify API is associated with a live agent 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: ``` 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/agent-client-collector/agent-client-collector-reference.md)
| title | Verify API is associated with a live agent |
| description | 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. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/australia/it-operations-management/agent-client-collector/acc-api-live-agent.html |
| release | australia |
| product | Agent Client Collector |
| classification | agent-client-collector |
| topic_type | reference |
| last_updated | 2026-09-10 |
| reading_time_minutes | 1 |
| breadcrumb | ACC-F referenceAgent Client Collector referenceAgent Client CollectorIT Operations Management |