vet discovered. When something needs investigation, you do not write queries yourself. You ask your AI coding agent. The agent turns your question into a tenant-scoped SafeDep Cloud SQL query, runs it with the safedep CLI, and reports what it found.
This guide gives you investigation playbooks: the question to ask, what the agent runs, and how to verify the answer.
Before you start
- Endpoints that sync data to your tenant. Set up Package Guard sync for package events, and optionally Inventory for AI tooling.
- The
safedepCLI, signed in withsafedep auth login. See Authentication. - An AI coding agent with the SafeDep skill installed.
The agent cannot sign in for you. Sign-in opens a browser and needs a human. If the agent reports an authentication error, run
safedep auth login yourself, confirm with safedep auth status, and tell the agent to continue.How the agent investigates
The agent works in a loop:- It discovers the queryable tables with
safedep query schema get. The schema describes the tables, their columns, the allowed joins, and the query rules. - It writes a query and runs it with
safedep query exec. - If the server rejects the query, the error says why. The agent corrects the query and retries.
Playbooks
Check exposure to a compromised package
A package you use was compromised upstream. Find out if any endpoint installed it.PMG_PACKAGE_ACTION_BLOCKED means PMG stopped the install. PMG_PACKAGE_ACTION_CONFIRMED means a person approved it after a warning. An allowed install of a compromised version is your incident to respond to.
Review what was blocked, and where
package_guard_events on both block actions, bounds the time range to the month, and joins to endpoints:
PMG_PACKAGE_ACTION_BLOCKED is a block on a known malicious package. PMG_PACKAGE_ACTION_COOLDOWN_BLOCKED is a block on a package too new to trust under the cooldown policy. Both stopped an install.
A block on one endpoint is often the first visible event of a campaign. Follow up with the exposure playbook above for the same package across the fleet.
Audit protection bypasses
PMG records when a person bypasses protection. Review these regularly.PMG_EVENT_TYPE_SANDBOX_OVERRIDE event records sandbox policy overrides. Ask the agent to check both.
Find endpoints that stopped reporting
An endpoint that stopped syncing is a blind spot: it still installs packages, and you no longer see them.Get a current verdict on a suspect package
Package Guard events record the decision PMG made at install time. Verdicts change: a package that passed last month may be known malware today. To judge a package during an investigation, get a current verdict. Two paths exist, and the agent should take the fast one first:malware, benign, or inconclusive, with evidence. Treat inconclusive as needs-review. See Scanning from CI and AI Agents for the scan contract.
See what AI tooling runs on an endpoint
If your endpoints also run Inventory scans, the same loop answers questions about AI tooling:Ask narrow questions
Results return one page at a time, up to 100 rows. Do not ask the agent to dump a table and search the output. Ask a narrow question, and let the agent filter server-side: a package name, a time range, one endpoint, one event type. When you need totals, ask for counts; the agent aggregates withGROUP BY instead of paging through rows.
Verify the answer
Every agent answer maps to a query you can run yourself:- Ask the agent to show the SQL it ran.
- Run it:
safedep query exec --sql "<statement>". - Compare the result with the agent’s summary.
SafeDep Cloud SQL
The query language, full table list, and query rules.
Install the SafeDep Skill
Set up your AI coding agent for SafeDep.
Package Guard
Sync package events from your endpoints.
Talk to SafeDep
Ask your tenant questions in plain English.

