How to re format incident description

User687957
Tera Expert

Dear all,

I have setup a Twilio voice agent which is capable of creating an Incident based on a voice agent conversation

The voice agent is asking some question and then based on my reply send the conversation in the incident description as seen below

MCpAWDgeL9.png

As you can see from description field, the question and answer are formated strangely.
What I would prefer is to have a summarize of the conversation and points discuss enumerated as bullet point or other natural information by avoiding Question = Answer

I am using for that the OOTB "Create incident with voice AI agent"  which is an Action ITSM which is refered from configuration

What I would like to do is that :
- incident desciption is written in a different way before creating the incident ( prompt adjust maybe)
- Incident category and Subcategory set correctly according to conversation
- Incicent impact and Urgency set corrcetly as well
- Incident chanel should be set to Voice Agent

Any idea how should I update the Ai Agent to reflect my change ?
Do I need to add some extra tool which does this OOTB ?
Do I need to update the prompt at some point ?

I have notice that when I click on this voice Agent I do not see how to adjust or add tools if needed and Test it before publishing. It is done in a form of different way than Skill 


Any idea how to do to reach my goal?

4 REPLIES 4

Naveen20
ServiceNow Employee

1. Update the Agent Instructions (steps/prompt) in AI Agent Studio with something like:

"Before creating an incident, rewrite the conversation as a professional summary paragraph followed by bullet points of key details (issue, onset, errors, scope). Never use Question/Answer format. Classify the incident category, subcategory, impact (1-3), and urgency (1-3) based on the conversation context. Always set contact type to Voice Agent."

2. Create one custom "Create Incident" tool in Flow Designer that accepts all the fields — short_description, description, category, subcategory, impact, urgency, and contact_type. Replace the OOTB action with this tool on your agent.

This way the LLM handles the summarization and classification through the prompt, and your custom tool ensures all fields are actually written to the incident record. The prompt alone can't set fields that aren't exposed as tool inputs — that's why you need both.

Open the agent from now/agent-studio/create-manage (not the Voice config form) to get full access to tools, instructions, and the test panel. 

Hello @Naveen20 , thnaks for your reply.

What do you mean exactly by "Create one custom "Create Incident" tool in Flow Designer that accepts all the fields — short_description, description, category, subcategory, impact, urgency, and contact_type"

 

Which type of tool ? Flows,subflows,actions ?
The current OOTB Create incident is an Action

I do not see how to create the tool you mentionned and how will it perfrom the job compare to the default one Action.
can you draft sample ? sorry I am learning

Do you meand duplicating the "Create Incident flow action" and add the Channel type ? 
akX49VHJYZ.png


The current parameters and prompt for the tool is as below

chrome_4oIGrySdYn.png

    Tool desription is set as below for LLM :
 "

Use this to create a new incident record with the details provided by the user.

Input mapping:
- incident_short_description: the caller’s stated issue (one sentence)
- incident_urgency: use caller-provided urgency if given (1=High, 2=Medium, 3=Low). If none is given, infer from severity; if insufficient info, default to 3=Low. Never ask for an urgency rating
- conversationId: the current call's conversation id

