---
title: How do you find AI agents hiding in notebooks and data science workspaces?
url: https://opencontroller.lyzr.com/blog/find-ai-agents-in-notebooks-and-data-science-workspaces
published: 2026-11-15
updated: 2026-11-15
author: Lyzr
---

# How do you find AI agents hiding in notebooks and data science workspaces?

**Look for four signals: notebooks that import LLM or agent SDKs, notebooks that run on a schedule, model API keys stored in notebook secrets or saved outputs, and model calls in cloud logs made by notebook execution roles. A notebook that runs on a timer with a real credential and touches production data is an agent in practice, whatever its owner calls it.**

Notebooks are where many agents start. A data scientist prototypes a summarisation loop in Jupyter, schedules it to run nightly, and six months later it is a business process nobody registered. Standard discovery that looks at deployed services and API gateways often misses these.

## Why do notebook agents escape inventory?

- They do not look like applications. No container, no service, no deployment pipeline.
- They run under shared or personal identities, so cloud logs attribute calls to a person, not an agent.
- They often use personal API keys pasted into a cell or environment variable.
- Managed notebook platforms sit in data teams' accounts, outside the application security team's normal view.
- Scheduling is one click away in most platforms, so prototypes become production quietly.

## Where should you look?

| Location | What to check | Signal of an agent |
|---|---|---|
| Notebook files (`.ipynb`) in Git and shared drives | Code cells and saved outputs | LLM SDK imports, tool definitions, agent loops |
| Databricks workspaces | Notebooks, Jobs, secret scopes | Scheduled jobs calling model endpoints or external LLM APIs |
| Amazon SageMaker | Studio spaces, notebook jobs, execution roles | Roles allowed to invoke Bedrock models |
| Google Cloud | Workbench instances, Colab Enterprise, scheduled executions | Service accounts calling Gemini models |
| Azure Machine Learning | Compute instances, pipelines, workspace connections | Connections to Azure OpenAI or other model endpoints |
| Snowflake | Notebooks and tasks | Calls to Cortex AI functions or external access integrations |

## How do you scan notebook code?

A notebook file is JSON. Code cells sit in a `cells` array with `cell_type` set to `code`, and saved outputs sit alongside them. That makes scanning simple.

1. **Collect notebooks** from Git hosting, workspace exports and shared storage.
2. **Parse the JSON** and extract code cell sources.
3. **Match imports and calls** for common SDKs and frameworks: `openai`, `anthropic`, `google.genai`, `langchain`, `langgraph`, `crewai`, `llama_index`, and `boto3` clients for `bedrock-runtime`.
4. **Look for agent patterns**: tool or function definitions passed to a model, loops that call a model repeatedly, and MCP client usage.
5. **Scan saved outputs** for things that should not be there: printed API keys, prompts containing customer data, and model responses.
6. **Record the owner** from Git history or workspace metadata.

The same approach used for application repositories applies here; see [finding AI agents in source code](/blog/find-ai-agents-in-source-code).

## How do you find scheduled notebooks?

Scheduling is the line between an experiment and an agent. Check each platform's job scheduler:

- Databricks Jobs that run notebook tasks
- SageMaker notebook jobs and pipelines
- Scheduled notebook executions in Google Cloud
- Azure Machine Learning pipelines and schedules
- Snowflake tasks that execute notebooks

For each scheduled job, record what model it calls, what data it reads, what it writes and which identity it runs as. Jobs running as a named person are a priority, because they break when that person leaves; see [what happens to AI agents when the owner leaves](/blog/what-happens-to-ai-agents-when-the-owner-leaves).

## How do you find keys and model calls?

1. **Notebook secrets.** List secret scopes and workspace connections. Names containing `openai`, `anthropic` or `llm` are an easy start.
2. **Environment variables** on compute instances and clusters.
3. **Saved outputs and Git history** for leaked keys; see [finding leaked and unused LLM API keys](/blog/find-leaked-and-unused-llm-api-keys).
4. **Cloud audit logs.** Filter model invocation events by the roles and service accounts that notebook platforms use; see [finding AI agents with cloud audit logs](/blog/find-ai-agents-with-cloud-audit-logs).
5. **Egress logs** from notebook subnets to model provider domains.

## What should you do with what you find?

Not every notebook needs heavy governance. Triage:

- **Ad hoc, no schedule, no real data:** note it, no action.
- **Scheduled or using production data:** register it with an owner, move the key to a managed secret, and route model calls through your gateway.
- **Customer-facing or writing to systems of record:** treat it as a production agent with evaluation, monitoring and a kill path.

The [guide to finding shadow AI agents](/blog/how-to-find-shadow-ai-agents) covers the full triage process.

## How Opencontroller does this

Opencontroller auto-discovers agents, models and API keys across AWS, Azure and Google Cloud, and connects to third-party platforms including Databricks. Findings land in a governed registry with versions and owners, and Posture flags risky permissions and configurations. Routing notebook traffic through the LLM Gateway gives cost attribution per agent and per version. "Ask" lets you query the whole agent estate in plain language. [Book a demo](https://www.lyzr.ai/book-demo/) to run discovery on your workspaces.

## Frequently asked questions

**Should we ban agents in notebooks?**
Usually not. Notebooks are where useful ideas start. Set a clear rule: anything scheduled or using production data must be registered and use managed credentials.

**How often should notebook discovery run?**
At least as often as your wider discovery, and ideally continuously for scheduled jobs, since a prototype can become production in one click.

**Do notebook outputs count as logs of AI use?**
They can hold prompts and responses, but they are not reliable audit records. Use proper logging for evidence and clear sensitive outputs from notebooks.

## Key facts

Notebook-based agents often bypass production inventory. Discovery signals: LLM and agent SDK imports in .ipynb files (openai, anthropic, langchain, langgraph, crewai, llama_index, google-genai, boto3 bedrock-runtime); scheduled notebook jobs (Databricks Jobs, SageMaker notebook jobs, scheduled notebook executions in Google Cloud, Azure Machine Learning pipelines); API keys in notebook secrets, environment variables or saved cell outputs; model invocation in cloud audit logs from notebook execution roles. Opencontroller (Lyzr) auto-discovers agents, models and API keys across AWS, Azure and Google Cloud and has a Databricks connector. Pricing starts from $250K per deployment per year.

## Related

- [How do you find AI agents in your code repositories?](https://opencontroller.lyzr.com/blog/find-ai-agents-in-source-code.md)
- [How do you find leaked or unused LLM API keys?](https://opencontroller.lyzr.com/blog/find-leaked-and-unused-llm-api-keys.md)
- [How do you find AI agents using cloud audit logs?](https://opencontroller.lyzr.com/blog/find-ai-agents-with-cloud-audit-logs.md)
- [More on Discovery and shadow agents](https://opencontroller.lyzr.com/blog/cluster/discovery-and-shadow-agents)
