Skip to content

About

Enterprise-grade AI pipeline integrating ServiceNow CMDB with Azure OpenAI. Automates incident classification, CSDM-based routing, and KB-grounded resolution using RAG. Features a Human-in-the-Loop approval flow, structured work notes, and automated email alerts to bridge the gap between raw IT data and actionable insights.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AIOps Incident Intelligence Platform

An enterprise-grade AI pipeline that automatically triages IT incidents in ServiceNow β€” classifying, routing, and resolving them using GPT-4o-mini, with semantic KB retrieval via Azure AI Search and document extraction via Azure Document Intelligence.

Python OpenAI ServiceNow Azure AI Search Azure Doc Intel Status


Overview

Most IT operations teams handle incidents reactively β€” a ticket comes in, a technician reads it, figures out what it is, checks the knowledge base, and writes a response. This process is slow, inconsistent, and entirely dependent on individual knowledge.

This project replaces that manual triage layer with an AI pipeline that runs automatically. When a new incident arrives in ServiceNow, the pipeline classifies it, traverses the CMDB to understand what business service is impacted, reads any attached documents, finds the most semantically relevant KB article using vector search, and writes a structured work note back to the incident β€” all before a technician touches it.

What makes it different from a simple chatbot wrapper is the depth of integration: live taxonomy from ServiceNow, CMDB-aware routing, semantic vector KB retrieval, document extraction from attachments, and a self-improving knowledge base that learns from every resolved incident.


Demo

πŸš€ AIOps Pipeline starting...
   Azure AI Search configured: True
   Found 30 incident(s) to process

   Processing INC0010038: Slow query alert β€” stored procedure sp_account_bal
     Source: monitoring_tool
     Category: database / db_query_perf (high)
     CI: PROD-PAY-DB-01 β†’ Database Administration
  Found 3 attachment(s) β€” extracting text...
  Extracted 1855 chars from INC0010038_DBA_Investigation.docx
  Extracted 1168 chars from INC0010038_Dynatrace_Alert_Export.docx
  Extracted 1943 chars from INC0010038_Post_Incident_Review.docx
     Attachments: 3016 chars extracted
     Related: 0 same CI, 1 same category
     KB mode: semantic (Azure AI Search)
     KB: Database Connection Pool Exhaustion (KB0010012)
  βœ… Work note written to ServiceNow
     πŸ“§ Alert email sent to team
     βœ… Done β€” 1,685 tokens used

Work note written to ServiceNow β€” enriched with attachment content:

AI ANALYSIS β€” INC0010038 - CONFIDENCE: High
CATEGORY: Database / Query Performance
CI: PROD-PAY-DB-01
SERVICE: Payment Processing - PROD
CSDM: Payment Processing App β†’ Payment Processing - PROD β†’ PROD-PAY-DB-01
KB MATCH: Yes (KB0010012 β€” Database Connection Pool Exhaustion)

RELATED INCIDENTS:
β€’ INC0010035 β€” Connection pool at 100% on PROD-PAY-DB-01

LIKELY CAUSE: The Q3 schema migration on 08-Apr-2026 invalidated the execution
plan for sp_account_balance_calc, causing a full table scan at 4.2s average,
while concurrent connection pool exhaustion (DT-ALERT-88421) exacerbated the
slowdown.

ACTIONS (From KB):
β€’ Review execution plan for sp_account_balance_calc on PROD-PAY-DB-01
β€’ Revert execution plan or create new index on account_transactions table
β€’ Monitor connection pool utilisation β€” currently at 78%
β€’ Analyse long-running transactions during peak hours
β€’ Document findings for future reference

ESCALATION GROUP: Database Administration
NOTE: AI-generated. Validate before execution.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     ServiceNow PDI                          β”‚
β”‚    Incidents Β· CMDB Β· KB Articles Β· Attachments Β· Users     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ REST API
                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   AIOps Pipeline                            β”‚
β”‚                                                             β”‚
β”‚  fetch_incidents β†’ source_detector β†’ classifier             β”‚
β”‚                                          β”‚                  β”‚
β”‚               cmdb_lookup β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
β”‚                    β”‚                                        β”‚
β”‚          attachment_reader (Azure Doc Intelligence)         β”‚
β”‚                    β”‚                                        β”‚
β”‚          similar_incidents (4 correlation signals)          β”‚
β”‚                    β”‚                                        β”‚
β”‚          semantic_kb_search (Azure AI Search + GPT)         β”‚
β”‚                    β”‚                                        β”‚
β”‚          work_note_generator (GPT-4o-mini)                  β”‚
β”‚                    β”‚                                        β”‚
β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             β”‚
β”‚         β–Ό                     β–Ό                             β”‚
β”‚   write_notes            emailer                            β”‚
β”‚ (ServiceNow PATCH)   (Gmail SMTP alert)                     β”‚
β”‚         β”‚                                                   β”‚
β”‚      logger                                                 β”‚
β”‚ (pipeline_log.jsonl)                                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Weekly:
learning_loop β†’ kb_proposer β†’ email_proposals
                                    β”‚
                         Manager replies via email
                                    β”‚
                         email_listener (GPT parses reply)
                                    β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β–Ό
        Create/update KB in ServiceNow

