- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Tuesday
Knowledge Graph is an intelligent layer that allows for the ability to query and explore data sets and schemas, all powered by AI search and LLM capabilities of the platform.
Prerequisites
For this example, I have the following activated on my instance:
- Now Assist AI Agents [sn_aia] 7.1.30
- Knowledge Graph [sn_kg] 7.1.2
- AI Search activated
Knowledge Graph Setup
Login as a Knowledge Graph (KG) admin. You will need the sn_kg.kg_admin role.
Go to Knowledge Graph > Knowledge Graph Designer:
In this example, we’re going to focus on ITSM. I’m going to use the Enterprise Graph as a pre-built starting point.
Under Enterprise Graph go to New tag. Tags allow us to create smaller groupings of the Enterprise Graph that allows us to focus our queries on a subset of the overall Enterprise Graph:
Under Create New Tag, fill in the fields as follows:
Tag name: ITSM
Description: ITSM-related tables
Tables:
- Change Request [change_request]
- Change Task [change_task]
- CI Relationship [cmdb_rel_ci]
- CIs Affected [task_ci]
- Configuration Item [cmdb_ci]
- Group [sys_user_group]
- Incident [incident]
- Incident Task [incident_task]
- Problem [problem]
- Problem Task [problem_task]
- SLA Definition [contract_sla]
- Task SLA [task_sla]
- User [sys_user]
Select Next at the bottom.
In the Configure Tables step, no changes are needed for now. You can always come back and add Table Synonyms, Table Instructions, and Column-specific configuration later.
Select Create Tag to finish.
Your ITSM Tag should now be created:
Select your ITSM Tag. Take a look at the visualization (apologies, I know it’s a little hard to see here):
Select Test Schema in the top-right. This will allow us to try the Knowledge Graph with a natural language query.
For CI Relationships
If you want to use your Knowledge Graph to explore CI relationships (as they relate to cmdb_rel_ci), then set the following system properties (Knowledge Graph application scope) to true:
- sn_kg.description_generation.enable.cmdb_rel_ci
- sn_kg.query.enable_cmdb_rel_ci
Knowledge Graph Testing
Here’s a sample query for a multi-table hop:
Incident [incident] > Configuration Item [cmdb_ci] > Affected CI [task_ci] > Change Request [change_request]
List all Change Requests with a Configuration item set that is also the Affected CI on Incident INC0010074
Note that in the past, with traditional platform tools and features, this may have been implemented as a complicated report created against Database Views. We skip almost all of the schema/relational setup with Knowledge Graph.
AI Agents
With Knowledge Graph capabilities available and known, let’s say I want to use it in the context of my ServiceNow AI agents. I can create an AI agent in ServiceNow that can execute the Knowledge Graph queries as a Tool.
There’s two ways that I’ll frame the use cases:
- AI agent configured for Knowledge Graph, where a human inputs the objective/query
- AI Agent configured with Knowledge Graph query baked into the instructions
AI Agent Setup for Knowledge Graph, where a human inputs the objective/query
Here’s a sample agent configuration setup.
AI agent name:
ITSM Query Agent
AI agent description:
Designed for IT support staff and end users, this agent queries ITSM data to address needs such as incident status, change request details, and related management tasks. It streamlines access to ITSM records, supports decision-making, and enhances user experience by delivering precise information and updates.
AI agent role:
Acts as an intelligent assistant for IT Service Management by retrieving, analyzing, and presenting data related to Incident and Change Management. The agent interprets user requests, queries relevant ITSM records, and provides actionable insights or updates. It communicates in a clear, concise, and direct manner, ensuring users receive accurate and timely information about incidents, changes, and related ITSM processes.
List of steps:
# Section 1: Incident Management
1. Receive the user's request regarding incidents or change management.
2. Identify if the request pertains to an incident or a change request.
3. If the request is about an incident, extract the incident number or relevant identifier from the user input.
4. Query the ITSM database for incident details using the extracted identifier.
5. Present the incident details to the user.
6. If additional information is needed, fetch related knowledge articles or known error articles for the incident.
7. Display the related articles or summaries to the user.
# Section 2: Change Management
1. If the request is about a change request, extract the change request number or relevant identifier from the user input.
2. Query the ITSM database for change request details using the extracted identifier.
3. Present the change request details to the user.
4. If the user requests to update planned start or end dates, update the respective fields in the change request.
5. Confirm the update to the user.
# Section 3: User Context
1. Retrieve user context and incident history if needed to personalize responses.
2. Display relevant user or device information when it adds value to the response.
AI Agent Tool Setup
Select knowledge graph: Enterprise Graph (Small)
Name: ITSM data query
Tool description: Query for ITSM data using the ITSM tag of the Enterprise Graph
Tags: ITSM
Execution mode: Autonomous
Display output: false
The Tool should look like this afterwards:
AI Agent Testing
Here’s an AI agent objective for a basic query of Change Requests:
List all Change Requests with an Actual close date that is at or less than 30 days from the time in which INC0010024 was opened.
Also, we can try an AI agent objective that’s the same as the earlier Knowledge Graph Schema Test, where we do a couple table/data point hops between starting point and landing spot:
List all Change Requests with a Configuration item set that is also the Affected CI on Incident INC0010074
One more example, with a CI Relationship query:
Show me all CI relationships for lnux100 where it is the child Linux Server.
Following up on this conversation output:
Find all Change Requests related to any of these CIs
AI Agent configured with Knowledge Graph query baked into the instructions
Here’s a very basic AI agent configuration for a situation where the Knowledge Graph query needs to be a part of the AI agent instructions.
AI agent name: Related Change Request Agent
AI agent description: This Agent is able to locate related Change Requests of a given Incident, using the Incident's Configuration Item (CI) relationships.
AI agent role: You are an expert at finding related Change Requests of any given Incident based on Configuration item relationships.
List of steps:
# Procedure
1. Identify the given Incident number.
2. Find all Change Requests with a Configuration item set that is also the Affected CI on Incident.
3. Summarize and display the Change Request output.
AI Agent Tool Setup
Select knowledge graph: Enterprise Graph (Small)
Name: ITSM data query
Tool description: Queries for Change Requests related to Incident based on Configuration item (CI)
Tags: ITSM
Execution mode: Autonomous
Display output: false
AI Agent Testing
Here’s an example of executing the AI agent where the Knowledge Graph query is baked into the AI agent instructions. Note that I am not entering them into the AI agent’s objective at invocation, such as in the above example:
Find related Change Requests of INC0010074
You can see that the AI agent instructions were used to drive the Knowledge Graph to determine how to frame the query for what constitutes a “related” Change Request to the given Incident.
Recommendations
- Try a pre-built Knowledge Graph first. If you need to make changes, copy it. Make sure you pay attention to application scope.
- If you don’t know where to start, start with the Enterprise Graph, and try some basic queries.
- If you’re using Enterprise Graph, use Tags wherever possible to have more predictable results, refined outputs, and improved latency.
- Test queries in Knowledge Graph Designer first, before using as instructions in AI Agents.
- Consider your migration path to production. You’ll want to test your Knowledge Graph configuration in a sub-production environment, with as close to production data as possible, before any deployment.
Things to keep in mind
- At least for today, Knowledge Graph is not a replacement for learning and understanding the ServiceNow table schema.
- In addition, Knowledge Graph will not auto-magically figure out what relationships you are trying to connect. Your queries must still connect the dots using natural language. Refer to the resources below for valid and invalid examples.
Resources
- 127 Views
