Skip to content
AI GovernanceMarkdown

Count the AI tools across your devices

Roll up which AI tools and versions your realm's devices have installed, and find the devices that haven't reported for a day.

API

Your security team wants a number for each AI tool: how many machines have Claude Code, which versions of Cursor are out there, and whether an old version that needs patching is still around. They also want to know which devices have stopped reporting, since a quiet device is one you can’t see. Your realm’s AI fleet holds the answer; this guide rolls it up with curl and jq.

  • You hold a privilege that reads the realm’s configuration, such as RealmViewer or RealmOwner, with your session in $CVYUH_SESSION (Call the API), and jq to read the answers.
  • Your devices are enrolled and approved for AI governance; see Get started with AI Governance.
  1. Save the fleet’s device list:

    Terminal window
    curl -s https://foobar.cvyuh.com/api/v0/endpoint/aig/v1/api/v1/devices \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" > fleet.json
  2. Count the devices that have each tool, from each device’s installed_tools:

    Terminal window
    jq -r '[.[].installed_tools[]] | group_by(.) | map([.[0], length]) | sort_by(-.[1])[] | @tsv' fleet.json
    claude-code 42
    vscode 37
    cursor 12
  3. Count each tool by version. Versions are in each device’s own record, so read each one:

    Terminal window
    jq -r '.[].id' fleet.json | while read -r id; do
    curl -s "https://foobar.cvyuh.com/api/v0/endpoint/aig/v1/api/v1/devices/$id" \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" |
    jq -r '.discoveries[] | [.kind, (if .version == "" then "unknown" else .version end)] | @tsv'
    done | sort | uniq -c | sort -rn
    30 claude-code <version>
    12 claude-code <older version>
    4 grok unknown

    A version shows as unknown where the install keeps none discovery can read; see Supported tools.

  4. Find the devices not seen for a day. last_seen_at is in seconds since the Unix epoch:

    Terminal window
    jq -r --argjson now "$(date +%s)" \
    '.[] | select((.last_seen_at // 0) < $now - 86400) | [.hostname, .id, (.last_seen_at // "never")] | @tsv' \
    fleet.json

    Each line is a device that’s off, off the network, revoked, or whose user’s approval has lapsed.

The total in step 2 for a tool is never more than the number of devices in fleet.json (jq length fleet.json). Install a supported tool on one device, wait for it to report (at most 15 minutes), and run steps 1 and 2 again: its count goes up by one.

Nothing to undo: these calls only read. Delete fleet.json when you’re done.