Building Topics with Inputs & Outputs in Copilot Studio

There have been a lot of updates to Copilot Studio recently! During the Power Platform Community Conference Microsoft announced a lot of new features, but there were some other things that went unnoticed or were not mentioned. Maybe you’ve noticed that Copilot’s responses are A LOT faster then they used to be? That is absolutely correct! Microsoft made some great improvements which is why you are seeing this! Another feature that wasn’t noticed during the conference is one that came out a few months ago and I am super excited about it, because it will make our lives as topic authors or Agent builders (whatever you want to call it!) a lot easier! Remember that previously when we created topics in Copilot Studio, we would use the authoring canvas to insert several messages, questions, etc.? This would also restrict us a bit, because if the user who is chatting with the Agent needed to make a change to their answer, they were not able to! So, these things are changing with this new feature! First of all, we won’t need to build out all these question nodes in a topic because we can now use the Inputs for a topic, and secondly, users who interact with the Agent can now change the answer to a question if needed! An important thing to note is that this feature only works if you enabled the ‘Generative (preview)’ setting for your copilot. You can do this by clicking on the settings button in your Agent and navigating to ‘Generative AI’.

Legacy Topics

To show you the difference between topics had have multiple question notes and this new feature, you have to understand how topics were built previously. In this example I created a topic that will help customers reserve a table at my restaurant. In the topic we ask the user to give us a reservation date, provide us with the number of people the reservation is for, the name the reservation should be under, and an email address to send the confirmation to. If needed, we can use PowerFX formulas or conditions to restrict the answers a bit. For example, you probably don’t want the customer to be able to pick a reservation date that is in the past. Another good example of a restriction is to be able to restrict the number of folks the reservation is for. You probably don’t want the customer to be able to pick more than 10 people for their reservation, if your largest table at the restaurant can hold up to10 people. Below is an example of what the topic looks like, including the configuration for the restriction I just mentioned. As I said before, if I enable and test this topic, the customer will not be able to change any of the answers to the questions while chatting with Copilot. Let’s say they need to change the number of people from 6 to 8. Sorry, once the customer entered the number 6, they cannot change their answer!

Input Topics

Input topics as I call them (for lack of a better word!), are configured differently. With inputs you don’t need to configure questions, because the input variables are used to process the user input. What that means is that you will describe what the input variable is used for, and the AI inside of the Agent will be smart enough to figure out what data it needs to collect. That means it will come up with the questions it needs to add in order to get the right answers. Let’s take a look at how to configure this. I am going to create a new topic, using the same scenario as above. I click on ‘Topics’ to navigate to the topics section. Then I click the ‘+ Add a topic’ button and select ‘From Blank’. I name my topic ‘Restaurant Reservation with IN/OUT’. You’ll notice because this Copilot has ‘Generative (preview)’ enabled, that the trigger that shows up is called ‘Triggered by copilot (preview)’. This means that the orchestrator inside this Copilot will determine when this topic is called. This is also the reason why you need to enter a description on what this topic is really supposed to do, as this is what the orchestrator will look at when deciding which topic/action/knowledge to pick. In the description I enter: ‘This topic is used for customers to make a reservation at our restaurant.’ I then save the topic and click on the details button on the top right side of the screen. This opens the topic details window. I click on ‘Input’ to start configuring the data points I want Copilot to collect. Click on ‘New Variable’. This is similar to what you’re seen in topics before. This will store information the customer entered. I will call my first variable ‘Name’. Now this is a bit different from how we previously built a topic. We don’t have to enter a question there; we only enter the information this variable is representing. Make sure you use a good description so Copilot knows what to ask for and what to look for when an answer is entered. I leave most of the values as-is, I only enter ‘The name the reservation should be under’ in the description. I then enter another variable called ‘Email’. The description here is ‘The email address we can send the confirmation to’. The next variable is called ‘PartySize’, and here I change the variable data type to ‘Number’. This is because I want to configure the same restriction I had on my question node in the other topic. For the description I enter: ‘The total number of people that are included in this reservation.’

I scroll down and expand the ‘Additional settings’ for this variable. This is where you can configure prompts and conditions. I scroll down until I get to ‘Additional entity validation’. I enter the ‘PartySize’ variable and set the condition to ‘is less than or equal to’. Below the condition I enter 10. I add a second condition by clicking on the ‘+New Condition’ button and enter the same variable again (PartySize), setting the condition to ‘is greater than or equal to’ and entering 1 below the condition. Under the ‘Condition not met prompt’ I enter: ‘Although our portions are huge, our dining room is small; we can only accommodate up to 10 people. Please select a different number.’ What this means is that if the number that the customer enters here is more than 10 or less than 1, the Agent will show the ‘condition not met prompt’, saying :’Although our portions are huge, our dining room is small; we can only accommodate up to 10 people. Please select a different number.’ Lastly I enter another variable called ReservationDate, which I set to be a Date variable type. The description I enter shows: ‘The date of the reservation’. We will need folks to enter the actual date for which the reservation is. You can add some logic here too by using a PowerFX formula so that people can’t enter a date that is in the past. You can do this by entering the condition that reads ‘ReservationDate is greater than DateTimeValue(Now())’.

Output Topics

As you probably already noticed, the topic also has something that is called ‘Output Variables’. These are used for the topic to process the output to the customer. Unfortunately, there is no option to have the topic automatically respond to the customer, I added an output variable that is called ‘ReservationConfirmation’. I will use this in a message to communicate the confirmation back to the customer. In the description I enter: ‘Reservation confirmation for the customer including details like: name the reservation is under, reservation date, party size and email address.’ so that the Agent understands what type of information I want to store in this variable. Below the trigger in the topic, I enter a message, and then I click inside the message and on the ‘Insert Variable’ button to insert the variable inside of the message. This should give the customer a confirmation message with all the data that was entered previously.

Test your topic!

Before you start testing your topic, make sure you turn the conversion map on. This will allow you to see what the orchestrator is doing and it will show you the data that is collected in the variables. You can do this by clicking on the ‘Test’ icon, which will open the Agent side pane, and clicking on the little map icon on the top of the screen. To test my topic, I enter: ‘I want to make a reservation.’ The Agent understands what I am trying to do and starts asking me for details of the reservation, like how many people will be included in the reservation. When I enter the number 200, the Agent is showing the message IUs configured earlier: ‘Although our portions are huge, our dining room is small; we can only accommodate up to 10 people. Please select a different number.’ I enter the number 8, then wait for a response from the Agent and then enter: ‘Oh no please change it to 6’. I would like to see some type of confirmation here, to make sure the Agent noticed the change of party size, but that’s not happening at this time. However, after I answered the remaining questions and receive the confirmation, I did notice that the party size was updated from 8 to 6! Pretty amazing right?! As you can see Microsoft is heavily investing in Copilot Studio, and with features like these, building Agents becomes a lot faster! I can’t wait to see what’s next! I hope you enjoyed this article! Be sure to check in again next week for a new article or subscribe here to never miss another post!

Share this!

Comments are Closed