Maximizing code reuse with topic blocks

  • Release version: Xanadu
  • Updated November 7, 2024
  • 3 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Maximizing code reuse with topic blocks

    Topic blocks in Virtual Agent are reusable components designed to execute common tasks or conversational elements within multiple conversation topics. They enable ServiceNow customers to simplify and standardize topic authoring and maintenance by reusing shared procedures or actions across different conversations, enhancing efficiency and consistency.

    Show full answer Show less

    How Topic Blocks Work

    • Topic blocks function as subflows performing specific actions or tasks within a conversation topic, such as creating or retrieving records.
    • They are created and managed via Virtual Agent Designer, where you can set properties, define control nodes, test, preview, and publish them.
    • Unlike full topics, topic blocks are not discoverable through large language models, Natural Language Understanding (NLU), or keywords; they are only accessible when invoked by a calling topic.
    • Topic blocks can be nested by calling other topic blocks, but cannot call themselves to avoid infinite loops, which Virtual Agent detects and terminates automatically.

    Pre-built Topic Blocks

    ServiceNow provides several pre-built topic blocks within the Virtual Agent platform and applications. Customers can duplicate and customize these topic blocks as needed. Examples include:

    • Transfer to Live Agent: Transfers conversations to live agents.
    • Survey: Collects user feedback via surveys.
    • Geolocation: Captures user location data.
    • Pause: Inserts timed pauses in conversations.
    • Deflection: Tracks deflection metrics.
    • Contextual Search: Returns search results like knowledge articles or catalog items.

    These blocks are included with specific plugins such as the Glide Virtual Agent plugin and Service Management Virtual Agent Topic Blocks plugin.

    Using Virtual Agent Designer

    • Virtual Agent Designer allows customers to create, publish, and manage topic blocks.
    • With the Now Assist Topics skill enabled, an updated UI allows filtering and viewing only topic blocks for easier management.
    • Once published, topic blocks are available as utilities to be added to calling topics or other topic blocks, enabling modular and maintainable conversation design.

    Practical Steps for ServiceNow Customers

    • Create: Build reusable topic blocks to encapsulate common functions in Virtual Agent conversations.
    • Add: Insert these topic blocks into calling topics or other topic blocks, specifying necessary inputs and handling outputs.
    • Maintain: When updating published topic blocks, Virtual Agent Designer notifies you of potential impacts on calling topics, helping you manage dependencies and ensure smooth updates.

    By leveraging topic blocks, ServiceNow customers can maximize code reuse, reduce duplication, and streamline the development and maintenance of Virtual Agent conversations, leading to more efficient and scalable chatbot implementations.

    Topic blocks are reusable components that you can create to run common tasks and conversational elements in Virtual Agent conversations. Topic blocks simplify the topic authoring and maintenance process by enabling you to reuse standard procedures or actions across conversation topics.

    How reusable topic blocks work

    A topic block is basically a subflow that performs certain actions or conversational tasks in a topic. For example, you can build a topic block that creates or retrieves certain types of records. You create topic blocks with Virtual Agent Designer, similar to the way that you build conversation topics. With Virtual Agent Designer, you can do the following:
    • Set topic block properties.
    • Define the controls (nodes) used in the block.
    • Test or preview the block.
    • Publish the block to make it available for use in topics or other topic blocks.

    Unlike topics, topic blocks are not discoverable by a large language model (LLM), Natural Language Understanding (NLU), or keywords. The topic block's functionality can only be accessed by a topic.

    A conversation that uses (consumes) a topic block is referred to as the calling topic. A topic block can call another topic block, but it cannot call itself. You can "nest" topic blocks in this manner, even if the flow returns to the initial topic, as in this example:

    Figure 1. Chain of nested topic blocks
    Topic Block 1 calls TB 2, which in turn calls TB 3. Topic Block 3 can then call Topic Block 1 again.
    Note:
    If Virtual Agent detects an infinite loop, the conversation ends.

    The Virtual Agent platform and applications provide pre-built topic blocks for common tasks or subflows. You can use these pre-built topic blocks in your conversation topics "as is" in the appropriate application scope by duplicating them. You can then customize these pre-built topic blocks as needed. Some of the common topic blocks include the following.

    Table 1. Examples of pre-built topic blocks
    Pre-built topic blocks Application scope
    • Transfer to Live Agent: Transfers a bot conversation to a live agent.
    • Survey: Presents a survey for collecting feedback for an agent.
    • Geolocation: Gathers information about the user's location.
    • Pause: Insert a pause (in seconds) in the conversation.
    • Deflection: Tracks deflection metrics for the Virtual Agent.
    Global. Provided with the Glide Virtual Agent plugin (com.glide.cs.chatbot).
    Contextual search: Uses a search phrase to return search results in a card format, such as knowledge articles and catalog items.

    Common topic block used by the CSM, HR Service Delivery, and ITSM business applications. Provided with the Service Management Virtual Agent Topic Blocks plugin (com.glideapp.cs.sm_topic_blocks). This plugin is included with the Virtual Agent conversation plugins for these business applications.

    Note:
    An updated Virtual Agent Designer user interface is available when you install Now Assist in Virtual Agent and turn on the Now Assist Topics skill. This content assumes that you have activated this skill and can see the list view. If this skill is not enabled, you will see the legacy UI and topics page. For more information, see Virtual Agent Designer legacy topics page.

    Use the Type filter to list and view only topic blocks.

    Figure 2. List of topic blocks in the home page
    Use the Type filter to specify Topic Blocks to view only topic blocks on the Topics page in Virtual Agent Designer.

    After you create and publish a topic block, the block is available for use as a Topic Block utility in Virtual Agent Designer. You can add the topic block to a calling topic or to another topic block. In the following example, the calling topic uses the Contextual Search topic block.

    Figure 3. Example of contextual search topic block in a calling topic
    When a topic calls the Contextual Search topic block, the conversation flow contained in the topic block executes.

    What to do next

    Working with topic blocks involves the following steps:
    1. Create a reusable topic block.

      Build a conversation component that performs a common function that can be reused in Virtual Agent conversations.

    2. Add a reusable topic block to a calling topic or topic block.

      To run a specific subflow, add a reusable topic block to a calling (parent) topic or topic block. Specify the inputs that are used in the topic block and review outputs that are returned from the topic block.

    3. Maintain topic blocks and associated calling topics (as needed).

      When you update a published topic block, Virtual Agent Designer performs certain checks. Displayed messages inform you of changes that you may want to make to calling topics that use the updated block.