What's Copilot Studio topic and how to use it effectively?

From this article you'll know:

  • what's topic in Copilot Studio
  • how to use it, depending on your needs,
  • what to avoid regarding topics.


Topic in the context of Copilot Studio is the main building block of a chatbot. It enables you to extend the capabilities of your bot by giving it new ways to interact with the end-user. How to use it effectively? Let me try to answer this question.


Old vs. new

Currently, when we start our chatbot development, we have two ways to perform it:
  • classic approach,
  • generative orchestration approach.

I won't cover pros and cons of each one - you can find it here - but all in all I think for now it's best to stick to the classic one. It has it's advantages like stable outcome, reliable technology and testing capabilities.


Classic topic

Topic in the classic context is being invoked by:
  • trigger phrases: you write "apple" - it invokes the topic. Simple and easy. It can also understand synonyms, so the key is to use the trigger phrases that you expect the user to write.
  • invoking from another topic: you can modularize the chatbot, so that each topic can act as a separate "function", instead of building a monolith.

Thanks to that, your chatbot can we quite flexible in terms of functions that it can perform.

Regarding types of classic topics, we can define two:

  • system topic,
  • custom topic.
System topic in general is, as Microsoft states: "System topics are necessary to help your agent run effectively. Without them, your agent may not work as intended. You can't delete system topics.". So it's a necessary part of your chatbot, without which it wouldn't work correctly. What system topics cover? In general they're defined for the essential parts of the conversation, like start, end, fallback. It makes your chatbot more reliable. We can modify system topics in order to alter the chatbot's behavior, for example:
  • we can alter the "Conversation Start" topic, so that the chatbot sends a different message, when you open it,
  • we can modify "End of Conversation" topic, so that it resets all our global variables values,

etc.

Regarding custom topics, to put it bluntly, it's just a building block that you can freely define as you wish.


How to use topics effectively?

The key to use topics effectively is to modularize your logic. Let's say you have a chatbot which asks a question to the user and, based on the user's choice, it needs to perform some kind of business logic. What usually comes into your mind is to define this logic within the same topic. What about splitting it into smaller parts? How to achieve this, you would ask? It's quite simple! For each condition branch, you can define a separate subtopic and redirect to it. Here's a simple example of this approach:


You can see that I've defined a question with multiple choices and for each choice I've defined a separate topic. It's easier from development perspective to debug, when you use this design approach, because, usually, you don't need to review the whole topic logic - you can just stick to the topic that causes the error. It's also easier to write additional "modules" to already existing functionalities. Why? Because you don't need to modify main topic, instead you can add another "building block" to it.

Summary

I hope that you like the approach that I've proposed above. I think that it'll be a lot easier to develop, debug and monitor chatbots if we'll use this way of development. Any questions, doubts or maybe you have a different opinion? Share it in the comments section!


Artur Stepniak



Mix is the key! About Copilot Studio old and new features

From this article you'll know:

  • what's the best way, in my opinion, to prepare chatbots in Copilot Studio,
  • what features to avoid for now until they get mature.


My last chatbot development went quite well. I've needed to make some design decisions, which I think could be interesting for others. That's why I've wanted to scribe a short post to show you some insights from my perspective.


What to use for now

I think for now it's good to stick to the classic chatbot design approach (read more). Why? Because most of the features related to generative orchestration are still in preview (you can read more about the preview features here). So what you should use for now:

  • for topics: stick to the classic trigger phrases,
  • don't use "Actions" as they're still in preview, prefer to use flows to perform the necessary logic,
  • use "Generative answers" node in your topic for: transforming output from the flow, presenting it to the user, answering questions based on few knowledge sources,
  • don't overthink it - sometimes it's better to use a simple "Message" node, instead of using "Generative answers" to create everything.