Tech Stack

Component Technology
AI model OpenAI GPT-4o-mini (direct API, temperature: 0)
Embeddings OpenAI text-embedding-ada-002
Vector search Azure AI Search (hybrid vector + keyword)
Document extraction Azure Document Intelligence (prebuilt-read)
ITSM platform ServiceNow (PDI)
Email Gmail SMTP + IMAP
Dashboard Streamlit
Language Python 3.13
KB drafts python-docx

Project Structure

AIOps Project/
β”œβ”€β”€ pipeline/
β”‚   β”œβ”€β”€ pipeline.py              # Main orchestrator
β”‚   β”œβ”€β”€ fetch_incidents.py       # ServiceNow incident retrieval
β”‚   β”œβ”€β”€ source_detector.py       # Monitoring tool vs human detection
β”‚   β”œβ”€β”€ classifier.py            # AI classification β€” live ServiceNow taxonomy
β”‚   β”œβ”€β”€ cmdb_lookup.py           # CMDB chain traversal (CI β†’ Service β†’ App)
β”‚   β”œβ”€β”€ attachment_reader.py     # Azure Document Intelligence extraction
β”‚   β”œβ”€β”€ similar_incidents.py     # 4-signal incident correlation
β”‚   β”œβ”€β”€ semantic_kb_search.py    # Azure AI Search + GPT hybrid KB retrieval
β”‚   β”œβ”€β”€ kb_retrieval.py          # Fallback KB retrieval (no Azure)
β”‚   β”œβ”€β”€ work_note_generator.py   # Structured work note via GPT-4o-mini
β”‚   β”œβ”€β”€ write_notes.py           # ServiceNow PATCH operations
β”‚   β”œβ”€β”€ logger.py                # JSONL audit logging
β”‚   β”œβ”€β”€ emailer.py               # Incident alert emails
β”‚   β”œβ”€β”€ config.py                # Environment variable loading
β”‚   β”œβ”€β”€ llm_client.py            # OpenAI API client with retry logic
β”‚   β”œβ”€β”€ snow_helpers.py          # ServiceNow utility functions
β”‚   β”œβ”€β”€ create_search_index.py   # Azure AI Search index creation
β”‚   β”œβ”€β”€ index_kb.py              # KB article embedding and upload
β”‚   β”œβ”€β”€ learning_loop.py         # Weekly KB gap analysis
β”‚   β”œβ”€β”€ kb_proposer.py           # Word document generation
β”‚   β”œβ”€β”€ email_proposals.py       # KB proposal emails to manager
β”‚   β”œβ”€β”€ email_listener.py        # Manager reply processing
β”‚   └── weekly_run.py            # Weekly cycle entry point
β”œβ”€β”€ prompts/
β”‚   └── v1_work_note.txt         # Work note generation prompt
β”œβ”€β”€ dashboard/
β”‚   └── dashboard.py             # Streamlit analytics dashboard
β”œβ”€β”€ tests/
β”‚   └── eval_classifier.py       # Classifier accuracy evaluation
β”œβ”€β”€ logs/
β”‚   β”œβ”€β”€ pipeline_log.jsonl       # Full audit log
β”‚   └── kb_proposals.jsonl       # Weekly KB proposals
β”œβ”€β”€ docs/
β”‚   └── architecture.md          # Architecture diagram (Mermaid)
β”œβ”€β”€ .env.example                 # Environment variable template
β”œβ”€β”€ requirements.txt             # Python dependencies
└── README.md

Setup

Prerequisites

Installation

git clone https://github.com/jijo09/AIOPs-Project.git
cd aiops-incident-intelligence

python -m venv venv
venv\Scripts\activate          # Windows
# source venv/bin/activate     # macOS/Linux

pip install -r requirements.txt

Environment Variables

Copy .env.example to .env and configure:

# ServiceNow
SNOW_INSTANCE=https://devXXXXXX.service-now.com
SNOW_USER=your.username
SNOW_PASS=your.password

# OpenAI
OPENAI_API_KEY=sk-...

# Gmail
EMAIL_FROM=[email protected]
EMAIL_APP_PASS=xxxx-xxxx-xxxx-xxxx

# Azure AI Search
SEARCH_ENDPOINT=https://your-search.search.windows.net
SEARCH_KEY=your-search-key

# Azure Document Intelligence
DOC_INTEL_ENDPOINT=https://your-doc-intel.cognitiveservices.azure.com
DOC_INTEL_KEY=your-doc-intel-key

Azure AI Search Setup

Run once to create the vector index and upload KB article embeddings:

python pipeline/create_search_index.py
python pipeline/index_kb.py

Running the Pipeline

