OPERATION AUTOMATION POWERHOUSE⏱️ Operation Time Window:
~30 minutes
🎥 Watch the Walkthrough
Your agent can now converse with users and provide information, but true operational excellence requires your agent to take action. This mission will transform your conversational agent into an automation powerhouse by equipping it with agent flows.
By mission’s end, you’ll have created an end-to-end device request automation that captures user input through an adaptive card, retrieves data from SharePoint, sends notifications to managers via email, and provides seamless user feedback - all orchestrated by your agent through intelligent workflow automation.
In this mission, you’ll learn:
Agent flows are a powerful way to automate repetitive tasks and integrate your apps and services. Think of them as structured, step-by-step workflows that your agent can execute to automate tasks or connect with other applications and services. You can think of them as mini workflows that help your agent do things like send notifications, update records, or respond to events.
Unlike autonomous agents that use AI to make decisions on the fly, agent flows are deterministic workflows - meaning they follow the same path every time, ensuring consistent and reliable results.
In simple terms:
Both agent flows and Power Automate cloud flows help automate tasks. They’re designed for different purposes and work in different ways.
What they’re for:
Why they’re useful:
Limitations:
What they’re for:
Why they’re useful:
Requirements:
| Use this | When you want to |
|---|---|
| Agent flows | Automate tasks inside an agent, use AI, and keep everything in Copilot Studio |
| Power Automate cloud flows | Automate across apps and services, or build workflows outside of agents |
Agent flows always follow a fixed path - they do the same thing every time when given the same input.
This makes them:
Other benefits are:
Agent flows expand what your agent can do beyond “chatting” with users. They allow it to take action and interact with systems.
Let’s say you’re working in a finance department and you receive a lot of invoices from vendors. Normally, someone has to read each invoice, pull out the important details - the amount, date, who it’s from, and check if everything matches your records. Then send it to the right person for approval. This takes time and effort.
With agent flows in Copilot Studio, you can automate this process. As soon as the invoice comes in, the agent:
This saves time, reduces mistakes and makes the whole process much smoother.
AI actions
Use AI to:
Trigger
An event starts the flow - such as a user asking a question, invoking the flow from a topic, a scheduled time, or an event happening in another system.
Actions
These are steps that the agent follows next - send an email, call an API, update a ticket in ServiceNow.
It’s a visual tool in Copilot Studio that helps you build, edit, and manage agent flows that provide step-by-step instructions your agent follows to complete tasks. It’s designed to be straightforward to use, even if you’re new to agent flows.
Expressions are small formulas or commands that help your agent flow work with data. You use them to calculate values, format text, make decisions, or pull specific information from inputs.
Expressions let you:
Expressions use functions. I’m going to borrow an explanation of what functions are from former Microsoft MVP, Jerry Weinstock.
!!! quote Functions are built-in logic to transform your data either through simple or complex operations in your expression.
Functions enable you to build expressions without you needing to write any code.
The way I like to describe it, is that a function in agent flows is similar to Excel functions. You can perform an operation on data to transform it into a desired output. When building your formula in Excel you select your input value from the cells in a table or a range, and then apply functions to manipulate the data output. An example is using the COUNT function to work out the number of cells that contain numbers from a range.
In agent flows, instead of referencing data from cells in a table, you’re referencing data outputs from the trigger or actions when building your expressions. Continuing with the previous example, use the function length to retrieve the number of items returned from the Get items SharePoint connector action.
Using functions makes your agent flows:
The following are common functions used in agent flows. For the full list of functions, head to the reference guide.
concat() - Joins two or more pieces of text together.
- Example: concat('Hello ', firstName) → “Hello John”
toLower() / toUpper() - Changes text to lowercase or uppercase.
- Useful for standardizing input.
substring() - Extracts part of a string.
- Example: Get the first 3 letters of a name.
trim() - Removes spaces from the beginning and end of text.
add(), sub(), mul(), div() - Basic math operations.
- Example: add(5, 3) - the output is 8utcNow() - Gets the current date and time in UTC.
- Great for timestamps.
addDays(), addHours() - Adds time to a date.
- Example: addDays(utcNow(), 7) output is 7 days from now.
formatDateTime() - Formats a date into a readable string.
- Example: Monday, July 7, 2025
if() - Runs one value if true, another if false.
- Example: if(score > 50, 'Pass', 'Fail')
equals() - Checks if two values are the same.
and(), or(), not() - Combine multiple conditions.
coalesce() - Returns the first non-empty value.
- Useful for fallback/default values.
guid() - Generates a unique ID.
- Useful for tracking or logging.
length() - Counts how many characters or items are in a string or array.
Here are some best practices for building agent flows in Copilot Studio.
Start simple and build gradually
Use clear and descriptive action names
Check for errors before publishing
Test your flow thoroughly
Use Version History
Use parameters and expressions wisely
Delete unused actions
We’re now going to learn how to enhance our topic with adaptive cards and using advanced functionality of topics and nodes.
As a manager of an employee
I want to receive device requests
So that I can review the device requested by the employee.
Let’s begin!
SharePoint list
We’ll be using the Devices SharePoint list from Lesson 00 - Course Setup - Step 3: Create new SharePoint site.
If you have not set up the Devices SharePoint list, please head back to Lesson 00 - Course Setup - Step 3: Create new SharePoint site.
Contoso Helpdesk Agent
We’re going to use the same agent created previously in Lesson 06 - Create a custom agent using natural language with Copilot and grounding it with your data.
In this exercise, we’ll create an agent flow that retrieves the SharePoint item of the selected device and send an email to a manager with the device details.
In the Request device topic, scroll down to the Ask with adaptive card node and add a new node. Select Add a tool and in the Basic tools tab of the fly out pane, select New Agent flow.

The Agent flows Designer will load with a trigger and action.
Select the trigger.

Next, we’re going to add several inputs for the agent flow.
DeviceSharePointId - this will store the value, ID, of the SharePoint item. This ID value is an output from the Ask with adaptive card node where the user selected the device.
User - this will be the name of the user which will be from a system variable of the agent.
AdditionalComments - this will be the the comment entered by the user, which is an output from the Ask with adaptive card node.
We’ll first add the DeviceSharePointId as an input for our trigger. Select + Add an input.

For the type of user input, select Text.

For the name of the input, enter the following.
DeviceSharePointId

We’ll now add the second input, User. Repeat the same steps, select + Add an input and select Text.

For the name of the input, enter the following.
User

We’ll now add the third input, AdditionalComments. Repeat the same steps, select + Add an input and select Text.

For the name of the input, enter the following.
AdditionalComments

For the AdditionalComments input, we’ll update it to make it optional. Select the ellipsis (…) icon and select Make the field optional.

Great work! The trigger has now been configured, let’s continue. Select the plus + icon under the trigger to insert a new action.

The Actions pane will appear where you can view actions from 1400+ built-in connectors to Microsoft and third-party services. In the search field enter the following,
Get item
A list of actions will display in the search results. Select the Get item action from the SharePoint connector.

We can now begin configuring the Get item action.
Select the Ellipsis (…) icon in the Get item action.

Select Rename.

Rename the action to,
Get Device

In the Site Address field, select the Site address of the Contoso IT SharePoint site created in Lesson 00 - Course Setup - Step 3: Create new SharePoint site.
In the List Name field, select the Devices SharePoint list.

In the Id field, select the lightning bolt icon or fx icon to the right.
![]()
In the Dynamic content tab of the flyout pane, enter the following,
sharepoint
The search results will show input parameters that match the value searched. Select the DeviceSharePointId parameter from the trigger.
Next, select Add to add the dynamic content input into the Id parameter of the action.

The dynamic content input from the trigger is now referenced in the Id parameter of the action. We’re going to update one of the advanced parameters next. Select Show all to view the advanced parameters.

The Limit Columns by View parameter will be displayed and by default it’s set to Use all columns (Do not limit). We’ll update this value to a view to limit the columns returned in the response of the action. Select the Limit Columns by View parameter to view the list of views.

Select the All Items view.

Select the plus + icon under the Get Device action to insert a new action.

In the search field enter the following,
send an email
A list of actions will display in the search results. Select the Send an email (V2) action from the Office 365 Outlook connector.

We next need to create a connection for the connector action. Select Sign in.

Select your signed in user account.

Select Allow access. A connection has now been created.

Rename the action to the following,
Send an email to manager
Let’s next define the input parameters of our action.
For the To input parameter, select yourself. Normally this would be your manager or we’d use another action that pulls through your manager based on your Entra ID profile but for the purpose of this lesson, select yourself.
For the Subject input parameter, enter the following,
Request type: new device
For the Body input parameter, enter the following,
Hi,
New device requested from
Manufacturer:
Model:
Link to item in SharePoint
Additional comments from:
This is an automated email from Contoso Helpdesk Copilot

Next, we’re going to update the Body input parameter with references to dynamic content input from the trigger or Get item action. Enter a space after the second line as we’ll insert the name of the user from the trigger input, User.
Select the lightning bolt icon or fx icon to the right.

In the Dynamic content tab of the flyout pane, select the User input from the trigger.
Select Add to add the dynamic content User input into the Body parameter of the action.

The dynamic content input from the trigger is now referenced in the Body parameter of the action. We’ll repeat the same for the remaining lines in the email message body.

