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.
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.
π 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.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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
| 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) |
| Gmail SMTP + IMAP | |
| Dashboard | Streamlit |
| Language | Python 3.13 |
| KB drafts | python-docx |
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
- Python 3.11+
- ServiceNow Developer Instance (free)
- OpenAI API account
- Gmail account with App Password enabled
- Azure account β AI Search (Free F0) + Document Intelligence (Free F0)
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.txtCopy .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-keyRun once to create the vector index and upload KB article embeddings:
python pipeline/create_search_index.py
python pipeline/index_kb.py# 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| 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 |
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.
Evaluated against 22 real-world IT incident descriptions:
| Metric | Score |
|---|---|
| Category accuracy | 100% (22/22) |
| Subcategory accuracy | 91% (20/22) |
| Temperature | 0 β deterministic |
| 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 |
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.