---
sourceDocument: Yokohama IT Operations Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/yokohama/it-operations-management

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama IT Operations Management

ft:clusterId :

    - itom

bundleId :

    - itom

workflow :

    - Technology


---

# Verify API is associated with a live agent

# Verify API is associated with a live agent {#ariaid-title1}

* Release version: Yokohama
* 
* Updated January 30, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

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.

{#acc-api-live-agent__ul_yvz_tsg_3kb}

For example:

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


