{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":22742,"path":"intelligent-experiences/ai-control-tower/ai-service-graph-connector-for-hugging-face.md","title":"AI Service Graph Connector for Hugging Face","bundle":null,"doc_type":null,"release":"australia","body":"\n# AI Service Graph Connector for Hugging Face\n\nThe AI Service Graph Connector for Hugging Face enables you to discover and import AI assets from your Hugging Face environment into ServiceNow AI Control Tower.\n\nThe connector integrates with your Hugging Face account to catalog AI systems, agents, models, and prompts from Hugging Face Spaces. Usage data is automatically collected and populated into the AI Control Tower value dashboard, providing comprehensive visibility and governance of your AI operations.\n\n## Download apps from the Store\n\nVisit the ServiceNow store website to download the [AI Service Graph Connector for Hugging Face](https://store.servicenow.com/store/app/201bf3c397c04310f17933e11153af96) application.\n\n## Supported ServiceNow versions\n\n|Release|Status|\n|-------|------|\n|Australia|Supported|\n|Zurich|Supported|\n\n## User Roles\n\nYou must have one of the following roles assigned.\n\n|Required Roles|\n|--------------|\n|sn\\_ai\\_disc.discovery\\_admin|\n|sn\\_cmdb\\_int\\_util.sgc\\_admin|\n\n## ServiceNow Prerequisites\n\nComplete the following setup steps once when configuring the connector for the first time.\n\n**Note:** Updating data source access and clear cache is a prerequisite that needs to be completed only once, when setting up a new instance for the first time.\n\nUpdate Data Source Access:\n\nThe connector requires write permissions to the Data Source table to create data sources.\n\nTo enable data source creation:\n\n1.  Select **Global** from the application picker.\n2.  Navigate to **Application Access**.\n3.  Select the **Can create**, **Can update**, and **Can delete** check boxes.\n4.  Select **Update**.\n5.  Switch to the connector application scope.\n\nClear the cached data for the Data Source and Tables.\n\nTo clear the cache:\n\n1.  Navigate to **System Definition** &gt; **Background Scripts**.\n2.  Enter the following script in the **Run Script** text box:\n\n    ```\n    GlideTableManager.invalidateTable('sys_data_source');\n    GlideCacheManager.flushTable('sys_data_source');\n    GlideTableManager.invalidateTable('sys_db_object');\n    GlideCacheManager.flushTable('sys_db_object');\n    \n    ```\n\n3.  Select **Run Script**.\n\n    **Note:** The script might take several minutes to complete. After completion, switch to the connector application scope.\n\n\n## Hugging Face Prerequisites\n\nComplete the following steps in your Hugging Face environment before creating a connection.\n\n-   Hugging Face account \\(If you don't have a Hugging Face account, create one at https://huggingface.co\\).\n-   Generate API Tokens.\n\n## Discovery Scope\n\nThe Hugging Face connector discovers AI components from Hugging Face Spaces by analyzing Python files using pattern matching. The following AI asset types are identified during discovery:\n\n<table><tbody><tr><td>\n\nAsset Type\n\n</td><td>\n\nDescription\n\n</td></tr><tr><td>\n\nAI Agents/Systems\n\n</td><td>\n\nApplications and agent implementations identified in Space code.\n\n</td></tr><tr><td>\n\nAI Models\n\n</td><td>\n\nLanguage models, embeddings, and other ML models referenced in code.\n\n</td></tr><tr><td>\n\nAI Tools\n\n</td><td>\n\nFunction definitions and tool implementations.\n\n</td></tr><tr><td>\n\nAI Prompts\n\n</td><td>\n\nPrompt templates and configuration strings.\n\n</td></tr></tbody>\n</table>The discovery process follows these stages:\n\n-   Space Discovery – Identifies Hugging Face Spaces based on organization membership or public visibility.\n-   Code Analysis – Downloads and analyzes Python files from each Space.\n-   Pattern Matching – Identifies these components:\n    -   Agent implementations \\(for example, LangChain agents, custom frameworks\\).\n    -   Model references \\(for example, model\\_id parameters, API calls\\).\n    -   Tool definitions \\(for example, function decorators, tool classes\\).\n    -   Prompt templates \\(for example, PromptTemplate, string templates\\).\n-   Relationship Mapping – Links AI systems to their sub-components such as models, tools, and prompts.\n-   Incremental Updates – Processes only Spaces modified since the last successful import.\n\n**Note:** The connector performs incremental discovery, only processing spaces that have been modified since it's last successful import.\n\n## Data Mapping\n\nThe connector maps Hugging Face AI assets to ServiceNow staging tables and target CMDB tables for comprehensive asset management.\n\n|Data Source|Staging Table|Target Table|Description|\n|-----------|-------------|------------|-----------|\n|SG-HuggingFace-Discovery|sn\\_ai\\_hf\\_disc\\_ai\\_discovery\\_staging|Parent data source|Discovers HuggingFace Spaces and feeds other staging tables|\n|SG-HuggingFace-System|sn\\_ai\\_hf\\_disc\\_ai\\_system\\_staging|alm\\_ai\\_system\\_digital\\_asset|Imports AI systems and applications|\n|SG-HuggingFace-Model|sn\\_ai\\_hf\\_disc\\_ai\\_model\\_staging|alm\\_ai\\_model\\_digital\\_asset|Imports AI models and embeddings|\n|SG-HuggingFace-Prompt|sn\\_ai\\_hf\\_disc\\_ai\\_prompt\\_staging|alm\\_ai\\_prompt\\_digital\\_asset|Imports prompt templates|\n|SG-HuggingFace-Tool|sn\\_ai\\_hf\\_disc\\_ai\\_tool\\_staging|sn\\_ent\\_ai\\_tool|Imports tool and function definitions|\n|SG-HuggingFace-SubComponents M2M|sn\\_ai\\_hf\\_disc\\_ai\\_m2m\\_staging|sn\\_ent\\_ai\\_system\\_subcomponent\\_m2m|Imports relationships between AI systems and their components|\n\n## Target Tables\n\nThe Hugging Face connector populates the following target tables in ServiceNow.\n\nDigital Asset Tables:\n\n-   alm\\_ai\\_system\\_digital\\_asset – Stores AI System digital assets discovered from Hugging Face Spaces.\n-   alm\\_ai\\_model\\_digital\\_asset – Stores AI Model digital assets including language models and embeddings.\n-   alm\\_ai\\_prompt\\_digital\\_asset – Stores AI Prompt digital assets including prompt templates and configurations.\n\nEntity Tables:\n\n-   sn\\_ent\\_ai\\_tool: Stores AI Tools including function definitions and tool implementations.\n-   sn\\_ent\\_ai\\_system\\_subcomponent\\_m2m: Stores many-to-many relationships between AI systems and their subcomponents \\(models, tools, prompts\\).\n\n**Note:** The Hugging Face connector currently focuses on discovery of AI assets. Usage and execution tracking capabilities may be added in future versions.\n\n## Data Flow Architecture\n\nThe Hugging Face connector follows this data flow:\n\n<table><tbody><tr><td>\n\nStage\n\n</td><td>\n\nDescription\n\n</td></tr><tr><td>\n\nData Source\n\n</td><td>\n\nThe connector calls Hugging Face APIs to discover Spaces based on organization or public visibility settings.\n\n</td></tr><tr><td>\n\nStaging Tables\n\n</td><td>\n\nRaw data is loaded into import set staging tables for processing.\n\n</td></tr><tr><td>\n\nTransform Maps\n\n</td><td>\n\nData is transformed, validated, and mapped to target table schema.\n\n</td></tr><tr><td>\n\nTarget Tables\n\n</td><td>\n\nCleaned and structured data is inserted into the final destination tables in the ServiceNow CMDB.\n\n</td></tr></tbody>\n</table>"}}