Snowflake cortex agent and servicenow knowledge graph integration pattern?
- Time to resolve (min)
- 120 min
- You entered
- Number of incidents
- 10 count
- You entered
This article explains the integration pattern for combining Snowflake Cortex Agent with ServiceNow Knowledge Graph, covering the architecture, data flow, and key considerations. You will learn how to connect these platforms to enable AI-driven insights and automated workflows, with practical steps and common pitfalls to avoid.
Formula
The integration pattern itself doesn’t have a mathematical formula, but the performance metric often used is the average resolution time:
Average Resolution Time = Total Time to Resolve / Number of Incidents
Where:
- Total Time to Resolve (t) is the sum of minutes spent on all incidents.
- Number of Incidents (d) is the count of resolved incidents.
Worked Example
Using the default values from the calculator: t = 120 minutes, d = 10 incidents.
Step 1: Divide the total time by the number of incidents.
120 / 10 = 12 minutes per incident.
The average resolution time is 12 minutes per incident.
Background: Why Integrate Cortex Agent with ServiceNow Knowledge Graph?
Snowflake Cortex Agent is a suite of AI capabilities within the Snowflake Data Cloud, enabling natural language processing, machine learning, and generative AI on data stored in Snowflake. ServiceNow Knowledge Graph is a feature that links related knowledge articles, incidents, problems, and changes, creating a semantic web of IT service management (ITSM) data. Integrating these two platforms allows organizations to leverage Snowflake’s powerful data processing and AI to analyze ServiceNow’s knowledge graph, leading to faster incident resolution, proactive problem management, and more intelligent automation.
The need for this integration arises from the siloed nature of enterprise data. ServiceNow holds operational data, while Snowflake often holds historical, analytical, and external data. By combining them, you can enrich ServiceNow knowledge with data from Snowflake (e.g., past incident trends, customer sentiment, IoT sensor data) and use AI models to generate insights that are not possible within either platform alone.
How the Integration Works
There are two primary integration patterns:
- Data Pipeline Approach: Extract data from ServiceNow (via REST API or ETL tools) into Snowflake, build a knowledge graph using Snowflake’s graph capabilities (e.g., using SQL to join tables), and then apply Cortex Agent models for analysis. The results can be written back to ServiceNow via API.
- Federated Query Approach: Use Snowflake’s external functions to call ServiceNow APIs on-the-fly, or use ServiceNow’s IntegrationHub to call Snowflake’s Cortex Agent endpoints directly. This approach avoids data duplication but may have latency and rate-limit constraints.
In practice, a hybrid approach is common: batch data extraction for heavy analytics, and real-time API calls for immediate actions like recommending knowledge articles during incident creation.
Key Components and Data Flow
The integration typically involves these components:
- ServiceNow Instance: Source of knowledge articles, incidents, and CMDB data.
- Extraction Layer: Tools like Snowpipe, Fivetran, or custom Python scripts that pull data from ServiceNow tables (e.g., kb_knowledge, incident) into Snowflake staging tables.
- Snowflake Data Cloud: Stores the raw data and transformed data. Here you can build a knowledge graph using SQL joins and graph algorithms (e.g., using the GRAPH_ANALYTICS functions in Snowflake).
- Cortex Agent: A set of services including Cortex LLM functions (e.g., COMPLETE, EXTRACT_ANSWER) that can process natural language queries and generate responses based on the data.
- ServiceNow Action Layer: IntegrationHub flows or REST API calls that receive insights from Snowflake and update knowledge articles, create incidents, or trigger automated responses.
The data flow is: ServiceNow → Snowflake → Cortex Agent → ServiceNow (or another downstream system).
How to Choose the Right Pattern
Selecting the right integration pattern depends on several factors:
- Data Volume and Velocity: If you have high-volume, low-latency needs, the federated query approach may be better. For large historical datasets, batch extraction is more efficient.
- Latency Requirements: Real-time recommendations require API calls. Batch analysis can tolerate delays.
- Data Sensitivity: If data must not leave ServiceNow, you may need to use ServiceNow’s own AI capabilities or call Cortex Agent without storing data in Snowflake.
- Complexity of Analysis: If you need complex graph algorithms (e.g., community detection, path analysis), you need the data in Snowflake.
A common misconception is that you must move all ServiceNow data to Snowflake. In reality, you can use Snowflake’s external functions to query ServiceNow live, but this is often slower and may hit API limits.
Common Problems and How to Avoid Them
Several issues arise during integration:
- Data Mapping Errors: ServiceNow field names and types may not align with Snowflake. Use a schema mapping tool and test with sample data.
- API Rate Limits: ServiceNow has API rate limits. Implement pagination and exponential backoff in your extraction scripts.
- Security and Permissions: Ensure that only authorized users can access the data. Use OAuth for ServiceNow and Snowflake’s access controls.
- Latency in Real-time Calls: If you call Cortex Agent from ServiceNow, the response time may be too long for interactive use. Consider caching or pre-computing common responses.
Another common issue is the quality of the knowledge graph. If the relationships in ServiceNow are not well-maintained, the graph will be incomplete. Clean your data before building the graph.
Comparison with Other Approaches
Alternatives to this integration include:
- ServiceNow Native AI: ServiceNow has its own AI (Now Intelligence) that can answer questions from knowledge articles. This is simpler but limited to ServiceNow data.
- Direct API Integration: Using custom code to call both APIs and process data in an intermediate server. This gives more control but requires more maintenance.
- Using a Data Virtualization Tool: Tools like Denodo can query both ServiceNow and Snowflake without moving data, but they add complexity.
The Snowflake + ServiceNow pattern is best when you already use Snowflake as a central data hub and want to apply advanced AI models.
Costs and Considerations
Costs include Snowflake compute credits for data processing and Cortex Agent API calls, ServiceNow API usage, and ETL tool licensing. There are no fixed prices; costs depend on data volume and frequency. To manage costs, set up data pipelines to run during off-peak hours and use Cortex Agent’s serverless features that charge per request. Also, consider using Snowflake’s caching to avoid repeated processing.
Safety and Security
Data privacy is critical. Ensure that sensitive data is encrypted in transit and at rest. Use Snowflake’s data masking and row-level security to restrict access. For ServiceNow, use OAuth tokens with minimal scopes. Never store credentials in code; use secret management. Also, be aware of regulatory requirements like GDPR if you are processing personal data.
Frequently Asked Questions
Can I use Snowflake Cortex Agent without moving ServiceNow data?
Yes, you can use Snowflake external functions to call ServiceNow APIs and process the response in Snowflake, but this is not real-time and may be slow. For frequent queries, it’s better to replicate the data.
What is the best way to build the knowledge graph in Snowflake?
Start by loading ServiceNow tables (knowledge, incident, cmdb_ci) into Snowflake. Then create a graph using SQL joins on common fields like ‘category’ or ‘cmdb_ci’. You can also use Snowflake’s GRAPH_ANALYTICS functions for more advanced graph algorithms.
How do I handle data updates from ServiceNow?
Use incremental loading with timestamp columns (e.g., sys_updated_on). Schedule a Snowflake task to run every few minutes or hours to pull new changes. For real-time updates, consider using ServiceNow’s webhooks to trigger Snowflake tasks.
Is there a risk of data leakage between the two systems?
Yes, if not properly secured. Use separate schemas in Snowflake for ServiceNow data, and apply row-level security based on user roles. When calling ServiceNow APIs, use OAuth with specific scopes to limit access.
Can I use Cortex Agent to generate knowledge articles automatically?
Yes, you can use Cortex LLM functions to draft articles based on incident data, but you should have a human review them before publishing to ensure accuracy.
Related
Formula used
in t | Time to resolve (min) | min | 120 | 0 in d | Number of incidents | count | 10 | 0 out avg | Average resolution time | min/incident | t / d | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.