With the mix of classic features and recently introduced "Generative answers" (it's already in Generally Available status, so you can use it freely), you can create many useful chatbots for different purposes.


What to avoid

First thing to avoid: if you see any feature that's marked as "preview", don't use it! Otherwise you'll risk that your chatbot won't work in the future or something wouldn't work as expected now. Features to avoid for now are mainly:
  • generative orchestration:

  • connector actions ("Actions" mentioned earlier):
  • event triggers:

Of course, there could be more - read all the descriptions! If you're unsure about something, it's also worth to check the official documentation on https://learn.microsoft.com. All in all: be careful!


Summary

For now, at a glance, it seems that Copilot Studio features are quite limited, but don't be disappointed. Classic features powered up by "Generative answers" action can already give you a very useful chatbot with a lot of features. Keep that in mind and don't get into GenAI hype. The best feature is the one that fulfills your requirement, not the one that's nice and shiny. 😉



A simple yet effective prompting guide

  1. Be specific. The model is not able to guess what you would like to achieve, so you need to state it directly.
  2. Instruct the model to adopt a persona – it helps in receiving more relevant responses.
  3. Use delimiters like “*”, newline etc. to indicate distinct parts of the input.
  4. Split big tasks into smaller subtasks.
  5. Provide examples of what response you would like to receive.
  6. Write clear instructions and avoid using ambiguous words.
  7. Carefully test the prompt to ensure that the outcome is always correct.
  8. Use the model to make your prompt better – just ask it: “Help me make this prompt better for you: *YOUR PROMPT*”.

Example:

Good prompt: Prepare me an analysis of sales data for year 2024. Include this columns only: ColumnA, ColumnB, ColumnC. Use formal tone and refer to the data provided only.

Bad prompt: Prepare me an analysis of sales data.

The main rule is:

The more details you include, the more tailored outcome you’ll receive.


Useful guides:

https://platform.openai.com/docs/guides/prompt-engineering

https://www.promptingguide.ai/techniques


How to monitor all your chatbots without a headache?

Azure Copilot Studio Licensing M365 Copilot News Tutorials

From this article you’ll know:

  • what’s Azure Application Insights and how to use it in context of Copilot Studio,
  • how to effectively query Log Workspace connected to Application Insights to monitor chatbots,
  • how to setup a connection between chatbots and App Insights,
  • other nice tips. 😁

Many times I’ve heard about a problem that it’s not possible to monitor multiple chatbots at once. If you’re just starting your journey with Copilot Studio – you probably don’t think about monitoring and troubleshooting, as it’s quite easy to just perform few clicks in Copilot Studio and check the analytics. But what if you’ll have more chatbots?

5? It’s manageable.

15? With more effort, but still manageable.

55? You’re not going to manage it. 😉

So what to do to monitor them all in one place? Let’s check out what Azure Application Insights can give us!


Azure, help!

First thing that you need to do is to create Azure Application Insights resource as it’s going to be the place, where all agents logs will land. I’m not going to explain it in detail as it’s a topic for a separate post. You can read more about how to create this resource here. After creation you should see something like this:

This is a view from the resource group. When you click on the violet bulb icon – it’s our app insights resource, you’ll see this screen:

You need to copy the connection string – it’ll be needed in Copilot Studio. What we’re going to use to check our chatbots is Logs tab. When we navigate to it, we’ll have this:

All our logs are going to land to customEvents table. From Azure perspective we have everything, let’s see what we need to do in Copilot Studio!


How to Copilot?

Do we have our Connection String from App Insights copied? If yes, we can navigate to Copilot Studio and to the chatbot settings here:

Then we just need to simply paste the string and save. We can also think about what logs we would like to send – thinking especially about Log sensitive activity properties. That’s something we need to decide on, depending on the solution requirements. After that we can engage into a chat in our test window. Let’s see what happens then!


Logs love!

After few chats in the test window, we can navigate back to our Azure resource, to Logs tab. When we’re back, we can simply query the resource to check the logs. But wait! It’s not that simple, right? 🤔 Yes, so the thing is that for App Insights the special query language is used to query the dataset – it’s called KQL (Kusto Query Language). Don’t worry! It’s quite easy to grasp. What you could start is just a simple query to retrieve all records. In case of Copilot Studio logs, we need to query customEvents table. When we perform a query, we should see something like this:

In the logs you have almost everything – from the user data to what topic has been invoked, what message has been sent etc. With this resource you can do almost anything with this data:

  • query for only certain bots,
  • check for any errors,
  • view how many conversations are for a given date range,
  • debug any potential problems, especially with generative answers node

and many more! Just as an example: here’s a query where I’m checking only one specific chatbot:

customEvents
| where cloud_RoleInstance == "YOUR CHATBOT NAME"

But there’s even more. With App Insights you can define:

  • alerts for each query, so that you’ll get informed when something wrong happens,
  • dashboards to monitor all the chatbots in one place,

etc.

Regarding alerts: you can read more about then here. There’s a lot of options here to monitor anything, so keep in mind to not get lost. 😉


Summary

Did you like the monitoring possibilities for chatbots? Personally, I really like them, because you can easily get everything in one place, without much effort. I’m going to use them frequently with my deployments in order to monitor all the chatbots easily!

Liked the post? Tell me in the comments section. 😉


Artur Stepniak


Links:

About alerts: https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-create-metric-alert-rule

Create App Insights: https://learn.microsoft.com/en-us/azure/azure-monitor/app/create-workspace-resource?tabs=bicep

KQL reference: https://learn.microsoft.com/en-us/kusto/query/kql-quick-reference?view=microsoft-fabric

How to use generative answers as a fallback?

In this article you’ll know:

  • how to properly configure a Question action,
  • how to use Generative answers action as a fallback to the Question action.

Hello! I’ve recently found out that quite a lot of people would like to configure a Question action with Generative answers as a fallback. The idea to do it is quite easy, although you need to perform some changes in the system topics. Want to know more? Let’s check it out!


1. Configure a Question action

First thing that you need to perform is to configure properly the Question action. By default it repeats the question 2 times, until it’ll receive an answer which’s available on the choices list. We need to disable it, so that it won’t repeat by choosing “Don’t repeat” option in the question behavior:

2. Configure the Escalate topic

Now when you try to input a different option than the ones that are defined, it should immediately redirect your chat to Escalate topic, which’s used when the chatbot is unable to answer the question. The idea here is quite simple: you can create a generative answers action here, in Escalate topic, and it’ll always use it, when someone would enter an unexpected input. Here I’ve configured it in my topic:

I’ve used following input in the action:

"Try to help the user based on the message from the user: " & System.LastMessage.Text

But you can try anything that’ll fulfill your needs.


Summary

In this short article, we’ve learned on how to use Generative answers action as a fallback for a question. I hope you liked it and it’ll help you create the best chatbot ever. 😉

Cheers!


Artur Stepniak