How to create Topic in Copilot Studio

Copilot Studio is a low-code/no-code platform from Microsoft 365 for building conversational agents. Topics in Copilot Studio act like reusable JavaScript functions, encapsulating logic and interacting with user inputs. This article explains the creation of a new topic, detailing steps to define trigger phrases, configure actions, and use PowerFX expressions for dynamic responses. Learn how to test your agent and create a functional topic seamlessly.

Introduction

Copilot Studio is a low code / no code platform from Microsoft 365 that allows us to create a conversation agent. A Topic is a functional block within an agent, that will be run whenever that gets triggered.
I can say this is very much equivalent to any program language function. Let’s compare the Copilot Studio with JavaScript function,

Javascript Function vs Copilot Studio Topic

Aspect JavaScript Function Copilot Studio Topic
Purpose Encapsulates reusable logic in a program. Represents a reusable conversational unit in a agent.
Input/Parameters Accepts parameters to process logic. Accepts user inputs/questions during the conversation.
Output Returns a value, executes logic, or updates state. Returns responses, calls actions, or executes flows.
Reusability Can be invoked multiple times in different contexts. Can be invoked across different topics.
Implementation Requires coding and defining logic explicitly. Uses a graphical interface and configurations for logic.
Error Handling Handled programmatically with try-catch blocks. Configured using fallback topics or error messages.

Topic Creation

Let’s move onto how to create a topic. First, navigate to the Copilot Agent or create a new agent in Copilot Studio.
  • Navigate to the Topics tab. By default, it has 4 Custom topics and 9 System topics,
  • Select Add a Topic button and then choose ‘From blank‘.
  • The Untitled topic will be created with Trigger action with empty phrases.
  • Click on Edit button under Phrases.
  • Then enter any phrases to trigger. For example, let’s add “show my name” in Phrases panel.
  • Then click on Add node icon (+ sign). This will open a list of available actions to add as nodes.
  • Select Send a message.
  • Select the “Enter a message” box and then choose formula icon (insert Powerfx expression)
  • Then add the formula as “Hello “&System.User.DisplayName
  • Then click Insert button to apply the formula.
  • Then save the topic by clicking on Save button that shows on top of the topic.
  • If Topic is not provided, during the save it’ll ask us to provide it. Let’s save the Topic name as Demo Topic.

Conclusion

Use the Test your agent panel to test the topic. In the test panel, enter “What is my name?” or “Show my name”.
The newly created topic gets triggered and display the output as “Hello User

 

Shantha Kumar
Shantha Kumar
Articles: 301