AI BOM
The AI BOM tool scans codebases and container images to inventory AI framework components (models, agents, tools, prompts, and more). It parses Python source code, resolves fully qualified symbols, and matches them against a DuckDB catalog to produce an AI bill of materials. Optional LLM enrichment extracts model names, and a workflow pass annotates components with call-path context.
Features
- Static Python analysis -- Uses
libcstto capture assignments, decorators, type annotations, context managers, class definitions, and inline annotations - Container image scanning -- Extracts
/appfrom Docker images when available, otherwise scanssite-packages - DuckDB catalog matching -- Maps fully qualified symbols to curated component categories
- Custom catalog -- Register custom AI components, base-class detection rules, exclude patterns, relationship hints, and custom relationship types via
.aibom.yaml - Inline annotations -- Tag classes and functions directly in source code with
# aibom: concept=...comments - Base class detection -- Automatically categorize classes that inherit from specified base classes
- Workflow context -- Builds a lightweight call graph to show which workflows reach each component
- Derived relationships -- Infers
USES_TOOL,USES_LLM,USES_MEMORY,USES_RETRIEVER,USES_EMBEDDING, and user-defined relationship links - Optional LLM enrichment -- Uses
litellmto extract model/embedding names from code snippets - Multiple outputs -- Plaintext, JSON, or a FastAPI API server
Installation
Prerequisites: Python 3.11+, uv (recommended), Docker (optional), LLM provider API key (optional)
# Install as a CLI tool
uv tool install --python 3.13 cisco-aibom
# Or install from source
uv tool install --python 3.13 --from git+https://github.com/cisco-ai-defense/aibom cisco-aibom
# Verify
cisco-aibom --help
For local development:
git clone https://github.com/cisco-ai-defense/aibom.git
cd aibom/aibom
uv sync
source .venv/bin/activate
Knowledge Base Configuration
The analyzer uses a local DuckDB catalog. Download the catalog artifact from GitHub Releases:
VERSION="<version>"
mkdir -p "${HOME}/.aibom/catalogs"
gh release download "${VERSION}" \
--repo cisco-ai-defense/aibom \
--pattern "aibom_catalog-${VERSION}.duckdb" \
--dir "${HOME}/.aibom/catalogs"
export AIBOM_DB_PATH="${HOME}/.aibom/catalogs/aibom_catalog-${VERSION}.duckdb"
Usage
Analyze Sources
# Local directory (JSON output)
cisco-aibom analyze /path/to/project --output-format json --output-file report.json
# Container image
cisco-aibom analyze langchain-app:latest --output-format json --output-file report.json
# Multiple images from a JSON list
cisco-aibom analyze --images-file images.json --output-format plaintext --output-file report.txt
Render a JSON Report
cisco-aibom report report.json --raw-json
Optional LLM Enrichment
cisco-aibom analyze /path/to/project \
--output-format json \
--output-file report.json \
--llm-model gpt-3.5-turbo \
--llm-api-base https://api.openai.com/v1 \
--llm-api-key $OPENAI_API_KEY
Optional Report Submission
cisco-aibom analyze /path/to/project \
--output-format json \
--output-file report.json \
--post-url https://api.security.cisco.com/api/ai-defense/v1/aibom/analysis \
--ai-defense-api-key $AI_DEFENSE_API_KEY
Regional endpoints:
| Region | Base URL |
|---|---|
| US | https://api.security.cisco.com/api/ai-defense/v1/aibom/analysis |
| APJ | https://api.apj.security.cisco.com/api/ai-defense/v1/aibom/analysis |
| EU | https://api.eu.security.cisco.com/api/ai-defense/v1/aibom/analysis |
| UAE | https://api.uae.security.cisco.com/api/ai-defense/v1/aibom/analysis |
Custom Catalog
The built-in DuckDB catalog covers popular AI frameworks (LangChain, LangGraph, CrewAI, PyTorch, scikit-learn, etc.), but many teams build custom wrappers. The custom catalog lets you teach the analyzer about these components.
Place a .aibom.yaml in your project root:
components:
- id: MyLLMWrapper
concept: model
label: My Custom LLM
framework: internal
- id: myproject.tools.SearchTool
concept: tool
base_classes:
- class: BaseTool
concept: tool
- class: mylib.BaseAgent
concept: agent
excludes:
- langchain.deprecated.OldAgent
relationship_hints:
tool_arguments:
- custom_tools
- plugins
llm_arguments:
- language_model
custom_relationships:
- label: ROUTES_TO
source_categories: [router]
target_categories: [agent]
argument_hints: [routes, destinations]
Inline Annotations
Tag classes or functions directly in source code:
# aibom: concept=guardrail framework=internal
class SafetyFilter:
"""Custom content-safety guardrail."""
def check(self, text: str) -> bool:
...
# aibom: concept=tool label=WebSearch
def search_web(query: str) -> list:
...
Precedence
- Inline annotation (
# aibom: concept=...) - Base class rule (from
.aibom.yaml) - Custom component entry (from
.aibom.yaml) - Supplemental catalog (built-in entries)
- DuckDB catalog (prebuilt knowledge base)
Exclude patterns override all of the above.
Output Formats
Plaintext
--- AI BOM Analysis Report ---
[+] Found 4 MODEL:
- Name: langchain_community.llms.openai.OpenAI
Model: gpt-3.5-turbo-instruct
Source: /app/comprehensive_langchain_app.py:32
--- End of Report: Found 42 total components across all sources. ---
JSON
Structured output with metadata, sources, components, relationships, workflows, and summary.
API Mode
cisco-aibom analyze /path/to/project --output-format api
| Endpoint | Description |
|---|---|
GET /api/components | List all components |
GET /api/components/types | List component types |
GET /api/components/{id} | Get a specific component |
GET /health | Health check |
Technical Details
- Parsing:
libcstextracts fully qualified names for calls, decorators, type annotations, context managers, class definitions, and inline annotations - Catalog matching: Symbols are matched against the DuckDB
component_catalogtable using suffix matching - Workflow analysis: AST-based workflow analyzer associates components with calling functions
- Relationships: Agent arguments inspected to derive
USES_TOOL,USES_LLM,USES_MEMORY,USES_RETRIEVER,USES_EMBEDDINGlinks - LLM enrichment:
litellmis used only when--llm-modelis supplied
Troubleshooting
- DuckDB catalog errors -- Ensure the catalog file exists at
AIBOM_DB_PATHand checksums match - Docker issues -- Container analysis requires a working Docker CLI and daemon
- LLM configuration errors --
--llm-api-baseis required whenever--llm-modelis set - Missing output files --
--output-fileis mandatory forplaintextandjsonformats
License
Apache 2.0 -- See LICENSE for details.