Skip to main content

ServiceNow document loaders for LangChain - sync and async loaders for Incidents, CMDB, KB, Changes, Problems, Catalog, and Attachments.

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.2.0.tar.gz (4.0 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.2.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_snowloader-0.2.0.tar.gz
  • Upload date:
  • Size: 4.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 8a03fb2f9e28605d9735bc8e6ebb0b8b1540bb2a544a7cf26c7fab96e2dc140b
MD5 4c941ec1ff796f020c79506341b9398d
BLAKE2b-256 1c579d1fea4dea828dccd18e601b3ecca0c07d919bac70e114b90edb4a4ae624

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_snowloader-0.2.0.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_snowloader-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cb4f9711bf46b36e1ef955869ec10ee5ac63a235d485bb37d6a9d7e93ad5ba6
MD5 1b7e04dd7ddb7206c5da95f80ae81f33
BLAKE2b-256 59344b450ff1d78e08a37ace11e0a6ca3b75a531880d970c42dc9cc768044776

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_snowloader-0.2.0-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