The CreatorCon Call for Content is officially open! Get started here.

tarek_elkelani
ServiceNow Employee
ServiceNow Employee

What is the problem we are solving?

 

You just came out of a workshop and the requirements have been distilled into stories. You are a developer that is tasked with implementing the stories that came out of this workshop, so you pick a story from the list of stories in the customer's instance. You examine the story to determine the desired outcome and how to configure it, however the story has a lot of information but you don't have the patience to read all of it, so you read the first sentence and start developing. 

 

You get to work, on the instance, starting to configure the story. However, you realize after some time that you haven't created an update set for the story, so you create an update set to capture your changes.

 

When you create the update set, you are not really sure what naming convention the customer is using and you really just want to get back to development so you create an update set with a placeholder name. You also forget to write anything in the description of the update set because who has time to do that.

 

However, later in the development cycle, when it comes to migrating the update set, the system admins cannot track this update set you created and have no idea what it was meant to do, causing delays in creating the migration run book and subsequently delaying deployment in production. 

 

Enter the AI Agents...

However, you don't need to worry about administrative tasks like creating the update set for the story, because now you have AI Agents to do it for you..

 

The AI Agent we are going to create today is going to do the following:

1) Summarize the story using information from the short description, description and acceptance criteria

2) Create an update set with an appropriate naming convention and description, aligned with best practices

 

Demo:

 

Testing Demo:

 

 

Now Assist Panel Demo:

 

 

Implementation

 

Prerequisites:

Xanadu Patch 7+, Yokohama Patch 1+

Now Assist AI Agents Plugin

Agile Development 2.0 Plugin

Now Assist Panel switched on

 

Part 1 - Creating the use case

A good implementation plan to think about when creating AI Agents are the following:

 

  • Why are you implementing the AI Agent? - Use Case
  • How are you implementing the AI Agent? - Individual Agents

 

1) Head over to Now Assist AI Agents > Overview

2) Scroll down to the Use Cases > Click New

tarek_elkelani_2-1741057494877.png

3) This screen will show up. Fill the fields with the following:

 

 

Field Value Explanation
Name Update Set Creator This is the purpose of the AI Agent
Description This use case reads a story's short description, description and acceptance criteria. It will then create an update set in the correct scope with a convention This description is a brief explanation of why this AI Agent is created and gives a high-level summary of what the agent is supposed to do.
Instructions This team is able to analyze the current story record from the rm_story table, looking at its short description, description and acceptance criteria in order to determine how a configuration update set is to be created. Get the information for the story from <story_number>

These are the instructions for the team of agents that are going to be configured (in our case it is just one agent). This should be phrased as  high-level goals for the agent to achieve, and a brief description on how to achieve them.

 

For example, the goal is to create an update set but the way the agent will do it is:

1) Look at the following fields

2) Where to get the information from.

 

 

 

 

    

tarek_elkelani_3-1741057576565.png

 

4) Click Save and continue until you get to the Toggle Display Screen

 

tarek_elkelani_4-1741058795243.png

This makes the ai agent available from Now Assist Panel, so you can run this ai agent from anywhere in the platform as long as you have now assist panel turned on.

 

5) Click save and test

 

Part 2 - Creating the Agent

This part is where you have to use different tools to allow the agent to do its job.

1) Go to the Overview tab, scroll down to the AI Agents tab, click New:

tarek_elkelani_5-1741059436543.png

2) Give the agent a name and a description:

tarek_elkelani_6-1741059504164.png

3) Define the role and instructions for the agent:

tarek_elkelani_7-1741059572594.png

The AI Agent role is critical as it gives context to the agent on how to implement the task, based on who they are supposed to be. This helps the agent understand who the target audience for this agent is intended to be. 

 

Instructions are high level instructions which give an overview of how the task should be completed. The difference between these instructions and the instructions on the use case side, is that the use case instructions are intended for the team of ai agents and define the business goal of the ai agents. These instructions are for the individual AI fulfillers on how to do their job.

 

Adding tools

In order for the AI Agent to do its job, it needs certain tools to be configured, there are many tools you can use to help an AI Agent, located on the dropdown on the top right of the agent.

 

tarek_elkelani_0-1741066097373.png

These are the tools that are being used for this AI Agent

tarek_elkelani_1-1741066171079.png

 

1) Get Details of Story

 

tarek_elkelani_2-1741066301018.png

 

Description: tells the AI what to do with this flow action. More detail in step 2)

Execution mode:

Supervised - The Agent will ask the user for their input to verify their thought process when completing the task.

Autonomous - The Agent will fully take control of this task, user only sees output.

 

Display Output: Display output of agent completing the task

 

Flow action code:

 

 

(function execute(inputs, outputs) {
    var text = "";
    var ctGR = new GlideRecord("rm_story");
    ctGR.addQuery('number', inputs.number);
    ctGR.query();
    if (ctGR.next()) {
        text = "Story Number: " + ctGR.getValue('number') + "\n\n";
        text += "Short Description: " + ctGR.getValue('short_description') + "\n\n";
        text += "Description: " + ctGR.getValue('description') + "\n\n";
        var ac = ctGR.getDisplayValue('acceptance_criteria').replace(/<[^>]*>/g, '')
        text += "Acceptance Criteria: " + ac; 
        outputs.content = text;
    } else {
        outputs.content = "Unable to fetch requested story record.";
    }
})(inputs, outputs);

 

 