Click into the space beside Manufacturer:. Select the lightning bolt icon or fx icon to the right.
In the Dynamic content tab of the flyout pane, enter the following in the search field,
manufacturer
Select the Manufacturer value input from the trigger and select Add.

Click into the space beside Model:. Select the lightning bolt icon or fx icon to the right.
In the Dynamic content tab of the flyout pane, enter the following in the search field,
model
Select the Model input from the Get item action and select Add.

For the Link to item in SharePoint text, we’ll update this to be a hyperlink in the email message body. Click at the beginning of the line and select the lightning bolt icon or fx icon to the right.

Click after the HTML anchor tag and select the lightning bolt icon or fx icon to the right.
In the Dynamic content tab of the flyout pane, enter the following in the search field,
link to item
Select the Link to item input from the Get item action and select Add.

We need to switch to the HTML editor by selecting the </> icon.

The HTML editor is now enabled. Click before the Link to item in SharePoint text, add an HTML anchor tag to create a hyperlink. Copy and paste the following.
<a href="

The dynamic content input of Link to item is now referenced in the Body parameter. Click after the Link to item input, copy and paste the following.
">

Click after the Link to item in SharePoint text, close the html anchor tag. Copy and paste the following.
</a>

Select the </> icon to toggle the code view.

Then reselect the </> icon to toggle the code view again.

Notice how there are several extra characters <br>. Delete these characters

We’re now done adding a hyperlink to our email message body 😎 Select the </> icon to toggle the code view.

Click after the Additional comments from text before the colon character and select the lightning bolt icon or fx icon to the right.

In the Dynamic content tab of the flyout pane, enter the following in the search field,
user
Select the User parameter from the trigger and select Add.

We’re now going to insert an expression that will display the value of Additional Comments if provided by the user in the Ask an adaptive card node, otherwise display “None” if the user does not provide any comments.
Click after the colon and select the lightning bolt icon or fx icon to the right.

In the Function tab of the flyout pane and in the expression field above, enter the following,
if(empty())
This expression uses the if function for an if-else statement.
The next function used is empty which checks whether a value exists or not in a string parameter. The string parameter to be referenced is the AdditionalComments input parameter value from the trigger.

Next, click inside of the brackets after the empty function. We’re going to insert the AdditionalComments input parameter from the trigger.
Select the Dynamic content tab. Enter the following in the search field,
Additional
Scroll down the pane and select AdditionalComments input from the trigger. The parameter will now be added as a string parameter in the expression.

Next we’ll define the true logic, where if the AdditionalComments string parameter is empty, then we want to display a string (text) of None.
After the bracket that encloses the string parameter, enter the following,
, 'None',

Finally we’ll define the false logic, where if the AdditionalComments string parameter is not empty, then we want to display the value of the AdditionalComments input parameter from our trigger.
A reminder this value will be from the Additional Comments field of the adaptive card in the Ask with adaptive card node in the Request device topic.
After the comma after our true logic, select the Dynamic content tab. Enter the following in the search field,
Additional
Scroll down the pane and select AdditionalComments input from the trigger. The parameter will now be added as a string parameter in the expression.
Now add it our Body parameter by selecting Add.

Excellent, our expression is complete! The expression has now been added to the Body parameter. Lastly, format the last line in Italics.

We’re now going to update the Respond to the agent action to send the value of the Model value parameter from the Get item action back to the agent.
Hold down the left key of your mouse and move in an upward motions within the designer to view the Respond to the agent action.
Select the Respond to the agent action and select the Text output as the type.

Enter the following as the name of the output.
ModelValue

Select the value field and select the lightning bolt icon or fx icon to the right.

In the Dynamic content tab of the flyout pane, enter the following in the search field,
model
Select the Model parameter from the Get item action and select Add.

The Model parameter is now the value of the text output. Select Save draft to save our agent flow.
We’ve now completed our agent flow 👏🏻

Let’s make one more update to our agent flow before publishing. Select the Overview tab and select Edit.

For the Flow name, copy and paste the following.
Send device request email
For the Description, select the refresh icon to use AI to automatically generate a description for you based on the trigger and actions in the agent flow.
Select Save to save the updated name and description of the agent flow.

Select the Designer tab and select Publish to publish the agent flow so that it can be added as a node in the Request device topic.

A confirmation message will appear shortly to confirm the agent flow is published.

Let’s now add the agent flow to the Request device topic.
Select Agents in the left-hand side menu and select the Contoso Helpdesk Agent.

Select the Topics tab.

Select the Request device topic.

Scroll down to the Ask with adaptive card node and add a new node.
Select Add a tool and in the Basic tools tab of the fly out pane, select the Send device request email agent flow we recently created and published.

For the trigger inputs of our agent flow, we need to select the variable outputs from the Ask with adaptive card node.
Select the ellipsis (…) icon for the DeviceSharePointId input.

