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.
Before you start
Section titled “Before you start”- You hold a privilege that reads the realm’s configuration, such as
RealmViewerorRealmOwner, with your session in$CVYUH_SESSION(Call the API), andjqto read the answers. - Your devices are enrolled and approved for AI governance; see Get started with AI Governance.
Roll it up
Section titled “Roll it up”-
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 -
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.jsonclaude-code 42vscode 37cursor 12 -
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; docurl -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 -rn30 claude-code <version>12 claude-code <older version>4 grok unknownA version shows as
unknownwhere the install keeps none discovery can read; see Supported tools. -
Find the devices not seen for a day.
last_seen_atis 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.jsonEach line is a device that’s off, off the network, revoked, or whose user’s approval has lapsed.
Check it worked
Section titled “Check it worked”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.
Undo it
Section titled “Undo it”Nothing to undo: these calls only read. Delete fleet.json when you’re done.
Related
Section titled “Related”- Fleet records: every field these steps read.
- Find the MCP servers on your devices: the MCP servers behind these tools.
- AI governance sign-in: bring a quiet device back.