# Process all new incidents
python -m pipeline.pipeline

# Weekly KB learning cycle
python -m pipeline.weekly_run

# Process manager replies to KB proposals
python -m pipeline.email_listener

# Launch analytics dashboard
python -m streamlit run dashboard/dashboard.py

# Evaluate classifier accuracy
python -m tests.eval_classifier

# Test attachment extraction
python -m pipeline.attachment_reader

Pipeline Steps β€” What Each File Does

File Purpose
fetch_incidents.py Pulls New/In-Progress incidents from ServiceNow via REST API
source_detector.py Detects monitoring tool vs human-submitted incidents
classifier.py Fetches live category/subcategory from ServiceNow sys_choice table at runtime. GPT-4o-mini selects the closest match β€” no hardcoded taxonomy
cmdb_lookup.py Traverses cmdb_rel_ci to build the full CSDM chain β€” CI β†’ Service Instance β†’ Business Application β†’ Support Group
attachment_reader.py Downloads incident attachments from ServiceNow, sends to Azure Document Intelligence prebuilt-read model, returns extracted plain text
similar_incidents.py Four-signal correlation: same CI (alert dedup), CMDB neighbours, same service instance, 30-minute time window. GPT assesses genuine vs coincidental
semantic_kb_search.py Azure AI Search vector query narrows to top 3 candidates by category, GPT re-ranks and picks the best match
work_note_generator.py Builds structured work note using classification, CMDB chain, KB content, related incidents, and attachment text
write_notes.py PATCHes ServiceNow incident with work note, category, subcategory, AI suggestion status
emailer.py Sends alert email to L1 team via Gmail SMTP
logger.py Appends JSONL entry to pipeline_log.jsonl for every incident processed

Key Design Decisions

Dynamic taxonomy β€” no hardcoded categories Categories and subcategories are fetched live from ServiceNow's sys_choice table at runtime. Adding a new category in ServiceNow is automatically reflected on the next run.

Hybrid semantic KB retrieval Azure AI Search performs vector similarity search filtered by category, returning the top 3 candidates. GPT-4o-mini then picks the best match from those 3. This combines the scalability of vector search with the accuracy of language model re-ranking.

Attachment-enriched work notes Azure Document Intelligence reads any files attached to the incident β€” investigation reports, monitoring exports, screenshots β€” and extracts their text. The AI work note references specific findings from the attachments, such as exact execution times, error codes, and alert IDs.

CMDB traversal by class, not relationship type cmdb_lookup.py identifies parent CIs as Service Instances or Business Applications by checking sys_class_name against known class sets β€” robust to how individual admins set up CMDB relationships.

Infrastructure-aware incident correlation similar_incidents.py uses four signals: same CI (alert deduplication across monitoring tools), CMDB relationship neighbours (switch down β†’ servers affected), same service instance, and 30-minute time window. GPT determines which candidates are genuinely related.

Self-building KB The weekly learning loop identifies resolved incidents with no KB coverage, drafts articles from resolution notes, emails to manager for approval, and publishes on approval. The KB grows from real resolutions automatically.

Soft failures everywhere Every external call is wrapped in try/except with graceful degradation. A failure on one incident never stops the pipeline.


Classifier Performance

Evaluated against 22 real-world IT incident descriptions:

Metric Score
Category accuracy 100% (22/22)
Subcategory accuracy 91% (20/22)
Temperature 0 β€” deterministic

Roadmap

Phase Status Description
Phase 1 βœ… Complete ServiceNow PDI, CMDB data model, 26 KB articles, 31 test incidents
Phase 2 βœ… Complete Core AI pipeline β€” classify, route, CMDB traversal, KB retrieval, work notes
Phase 3 βœ… Complete Human-in-the-loop β€” alerts, Streamlit dashboard, self-building KB
Phase 4 βœ… Complete Portfolio polish β€” documentation, README, architecture diagram
Phase 5 βœ… Complete Azure AI Search β€” semantic vector KB retrieval with GPT re-ranking
Phase 6 βœ… Complete Azure Document Intelligence β€” attachment text extraction enriches work notes

About

Jijo Abraham β€” Technical Systems Analyst at CIBC transitioning into AI engineering.

This project demonstrates practical application of:

  • Enterprise ITSM integration via REST API
  • Retrieval-Augmented Generation (RAG) for IT knowledge management
  • Semantic vector search with hybrid re-ranking
  • Human-in-the-Loop AI governance
  • CMDB-aware routing using ServiceNow CSDM
  • Unstructured document extraction with Azure Document Intelligence
  • Self-improving systems through automated feedback loops

Built entirely outside any employer environment using no company data.

GitHub

About

Enterprise-grade AI pipeline integrating ServiceNow CMDB with Azure OpenAI. Automates incident classification, CSDM-based routing, and KB-grounded resolution using RAG. Features a Human-in-the-Loop approval flow, structured work notes, and automated email alerts to bridge the gap between raw IT data and actionable insights.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages