|
| 1 | +# Getting Started with AI-BOM: Generate an AI Bill of Materials |
| 2 | + |
| 3 | +AI-BOM is an open-source CLI tool that helps teams understand where AI is used in their software. |
| 4 | + |
| 5 | +By scanning your codebase, it creates an **AI Bill of Materials (AI-BOM)** — a machine-readable list of AI-specific components such as large-language models (LLMs), agent frameworks, prompts, API keys, and other AI building blocks. |
| 6 | + |
| 7 | +Knowing these components helps you manage risks, licensing, and supply-chain obligations. |
| 8 | + |
| 9 | +This tutorial walks through installation, running your first scan, understanding the output, and integrating AI-BOM into CI/CD. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Table of Contents |
| 14 | + |
| 15 | +- [What is an AI-BOM?](#what-is-an-ai-bom) |
| 16 | +- [Installation](#installation) |
| 17 | +- [First Scan](#first-scan) |
| 18 | +- [Understanding the Output](#understanding-the-output) |
| 19 | +- [CI/CD Integration](#cicd-integration) |
| 20 | +- [Next Steps](#next-steps) |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## What is an AI-BOM? |
| 25 | + |
| 26 | +An AI Bill of Materials (AI-BOM) is similar to a Software Bill of Materials (SBOM), but focused specifically on AI-centric components. |
| 27 | + |
| 28 | +AI-BOM scans your codebase and infrastructure to detect: |
| 29 | + |
| 30 | +- **LLM providers** (OpenAI, Anthropic, Google, Ollama, etc.) |
| 31 | +- **Models and embeddings** referenced in code |
| 32 | +- **Agent frameworks** (LangChain, CrewAI, AutoGen, etc.) |
| 33 | +- **Prompts and chains** |
| 34 | +- **API keys and secrets** |
| 35 | +- **Cloud AI services and containers** |
| 36 | + |
| 37 | +It supports multiple output formats including JSON, YAML, SARIF, and CycloneDX. |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## Installation |
| 42 | + |
| 43 | +AI-BOM requires **Python ≥ 3.10**. |
| 44 | + |
| 45 | +### Recommended: Install with pipx |
| 46 | + |
| 47 | +```bash |
| 48 | +pipx install ai-bom |
| 49 | +``` |
| 50 | + |
| 51 | +> **Alternative:** Install inside a virtual environment |
| 52 | +
|
| 53 | +```bash |
| 54 | +python3 -m venv .venv |
| 55 | +source .venv/bin/activate |
| 56 | +pip install ai-bom |
| 57 | +``` |
| 58 | + |
| 59 | +Verify installation: |
| 60 | + |
| 61 | +```bash |
| 62 | +ai-bom --help |
| 63 | +``` |
| 64 | + |
| 65 | +Check version: |
| 66 | + |
| 67 | +```bash |
| 68 | +ai-bom version |
| 69 | +``` |
| 70 | + |
| 71 | +Full documentation: |
| 72 | +https://github.com/Trusera/ai-bom |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## First Scan |
| 77 | + |
| 78 | +Navigate to your project root and run: |
| 79 | + |
| 80 | +```bash |
| 81 | +ai-bom scan . |
| 82 | +``` |
| 83 | + |
| 84 | +Or try the built-in demo: |
| 85 | + |
| 86 | +```bash |
| 87 | +ai-bom demo |
| 88 | +``` |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +Within seconds, AI-BOM identifies: |
| 93 | + |
| 94 | +- LLM providers |
| 95 | +- Models |
| 96 | +- Agent frameworks |
| 97 | +- Hardcoded API keys |
| 98 | +- Cloud AI services |
| 99 | +- Containers |
| 100 | +- Risk scores and flags |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## Example JSON Output |
| 105 | + |
| 106 | +AI-BOM can generate structured output in JSON format. |
| 107 | + |
| 108 | +Example: |
| 109 | + |
| 110 | +```json |
| 111 | +{ |
| 112 | + "components": [ |
| 113 | + { |
| 114 | + "name": "openai", |
| 115 | + "type": "llm_provider", |
| 116 | + "provider": "OpenAI", |
| 117 | + "risk_score": 0, |
| 118 | + "location": "requirements.txt" |
| 119 | + }, |
| 120 | + { |
| 121 | + "name": "OpenAI API Key", |
| 122 | + "type": "llm_provider", |
| 123 | + "provider": "OpenAI", |
| 124 | + "risk_score": 30, |
| 125 | + "flags": ["hardcoded_api_key"], |
| 126 | + "location": "app.py:12" |
| 127 | + } |
| 128 | + ] |
| 129 | +} |
| 130 | +``` |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +## Understanding the Output |
| 135 | + |
| 136 | +Each detected component includes metadata: |
| 137 | + |
| 138 | +| Field | Description | |
| 139 | +|-------------|-------------| |
| 140 | +| `name` | Component name | |
| 141 | +| `type` | Category (llm_provider, model, agent_framework, etc.) | |
| 142 | +| `confidence`| Match confidence score | |
| 143 | +| `risk_score`| Risk rating | |
| 144 | +| `location` | File path and line number | |
| 145 | +| `flags` | Additional signals (e.g., hardcoded_api_key) | |
| 146 | + |
| 147 | +This helps teams understand how AI is used and identify potential risks. |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | +## CI/CD Integration |
| 152 | + |
| 153 | +You can integrate AI-BOM into GitHub Actions: |
| 154 | + |
| 155 | +### Simple CLI-based step |
| 156 | + |
| 157 | +```yaml |
| 158 | +- name: Run AI-BOM scan |
| 159 | + run: ai-bom scan . --fail-on medium |
| 160 | +``` |
| 161 | +
|
| 162 | +Useful flags: |
| 163 | +
|
| 164 | +- `--fail-on` → Fail build based on risk level |
| 165 | +- `-f cyclonedx` → Generate CycloneDX output |
| 166 | +- `-f sarif` → Output SARIF for GitHub Code Scanning |
| 167 | + |
| 168 | +Integrating AI-BOM in CI ensures new AI usage is detected during pull requests. |
| 169 | + |
| 170 | +--- |
| 171 | + |
| 172 | +## Next Steps |
| 173 | + |
| 174 | +- Explore the repository: https://github.com/Trusera/ai-bom |
| 175 | +- Run AI-BOM on your own projects |
| 176 | +- Integrate into CI/CD |
| 177 | +- Contribute new scanners or improvements |
| 178 | + |
| 179 | +With a single command, AI-BOM gives visibility into AI usage across your codebase. |
| 180 | + |
0 commit comments