Skip to main content

ServiceNow document loaders for LangChain - load Incidents, CMDB, KB, Changes, Problems, and Catalog into LangChain Documents.

Project description

langchain-snowloader

ServiceNow document loaders for LangChain, powered by snowloader.

Covers six core ServiceNow tables - Incidents, Knowledge Base, CMDB, Changes, Problems, and Service Catalog - with production-grade features like retry logic, delta sync, CMDB relationship traversal, and HTML cleaning.

Installation

pip install langchain-snowloader

Usage

from snowloader import SnowConnection
from langchain_snowloader import ServiceNowIncidentLoader

conn = SnowConnection(
    instance_url="https://mycompany.service-now.com",
    username="admin",
    password="password",
)

loader = ServiceNowIncidentLoader(connection=conn, query="active=true")
docs = loader.load()  # list[langchain_core.documents.Document]

# Use with any vector store
from langchain_community.vectorstores import FAISS
from langchain_openai import OpenAIEmbeddings

vectorstore = FAISS.from_documents(docs, OpenAIEmbeddings())

Available Loaders

Loader ServiceNow Table Description
ServiceNowIncidentLoader incident IT incidents with optional work notes/comments
ServiceNowKBLoader kb_knowledge Knowledge Base articles (HTML auto-cleaned)
ServiceNowCMDBLoader cmdb_ci Configuration Items with relationship graph traversal
ServiceNowChangeLoader change_request Change requests with implementation windows
ServiceNowProblemLoader problem Problems with root cause and known error tracking
ServiceNowCatalogLoader sc_cat_item Service catalog items

CMDB with Relationships

from langchain_snowloader import ServiceNowCMDBLoader

loader = ServiceNowCMDBLoader(
    connection=conn,
    ci_class="cmdb_ci_server",
    include_relationships=True,
)

docs = loader.load()
print(docs[0].page_content)
# Configuration Item: web-prod-01
# Class: cmdb_ci_server
# ...
# Relationships:
#   -> db-prod-01 (Depends on::Used by)
#   <- load-balancer-01 (Depends on::Used by)

Delta Sync

Only fetch records updated since your last sync:

from datetime import datetime, timezone

loader = ServiceNowIncidentLoader(connection=conn)
docs = loader.load()
last_sync = datetime.now(timezone.utc)

# Next run - only get changes
updated = loader.load_since(last_sync)

Lazy Loading

Stream documents one at a time for memory efficiency:

for doc in loader.lazy_load():
    print(f"[{doc.metadata['number']}] {doc.page_content[:100]}")

Authentication

snowloader supports four auth modes:

# Basic Auth (development)
conn = SnowConnection(instance_url="...", username="...", password="...")

# OAuth Client Credentials (recommended for production)
conn = SnowConnection(instance_url="...", client_id="...", client_secret="...")

# OAuth Password Grant
conn = SnowConnection(instance_url="...", client_id="...", client_secret="...",
                       username="...", password="...")

# Bearer Token
conn = SnowConnection(instance_url="...", token="eyJhbG...")

Author

Created and maintained by Roni Das - thetotaltechnology@gmail.com

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_snowloader-0.1.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_snowloader-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file langchain_snowloader-0.1.1.tar.gz.

File metadata

  • Download URL: langchain_snowloader-0.1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for langchain_snowloader-0.1.1.tar.gz
Algorithm Hash digest
SHA256 47baa238cd21c564738330e2c422f372d532b2c621d0e445aa0c45c1b61e3e84
MD5 901208452b124a445c3a0aa58c90fc0b
BLAKE2b-256 b89157c45aff6494059b06b33a5e4cd1f1e2d23a4198bcffa98a50af0af2a702

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_snowloader-0.1.1.tar.gz:

Publisher: publish.yml on ronidas39/langchain-snowloader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_snowloader-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_snowloader-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f064ba3f4dda7a765bf87ae36cc7e3586c111b469b668296dd3d240b588d3528
MD5 7087bf4873c6106adc2029e6cfdbf437
BLAKE2b-256 3976c2f1463c7c8647d79895e5c530c2ce78c580830844982ad2182291616985

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_snowloader-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ronidas39/langchain-snowloader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page