# State Graph

# What is the State Graph

As mentioned before, a competency is comprised of several parts: Classification Data, Slot Data, States and Transitions. The State Graph is a roadmap of all the possible states and transitions within the competency/competencies of your choice. Now we are going to focus on the states, and how to get them to interact through transitions. A state is any point in the conversation where your AI might want to generate a response. A transition uses classifier and slot data to determine which state to move into.

# Manipulating the State Graph

  1. Assuming you are in the get_balance competency page. The first thing we want to do is navigate to a competency state graph. You can do this by clicking on "State Graph" in the side navigation under the title "Conversational State".
  2. Next, we want to make both of our competencies visible, so go to the "Add/remove competency from view" dropdown and click on account_transfer. You should now see all of the states for the two competencies we have created. As you can see here, we have a root node with two transitions to each of our competencies, however, our competencies aren't linked together.

State Graph You can also navigate to the State Graph which contains all your competencies from "State Graph" under the "Training" tab.

# get_balance to account_transfer (classification)

Once a balance is known, it follows that a user would want to transfer money from that account.

In order to enable our conversation to retain context, we are going to manipulate the state graph to have a transition going from get_balance to account_transfer. To do this,

  1. Click on the get_balance node in the graph.
  2. In the graph editor on the right hand side under "+ Transition" select the transition type "Classification"
  3. Select account_transfer as the destination state.
  4. Click "Create Transition".

Add Classification Transition

  1. In the text box that appears below "account_transfer - classification", type account_transfer_start.

You should now see your new transition appear in the graph connecting get_balance to account_transfer.

# account_transfer_confirmed to get_balance (business logic)

For a successful transfer, it makes sense to also report the new balance on your account.

  1. Click the account_transfer_confirmed node.
  2. Select "Business Logic" under "+ Transition"
  3. Select get_balance as the destination state.
  4. Click "Create Transition"

You should see your new transition connecting account_transfer_confirmed to get_balance.

Business Logic Transition