Select the deviceSelectionId variable which is one of the outputs defined in Ask with adaptive card node.

Next, select the ellipsis (…) icon for the User input.

Select the System tab in the flyout variable pane and select User.DisplayName. This variable stores the display name of the internal user interacting with the agent.

Next, select the greater than icon for Advanced inputs to expand and see the AdditionalComments input.

Select the ellipsis (…) icon for the AdditionalComments input.

Select the Formula tab and the expand icon in the flyout variable pane as we’ll use a Power Fx expression.
![]()
commentsId output variable from the Ask with adaptive card node.Enter the following functions in the Power Fx field,
If(IsBlank())
This expression uses the If function for an if-else statement.
The next function used is IsBlank which checks whether a value exists or does not exist in a string parameter. The string parameter to be referenced is the commentsId output variable from the Ask with adaptive card node.

Next, click inside of the brackets after the IsBlank function. We’re going to insert the commentsId output variable from the Ask with adaptive card node.
Enter the following inside the brackets,
Topic.commentsId
And add a comma after the bracket.

Next we’ll define the logic
Topic.commentsId string parameter is empty, then we want to insert no value.Topic.commentsId string parameter is not empty, then insert the value of commentsId variable.After the bracket that encloses the string parameter, enter the following,
"", Topic.commentsId)
The Power Fx expression should be the following,
If(IsBlank(Topic.commentsId), "", Topic.commentsId)
Great work, our expression is complete! 🙌🏻 Now select Insert to set the input parameter of the agent flow to the Power Fx expression.

We’ll next add two more nodes:
Send a message - this will act as a confirmation message that references the selected device and that their request has been submitted.
Topic management - to close the conversation, we’ll redirect to the End of conversation node.
Let’s begin!
Select the plus + icon below the agent flow node and select Send a message node.

Enter the following below in the message field,
Thanks
Then select the Insert variable as we’ll reference the user’s name.

Select the System tab and search for User in the search field. Select the User.DisplayName variable.

Enter the following below in the message field,
. Your selected device,
Then select Insert variable and this time in the Custom tab, select the ModelValue variable.
Then enter the following below to complete the message.
, has been submitted and will be reviewed by your manager.
The message should look like the following.

Lastly, select the plus + icon below the Send a message node and select Topic management, followed by Go to another topic and select End of Conversation.

Save the topic.

Great work!!! 😁 We can now test our agent.
Refresh the test pane, select the activity map icon and enter the following as a message to the agent.
I need a laptop

The agent triggers the Available devices and responds with the list of available devices. We’ll enter the following as the answer to the question of whether we’d like to request a device.
Yes

Notice how the agent invoked the Request device as per the agent instructions and that the adaptive card is now being displayed in the agent message.
Select the Surface Laptop 15 device and add the following as a comment.
I need 16GB of RAM please

Scroll down until you see the Submit Request button and select it to submit the adaptive card to the agent.

Select Allow for the agent to use your credentials for the connection authentication of the two connector actions.

The agent will then display the confirmation message which includes the model selected, followed by redirecting to the End of Conversation topic. Cool!

Select Yes to verify the rest of the End of Conversation topic.

Next, rate the experience by selecting any of the stars in the rating scale card.
The agent will then proceed to the final Question node in the End of Conversation topic. Select No.

The topic will then complete as a final message will be displayed in the test pane.

Check your Inbox of your email account to review the email sent to the manager by the agent flow. You can see the details of the device selected, and the note entered in the adaptive card.

Click the hyperlink and the browser should load the SharePoint item of the device. Super!

Let’s now test the scenario when a comment is not entered.
Repeat the same steps of
I need a laptopYes to the question of requesting a device
This time select Surface Laptop 13 as the device and do not enter a comment.

Submit the request by selecting the Submit Request button.

This time the email received in your Inbox will display None as the comment.

Let’s test the final scenario which is to not request a device, and the Goodbye topic should be invoked as per the agent instructions.
Repeat the same steps of
I need a laptopNo to the question of requesting a device
The agent invoked the Goodbye topic and the question as defined in the topic is asked.

Congratulations! 👏🏻 You’ve learnt how to build your agent flow and add it to our existing Request device topic, and how to redirect the agent to another topic.
This is the end of Lab 09 - Add an agent flow for automation and enhance topic capabilities, select the link below to move to the next lesson. We’ll expand on the use case in this lab in the following lesson’s lab.
⏭️ Move to Add Event Triggers - Enable autonomous agent capabilities lesson
🔗 Introducing agent flows: Transforming automation with AI-first workflows
🔗 Use agent flows with your agent
🔗 List of functions in the reference guide
📺 Agent Flows in Copilot Studio