What is shadow AI, and how do you detect the code it writes?
Shadow AI is the use of AI tools without IT approval. The part most definitions miss is the code those tools produce, and where it runs afterwards.

In short: AI tools reached the workplace faster than any approval process could keep up. People now use assistants, browser extensions, and agents to get their work done, often without IT knowing which ones, for what, or with which data.
The usual concern is data: what people paste into a tool nobody has reviewed. A second concern gets less attention: these tools write code, and that code is saved, scheduled and run on company machines long after the conversation ends, with no owner on record and no policy applied.
This guide covers what shadow AI is, what it looks like at work, why people turn to it, the problems it creates and how to detect it, including the code it writes.
What is shadow AI?
Shadow AI is the use of AI tools, features, and agents for company work without IT's knowledge or approval.
That review usually covers the vendor, what happens to the data and what the tool can reach inside the company. When it's skipped, IT doesn't know the tool exists, so nobody can set rules for it.
The term borrows from shadow IT, the software and services teams adopted on their own. The pattern is the same, with one difference: AI tools don't just store or move information. They produce new work, including code, and that output stays in the company long after the tool is closed.
What counts as unsanctioned AI use?
Any AI tool that reaches company work without going through IT's approval:
- A personal account on an AI assistant used for work tasks.
- A browser extension that summarizes, writes or rewrites company documents.
- AI features turned on inside software the company already pays for.
- Agents connected to email, files or internal systems by the person who uses them.

None of this requires an install request, which is why it spreads faster than approval processes can respond.
Why do people use AI tools IT hasn't approved?
It happens because the tools work and the queue for approval does not move at the same speed.
The finance analyst closing the month, the sales analyst preparing the weekly review, and the supply chain analyst running order queries directly against the ERP all have deadlines that will not wait for a procurement cycle.
They're motivated people solving real problems. Treating them as a risk to contain is the fastest way to push their work somewhere IT can see even less.
What problems does unapproved AI use create?
Unapproved AI use creates two different types of problems, and they live in different places:
- The data that goes in: Prompts and uploads can carry customer records, financial figures, or internal documents into a tool nobody has reviewed. This is where most definitions stop, and it's exactly what DLP and prompt tools are built for.
- The code that comes out: This is the part that stays after the conversation closes.
Scripts are the new Excel macros. HTML is the new deck.
The analyst who used to keep a macro now asks an assistant for a script and runs it locally. The sales analyst who used to send a deck now generates an interactive dashboard from a CRM export.
That code arrives by three routes: a person asks an assistant and runs the result, a model generates code inside a workflow, or an agent writes and executes code on its own. Once it's saved, the code no longer passes through any AI tool, so controls built around those tools can't see it anymore.
Most of that code is useful, and none of it was written to cause harm. But not malicious does not mean authorized. Nobody has checked whether it should read the data it reads, or run on the machine it runs on.

How do you detect shadow AI?
Detecting shadow AI takes two kinds of visibility, because there are two things to find: the tools people use, and the code those tools produce.

Most companies already have tools that show which AI tools are in use, and their DLP and prompt tools cover the data people send to them. The code is the gap: a script an assistant wrote last month, now scheduled by an analyst and feeding a report.
A practical order to start:
- Map the tools. Use the network, SaaS and browser controls you already have to list which AI tools are in use, and by which teams.
- Check the data. Review what your DLP and prompt tools see going into those tools, and tune the policies you already run.
- Find the code. Run discovery on your endpoints to see which AI-generated scripts and pages are running, who owns them and what they touch.
The third step is where detection turns into a decision: once you know what is running, you can decide what keeps running.

Why doesn't blocking AI tools solve it?
Block an assistant on Friday and Monday's reports break. People who need a script find another way to get it, and the requests to release scripts pile up at IT.
The posture that works is to define the good way, make it easy and enforce the edges, which only holds if you know what is already running and can decide what runs next.
How do you govern the code AI tools produce?
Whoever or whatever wrote it, the approach is the same: find the code already running on company machines, apply your company's policies to it, and enforce them before the code runs.
Code that breaks a policy is blocked, and everything else keeps running, with an owner and a record. We cover the full approach in our guide to governance for the code AI tools produce.
See which AI-generated code is running on your endpoints.
Frequently asked questions
Is this the same as shadow IT?
It is the newest form of it. Shadow IT was unapproved software and services. Unapproved AI tools add something new: they write code that runs on company machines.
Is unsanctioned AI use always a risk?
No. Most of what people build with these tools is useful and worth keeping. The question is whether each piece is authorized for the data it touches and the machine it runs on.
Can an AI gateway cover this on its own?
A gateway governs the conversation with the model. Once the code that conversation produced is saved and reused, it runs outside the gateway's path, which is why the decision has to sit at the point of execution. More in why code running on the endpoint needs its own governance.
What kind of code do these tools usually produce?
Scripts for automation and data work, and HTML pages with JavaScript for dashboards and small apps. With Sprav, blocking is live in production with customers today, and JavaScript enforcement is rolling out now.


