Skip to main content

09 - Add the 'ServiceNow Create Incident' tool to your agent

In this module we will take the ServiceNow Create Incident workflow and add it as a tool in our Agent Loop workflow.

  1. Return to the list of workflows in the Logic Apps by clicking on the Workflows link at the top of the page

    Return to workflows

  2. Open the demo-conversational-agent workflow

    Open Agent Workflow

  3. Add a new tool.

    • Click on the +

      Add a tool

  4. Search and select the Call workflow in this logic app

    Add Call workflow

  5. Configure the Call workflow in this logic app action

    • Workflow Name - tool-ServiceNow-CreateIncident

    Configure Call Workflow

  6. Configure the Tool activity.

    • NOTE The way you name your tool and provide a description has a significant impact on your Agent Loop (and LLM) will discover and call your particular tool. Provide unique and descriptive terms to improve accuracy during runtime.

    • Rename the tool to Create Service Now Incident

    • Description: This tool will log a ServiceNow Incident

    • Agent Parameters

      for each agent parameter click + Create Parameter

      • Name: Assignment Group

        Type: String

        Description: The Assignment Group in ServiceNow that the ticket should be assigned to

      • Name: Description

        Type: String

        Description: The user provided description of the issue being logged

      • Name: ResolutionSteps

        Type: String

        Description: The steps recommended to resolve the incident

      • Name: Severity

        Type: Integer

        Description: The Severity of the incident

        Configure Tool

  7. Configure the inputs parameters for the call to the logic app.

    NOTE when you select a parameter to configure you will now see a third source for mapping your inputs. The agent indicates a parameter that the agent can provide.

    Agent Parameters

    • Assignment Group: (agent parameter) Agent Parameters-> AssignmentGroup

      Assignment Group Agent Parameter

    • Description: (agent parameter) Agent Parameters-> AssignmentGroup

    • FailureDateTime: utcNow()

    • ResolutionSteps: (agent parameter) Agent Parameters-> ResolutionSteps

    • Severity: (agent parameter) Agent Parameters-> Severity

    Configure Call Workflow Parameters

  8. Save your workflow

    Save Workflow

Test your agent

  1. Click Run to start your workflow and initiate the agent session.

    Run Workflow

    You will receive a notification when the workflow has successfully started
    Workflow Started

  2. Navigate to your Run History and locate your Running instance. Click on the identifier to view the executed steps and agent chat session.

    Workflow Run History

  3. Enter your issue for the agent to take action on:

    Similar to the last execution, the agent has first presented its system instructions and the initial user instruction has been provided resulting in the agent providing more detailed instructions on what it requires and what steps it will take. In the following steps we will provide a similar prompt to the one we tested in Module 7 - Create Agent Loop Workflow but now the agent will have a tool enabling it to log the ServiceNow Incident on behalf of the user.

    • Enter the following prompt:
      my database mysqldev001 appears to be offline  
      Prompt Issue Description

    As per the system instructions, the Assignment Group is required to proceed.

    • Enter the Database in the chat

    Let's review the response....

    • First, the agent details the step by step plan of what it will do

      Agent Response - Part 1 - The Plan

    • Next, the agent retrieves the operational run book, locates the corresponding issue and presents back a more detailed plan with step by step resolution instructions, estimated resolution time and severity

      Agent Response - Part 2 - Operational Runbook Details

    • Finally, the agent will call ServiceNow and create the incident ticket and return the Incident Ticket Number, details that will be included in the ticket and finishes off by providing a list of next steps.

      Agent Response - Part 3 - ServiceNow Incident

  4. Validate your Incident in ServiceNow.

  • Navigate to your ServiceNow developer portal

  • Use the Incident Ticket Number from the Agent's response to search for the incident in ServiceNow

    ServiceNow Incident Details

Note: When you are done testing, go to your workflow run in Logic Apps and click Cancel run to stop the workflow instance.

Tip: If you do not see the Description field in your ServiceNow incident, you may need to configure the Incident Properties in your ServiceNow instance to display it.