---
title: How do you find AI agents hidden in container images?
url: https://opencontroller.lyzr.com/blog/find-ai-agents-in-container-images
published: 2026-11-16
updated: 2026-11-16
author: Lyzr
---

# How do you find AI agents hidden in container images?

**Generate a software bill of materials (SBOM) for every image in your registries, then search it for LLM SDKs, agent frameworks and MCP libraries. Add two cheap checks the SBOM misses: environment variables and config that point at model endpoints, and large model-weight files baked into layers. Anything that matches becomes a candidate agent to confirm and register.**

Cloud discovery finds managed agents. It does not see a LangGraph service someone packaged into a container and shipped to a Kubernetes cluster or a VM. Those agents are often the riskiest ones, because they carry their own API keys and nobody filed them anywhere. This guide shows where to look, what to look for, and how to turn matches into an inventory. For the wider picture, start with [how to find every AI agent in your enterprise](/blog/how-to-find-shadow-ai-agents).

## Why don't cloud and network scans catch containerised agents?

A containerised agent usually calls a model provider over HTTPS with a key stored in a secret. Cloud control-plane discovery sees the Kubernetes cluster, not the agent inside it. Network detection sees traffic to an API host, but not which image or team sent it, and it misses agents that have not run yet.

The image is the one place where the agent's code, dependencies and configuration sit together before it runs. That makes the registry the best pre-runtime source. It complements, rather than replaces, [searching code repositories](/blog/find-ai-agents-in-source-code), because many images are built from repos the governance team cannot see, or pulled straight from public registries.

## What should you scan for in a container image?

Search the image's package list for these signals. The names below are the published package names on PyPI and npm.

| Signal | What to search for | What it tells you |
|---|---|---|
| Model provider SDKs | `openai`, `anthropic`, `@anthropic-ai/sdk`, `google-genai`, `google-cloud-aiplatform`, `mistralai`, `cohere` | The service calls a model directly |
| Agent frameworks | `langchain`, `langgraph`, `crewai`, `llama-index`, `autogen-agentchat`, `semantic-kernel`, `openai-agents`, `strands-agents`, `google-adk`, `pydantic-ai` | Likely an agent with tools and loops, not just a single prompt |
| MCP libraries | `mcp` (Python SDK), `@modelcontextprotocol/sdk` (npm) | The image is an MCP server or client and may expose tools |
| Routing libraries | `litellm`, `ai` (Vercel AI SDK) | Multi-provider calls; possibly a home-made gateway |
| Inference servers | Base images such as `ollama/ollama`, `vllm/vllm-openai`, Hugging Face text-generation-inference | Self-hosted model serving inside your estate |
| Model weights | Large `.safetensors`, `.gguf`, `.onnx`, `.pt` files in a layer | A model shipped inside the image |

Do not stop at the SDK match. A `boto3` dependency is too broad on its own, but `boto3` plus code that calls `bedrock-runtime` or `bedrock-agentcore` is a strong signal. Use a short allow-list of high-confidence packages first, then widen.

## How do you scan a whole registry, step by step?

