Detection · Agent Scan

How to find AI agents hiding in your code and dependencies

If software calls a model and acts on the answer, it's an agent — whether or not anyone on your team calls it that. Finding every one of them is a static-analysis job with three layers. Here is how it works, limits included.

August 2026 · the full method survey is the technical paper · why it matters is the dangers page

Layer 1: what the code declares

Agent frameworks and model SDKs are imported by name and pinned in dependency manifests. Scanning imports, manifests and lock files answers the first question — could this code construct an agent at all? — with high precision, across your own code and everything vendored under it. It is the same technique licence auditors have used for years, aimed at a different target list.

Layer 2: what the code can execute

The constructs that turn model output into action are enumerable: eval and exec, subprocess invocation, deserialisation of executable content. A scanner must be language-aware here — exec means execution in Python and nothing of the kind in Java or C++, and a tool that does not know the difference buries you in false positives. Finding these call sites, and whether their arguments are data rather than literals, is classic static analysis.

Layer 3: what connects to what

The layer that separates evidence from noise: data-flow. Does model output actually reach the shell call, the file write, the outbound request? Code that calls a model and displays the answer is a feature; code where the answer flows into execution is an agent with hands. Tracing that path is what elevates a finding from "imports an AI library" to "model-derived data reaches exec() at this file and line".

What static detection cannot promise

Honesty matters here. Static analysis cannot prove what happens at runtime: dynamically-built imports and configuration-driven dispatch can hide agent construction, and a framework in the dependency tree does not prove any agent is constructed on a reachable path. The output is evidence to weigh — with file and line attached — not a verdict. That is also exactly what an auditor needs it to be.

Run it

CodeDelta's Agent Scan implements all three layers across 43 languages and emits the result as a report and an AI-BOM, from a CLI or a GitHub Action on every pull request, entirely inside your own infrastructure. Point it at one repository — especially one with a deep dependency tree — and see what is in there.