incident_description:
- Send a concise list of any follow-ups at creation time only, one new line per question in this format: Question: (your question) Answer: (user's answer)
- Ask at most 3 targeted follow-ups for complex issues; fewer or none for simple issues
- Ask one question at a time
- If the user doesn’t know or declines to answer, acknowledge and move on
- Do not troubleshoot; only gather information"

Thanks for clarification

 

Regards

Naveen20
ServiceNow Employee

 

In AI Agent Studio, a Tool = an Action (from Flow Designer). Not a Flow, not a Subflow — specifically an Action. The OOTB "Create incident with voice AI agent" is already an Action, so you're creating a custom Action that does the same job but with more input fields.

Why Not Just Edit the OOTB Action?

You should never modify OOTB actions directly — upgrades will overwrite your changes. Instead, you create your own scoped Action that does the same thing but better.

How the Custom Action Works vs. OOTB

The OOTB action likely accepts only short_description and description. Your custom action will accept all the fields you need, and internally it just does a GlideRecord insert on the incident table — the same thing the OOTB does, just with more fields mapped.

Step-by-Step: Create the Custom Action

Step 1 — Create the Action in Flow Designer

  1. Go to Flow Designer 
  2. Click New → Action
  3. Name it: Create Incident from Voice Agent
  4. Set the Application scope to your scoped app (or Global if needed)
  5. Click Submit

Step 2 — Define the Inputs

In the Inputs section of the Action, add these inputs:

Input Name Type Mandatory
short_description String Yes
description String Yes
category String No
subcategory String No
impact String No
urgency String No
caller String No

These are what the AI Agent (LLM) will populate based on the conversation.

Step 3 — Add a Script Step

In the Action, add a step: Script Step

(function execute(inputs, outputs) {

    var gr = new GlideRecord('incident');
    gr.initialize();

    // Set fields from AI Agent inputs
    gr.short_description = inputs.short_description;
    gr.description = inputs.description;

    // Category and Subcategory
    if (inputs.category) {
        gr.category = inputs.category;
    }
    if (inputs.subcategory) {
        gr.subcategory = inputs.subcategory;
    }

    // Impact and Urgency (expect "1", "2", or "3")
    if (inputs.impact) {
        gr.impact = inputs.impact;
    }
    if (inputs.urgency) {
        gr.urgency = inputs.urgency;
    }

    // Hardcode channel to Phone (or your custom voice agent value)
    gr.contact_type = 'phone'; 
    // Check sys_choice for 'incident.contact_type' on your instance
    // for the exact value — might be 'virtual_agent' or custom

    // Caller - if passed from the agent
    if (inputs.caller) {
        var userGr = new GlideRecord('sys_user');
        if (userGr.get('user_name', inputs.caller) || 
            userGr.get('email', inputs.caller)) {
            gr.caller_id = userGr.getUniqueValue();
        }
    }

    var incSysId = gr.insert();

    // Set outputs
    if (incSysId) {
        gr.get(incSysId);
        outputs.incident_number = gr.number.toString();
        outputs.incident_sys_id = incSysId;
        outputs.success = true;
        outputs.message = 'Incident ' + gr.number + ' created successfully.';
    } else {
        outputs.success = false;
        outputs.message = 'Failed to create incident.';
        outputs.incident_number = '';
        outputs.incident_sys_id = '';
    }

})(inputs, outputs);

Step 4 — Define the Outputs

In the Outputs section of the Script Step, add:

Output Name Type
incident_number String
incident_sys_id String
success True/False
message String

Then in the Action Outputs section, map these same four outputs so they're returned to the AI Agent.

Step 5 — Publish the Action

Click Publish on the Action.

Step 6 — Add it as a Tool in AI Agent Studio

  1. Go to AI Agent Studio 
  2. Open your Voice Agent
  3. Go to the Tools section
  4. Remove (or deactivate) the OOTB "Create incident with voice AI agent" tool
  5. Click Add Tool → Action and search for your new Create Incident from Voice Agent action
  6. Select it — the inputs you defined will automatically become the tool's parameters that the LLM can populate

Step 7 — Update Agent Instructions

Add this to your agent's system prompt so the LLM knows how to use the new tool properly:

When creating an incident, follow these rules:

1. Description: Summarize the conversation as a professional paragraph. Then list key details as bullet points (issue description, when it started, any error messages, what was tried). Never use Question/Answer format.

2. Category and Subcategory: Determine from the conversation. Use valid ServiceNow incident categories such as: Network, Hardware, Software, Database, Inquiry/Help. Match subcategory accordingly (e.g., Category=Network, Subcategory=VPN, or Category=Software, Subcategory=Email).

3. Impact: 1=High (entire department/company affected), 2=Medium (multiple users), 3=Low (single user).

4. Urgency: 1=High (work cannot continue), 2=Medium (work degraded), 3=Low (inconvenience).

5. Always pass the caller's name or email if identified during the conversation.

Step 8 — Test

Use the Test panel in AI Agent Studio to simulate a voice conversation. Verify that the LLM passes the correct values to your custom tool and that the incident record is created with all fields populated.

 

Hello @Naveen20 , thanks for the detail understand better now.

Now based on the testing of my Ai agent , it does not appears in the Testing Tab as a Ai Agent in list

oVWo1Vm1Sm.png

While it is listed theire

V14YDYEHmj.png

 

Did I miss something ?

regarsd