1. **List every registry.** Include cloud registries (Amazon ECR, Azure Container Registry, Google Artifact Registry), self-hosted ones (Harbor, Artifactory, Nexus) and pull-through caches of public images.
2. **Generate SBOMs.** Use the scanner you already run. Amazon Inspector can [export SBOMs](https://docs.aws.amazon.com/inspector/latest/user/sbom-export.html) for ECR images in CycloneDX or SPDX format to S3. Open-source tools such as Syft and Trivy generate SBOMs from an image reference. Many teams already store SBOMs for vulnerability management, so reuse them.
3. **Query the SBOMs.** Load them into one place and match package names from the table above. Record image digest, repository, tag and the matched packages.
4. **Inspect configuration.** Read the image config and Dockerfile history for environment variables such as `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `AZURE_OPENAI_ENDPOINT`, `OPENAI_BASE_URL` or `GEMINI_API_KEY`. A key baked into an image layer is a leaked secret: rotate it and treat it as an incident.
5. **Check for model weights.** Flag layers with large weight files. They raise licensing, provenance and data questions separate from agent behaviour. CycloneDX has defined a machine-learning BOM (ML-BOM) for models and datasets [since version 1.5](https://cyclonedx.org/news/cyclonedx-v1.5-released), so you can record them in the same format.
6. **Join to what is running.** Match image digests to running workloads (Kubernetes pods, ECS tasks, Cloud Run services). An image that matches but never runs is low priority; one running in production with write access is not.
7. **Assign an owner.** Use the repository, build pipeline and namespace labels to find the team. No owner means it goes on the orphan list.
8. **Register and re-scan.** Add confirmed agents to your agent registry and re-scan on every push, so new images are caught at build time rather than months later.

## How do you tell an agent from an app that just calls a model?

Not every match is an agent. A service that summarises text with one API call carries less risk than one that plans, calls tools and writes to systems. Classify each match:

- **Model call only:** provider SDK, no framework, no tool definitions.
- **Agent:** an agent framework, tool or function definitions, a loop, or an MCP client.
- **Tool provider:** an MCP server library. It may be the thing other agents call, so its permissions matter most.
- **Model host:** an inference server or weights. Treat it as a model asset, and check whether it is reachable from outside its namespace.

Apply your normal risk questions next: which data it reads, whether it can write or send, what credentials it holds, and who uses it. Where an image holds long-lived provider keys, plan the move to [workload identity for agent pods](/blog/kubernetes-workload-identity-for-agent-pods) or a managed secret.

## What are the common gaps?

- **Vendored or copied code.** If a team copied an SDK into the source tree, the SBOM will not list it. Pair the SBOM search with a code search for provider hostnames such as `api.openai.com` and `api.anthropic.com`.
- **Runtime installs.** Images that `pip install` at start-up hide their real dependencies. Flag them as a hygiene issue.
- **Distroless and compiled images.** Go and Rust binaries may not expose package metadata cleanly. Fall back to string search for API hostnames.
- **Old tags.** Registries keep years of images. Scope the first pass to images that ran in the last 90 days.

## How Opencontroller does this

Opencontroller auto-discovers agents, models and API keys across AWS, Azure and Google Cloud, and keeps them in a governed registry of agents, versions, tools and MCP servers. Container-image findings from your existing scanner can be registered alongside those records, so one inventory shows managed and self-built agents together. Posture then flags risky permissions and configuration on registered agents. Registration is not runtime takeover: enforcement depth depends on the connector and traffic path, for example routing a containerised agent's model calls through the LLM Gateway for routing and cost attribution per agent. See the [capability reference](/capability-reference) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Is an SBOM enough to find every AI agent in a container?**
No. It finds declared dependencies. Add a search for model API hostnames and environment variables, and check for runtime installs and vendored code.

**Should model weights inside an image count as an AI asset?**
Yes. Record them as model assets with their source and licence, separately from any agent that uses them.

**How often should container registries be scanned for agents?**
On every image push, plus a periodic full pass. Build-time checks catch new agents before they reach production.

## Key facts

To find AI agents in container images: generate SBOMs per image (Amazon Inspector exports CycloneDX/SPDX SBOMs for ECR; Syft and Trivy also work), match LLM SDKs (openai, anthropic), agent frameworks (langchain, langgraph, crewai, openai-agents, strands-agents, google-adk), MCP libraries (mcp, @modelcontextprotocol/sdk), check env vars like OPENAI_API_KEY, flag model-weight files, join digests to running workloads, assign owners, register. Opencontroller auto-discovers agents, models and API keys across AWS, Azure and Google Cloud into a governed registry. Opencontroller 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 should AI agent pods on Kubernetes get cloud credentials?](https://opencontroller.lyzr.com/blog/kubernetes-workload-identity-for-agent-pods.md)
- [How do you find leaked or unused LLM API keys?](https://opencontroller.lyzr.com/blog/find-leaked-and-unused-llm-api-keys.md)
- [More on Discovery and shadow agents](https://opencontroller.lyzr.com/blog/cluster/discovery-and-shadow-agents)