2) Create update set from story

 

tarek_elkelani_1-1741066609241.png

Note: edit the system property: sn_flow_designer.allowed_system_tables to include the sys_update_set table before creating the subflow. This also only works in global scope too. All update sets created will be global update sets.

In order to break down the description, you have to understand the subflow:

 

tarek_elkelani_0-1742231741204.png

 

Create Update Set Record

tarek_elkelani_4-1741066749389.png

 

Inputs & Outputs

tarek_elkelani_5-1741066794213.png

All these inputs and outputs are filled in automatically by the AI Agent. This is where you describe how the AI Agents should populate these inputs. In order to increase the chances that the AI will fill in these fields correctly, make sure the variables are named appropriately so that the LLM can understand the input. 

 

Going back to breaking down the description of this subflow in the AI Agent:

 

"Use this subflow to create a record in the sys_update_set table.

The update set's name should be:
Story Number_User Initials_Version Number

The update set's description should be a brief summary of what the story's requirements are based on the details you obtained from the story. Do not include the name of the field you got the information from in the summary.
For example, do not say something like : 'The short description says...'

The output should display the update set's name."

 

 

It is imperative that you use assertive language when describing tasks to the agent, to eliminate as much ambiguity as you can in order to get the most accurate result possible. If you don't know what you want, the agent won't know what you want. 

Use this subflow to create a record in the sys_update_set table. -> Identifies what the subflow is for 

 

The update set's name should be:
Story Number_User Initials_Version Number 

 

This part gives clear instructions on what the name of the update set should be, according to an appropriate name convention. This instruction fills in the update_set_name variable in the subflow. The user initials part will be covered in the get current user initials flow

 

The update set's description should be a brief summary of what the story's requirements are based on the details you obtained from the story. Do not include the name of the field you got the information from in the summary.
For example, do not say something like : 'The short description says...'

 

This is a good example of being assertive to the agent and telling it what to do, and where to get the information from. The summary from the story will then update the description of the update set. This will fill in the update_set_description input of the subflow.  

 

I added in Do not include the name of the field you got the information from in the summary.
For example, do not say something like : 'The short description says...'  as when testing, the agent will sometimes output which fields from the story they are getting the information from, which isn't helpful for a summary and does not sound very realistic. Therefore, I explicitly told the AI not to do this, and it worked great hence reiterating that assertive language is very helpful to use for instructions.

 

The output should display the update set's name. -> This directly tells the agent what to output for the user.

 

3) get user initials

tarek_elkelani_0-1741068413536.png

Description: 

Use this subflow to get the current user's initials. The output is to be used in the update set naming convention: Story Number_User Initials_Version Number. The "User Initials" part of this name should be replaced with the subflow output

 

 

This subflow simply gets the current user's first initial and last initial and concatenates it together. I had to wrap the get user initials action into a subflow as gs.getUser() was having issues in the flow action, as you have to set the flow property Run as: User who initiates session, which is a property only available in Subflows and Flows.

 

User initials code:

 

(function execute(inputs, outputs) {
// ... code ...
var firstInitial = String.fromCharCode(gs.getUser().getFirstName().charAt(0))
var lastInitial = String.fromCharCode(gs.getUser().getLastName().charAt(0))
outputs.user_initials = firstInitial+lastInitial;


})(inputs, outputs);

 

 

Part 3 - Connecting the Agent to the Use Case

 

1) Go back to the use cases list and click on the use case you created.

2) Scroll down to Connect AI Agents:

tarek_elkelani_0-1741068934663.png

 

Click Add AI Agent and select the AI Agent you created.

3) Save and continue

 

Testing the agent

1) Click the testing tab on the top left:

tarek_elkelani_0-1741069064446.png

 

2) test use case with any story that you have (create one if you have to)

This is an example of a test result:

 

tarek_elkelani_1-1741069208663.png

 

 

I hope this was helpful! If there are any questions/concerns, I would love to hear them in the comments.

Comments
SreerajCP
Tera Contributor

Great one. 

 

One question: Can we build an agent that creates an update set in the development instance when a story is marked as ready in production instance?

luffy3478
Tera Guru

@SreerajCPUse a REST step action with the Table API to connect to the dev instance and replicate the activity described in the article.

Joseph Morrison
Tera Contributor

Does anyone know of any US federal agencies that have implemented Gen AI agents? I'm looking for Agentic AI anecdotes to share and the value they bring, particularly given DOGE pressures for efficiency. Joe

lalithkumar
Tera Contributor

great explanation Tarek, can u provide some more agent creations like this if possible 

anubhavkapoor76
ServiceNow Employee
ServiceNow Employee

Great write-up @tarek_elkelani . I was wondering whether this agentic workflow is for global scope ONLY and was planning to roll this out for scoped apps as well.

tarek_elkelani
ServiceNow Employee
ServiceNow Employee

@anubhavkapoor76

 Yes this workflow is for global scope only.

NiaH
Giga Explorer

What’s interesting here is how AI Agents aren’t just assisting but enforcing best practices like naming conventions without slowing developers down.

Version history
Last update:
‎03-17-2025 10:26 AM
Updated by:
Contributors