Building an Autonomous AI Agent in Copilot Studio – Part 9: Testing the Autonomous Agent

Reading Time: 3 minutes


Welcome to part 9 and the final part of this blog post series.

If you missed the previous parts, visit the links below:

In this blog post, I’ll test the autonomous agent end to end to ensure everything works as expected.

During this test, I will:

  1. Submit the Microsoft Form created in part 1, selecting SC-401 as the requested course
  2. Wait for the agent to trigger automatically
  3. Verify that the agent reads the Mentors.xlsx file and identifies a suitable mentor
  4. Confirm that an email is sent to the mentor associated with the SC-401 course
  5. Check that a new row is added to the RequestLogs.xlsx file with the request and assignment details

Task: Test the autonomous agent

  1. Access the Microsoft Form created in part 1 of this blog post series and submit a new response.
Agent19
Agent20


2. Check that the Microsoft Form has been submitted successfully.

Agent21


3. Now we wait for the autonomous agent to do its job. In my case, it took less than a minute for the agent to start processing the request.



Email sent to Mentor ✅


An image is shown below confirming that the mentor received the email notification

Agent22



Mentor Assignment Confirmed ✅


Hannah Doe has been correctly identified as the mentor for the SC‑401 course. The file shown below confirms that Hannah is listed as the mentor for SC‑401.

Agent23



Log file updated with requester details and assigned mentor ✅


RequestLogs.xlsx file has been automatically updated with the requester’s details and the assigned mentor.

The image below shows the log entry confirming Hannah Doe was assigned as the mentor for the SC‑401 course.

Agent27



The next step is optional. If you’d like to test the trigger manually without submitting another Microsoft Form response, follow the steps below.

  • Go to Copilot Studio at copilotstudio.microsoft.com and select the agent
  • Click Test, located in the top right corner of the Copilot Studio interface
  • Click the three dots, as shown in the image below
  • Click Test Trigger
  • Select When a new response is submitted
Agent24


Select the response you want to test, then click Start testing

Agent26


The screenshot below illustrates how the agent processed each task step by step, from detecting the form submission to completing all configured actions.

Agent28


And that’s it.

I hope you enjoyed following this blog post series and learned something new.

If you have any feedback or thoughts, I’d love to hear them, please feel free to leave a comment below.

Building an Autonomous AI Agent in Copilot Studio – Part 8: Amend Existing Agent Instructions to Use Tools

Reading Time: 4 minutes


Welcome to part 8 of this blog post series.

If you missed the previous parts, visit the links below:

In this blog post, I will return to the instructions I defined for my agent in part 3 of this blog post series and update them so the agent knows how and when to use the tools we added in Part 7 earlier.

Current Agent Instructions

Below is a reminder of the instructions I originally defined for the agent in Part 3 of this blog post series.


Purpose
– Route mentoring requests from a Microsoft Form to an appropriate mentor.

Trigger:
1. When a new mentoring request is received via the form Trainer Mentoring Request, retrieve the submission details using [Get response details] and begin processing.

Data to capture from the form
2. Extract the following details from the form submission:
– Full Name
– Email Address
– Course Selection (course code)
– Country
– Specific Areas of Concern

Mentor lookup (mentors.xlsx)
3. Retrieve the mentor list from mentors.xlsx using [List rows present in a table]
– MentorName
– MentorEmail
– Course

Send an email to the assigned mentor
4. Send an email using [Send an email (V2)] addressed to the selected mentor. Format in html so it’s clear to read. Send the email after creating the draft email.

Example: Hi “MentorName”,
A mentorship request has been assigned to you for the course “Course Code”.
Requestor Name: “MenteeFullName”
Requestor Email: “MenteeEmail”
Country: “Country”
Thanks,
Course Mentor Agent at Imran Rashid Training

Log the request (RequestLogs / Requests table)
5.Use [Add a row into table] to dynamically complete the below:
Requester Name using the Full name field from the form
Email using the Email Address field from the form
Course using Course Selection from the form
Country using the Country field from the form
Concerns using the Specific Areas of Concern field from the form Assigned Mentor from the MentorName from the Mentors excel file


Task: Add tools to instructions

  1. Select Overview
Agent18


2. Scroll down to Instructions, and click Edit

Agent12


3. In instruction number 1, remove the placeholder [Get response details]. Then type / (Forward slash) on your keyboard. A list will appear, select the tool we created earlier called Get response details, as shown in the image below.

Agent13


4. In instruction number 3, remove the place holder [List rows present in a table]. Then type / (forward slash) on your keyboard. When the list appears, select the tool we created earlier called List rows present in a table, as shown in the image below.

Agent14


5. In instruction number 4, remove the placeholder [Send an email (V2)]. Then type / (forward slash) on your keyboard. When the list appears, select the tool we created earlier called Send an email (V2), as shown in the image below.

Agent15


6. Finally, in instruction number 5, remove the placeholder [Add a row into a table]. Then type / (forward slash) on your keyboard. When the list appears, select the tool we created earlier called Add a row into a table, as shown in the image below.

Agent16


7. Click Save

Agent17

That’s it, the agent instructions have now been successfully updated to reference the tools we added in Part 7.

In the next post, I’ll test the autonomous agent by submitting the Microsoft Form we created in part 1 of this blog post series.

Click the following link to continue to final part of this blog post series: Building an Autonomous AI Agent in Copilot Studio – Part 9: Testing the Autonomous Agent – Cloud Build

Building an Autonomous AI Agent in Copilot Studio – Part 7: Add Tools to a Copilot Studio Agent

Reading Time: 9 minutes


Welcome to part 7 of this blog post series.

If you missed the previous parts, visit the links below:

In this part of this blog post series, I will connect a number of tools to my agent. Tools enable agents to automate processes and complete tasks without human intervention. There are over 1,000 pre-built connectors in the Power Platform, which allow us to connect to Microsoft and third party applications.

We can grant the agent access to the Excel files, Email, and more. Without tools, the agent would not have the permissions to access my data and make changes.

We need a combination of the trigger, the tools, and the instructions so the agent knows what is required of it. The end result is an agent that has access to the tools it needs, a trigger to start it, and clear instructions that guide how the tools should be used.

But haven’t we already added a trigger in an earlier post?
Correct, the trigger plays an important part. The trigger detects when a Microsoft Form is submitted and retrieves the responses. It allows the agent to capture details such as the course code submitted by the trainer.

However, for the agent to determine who to assign the request to, it also needs access to the central mentors Excel spreadsheet so it can compare the submitted course code with the central mentors.xlsx spreadsheet.

The agent therefore needs permission to read data from both the Microsoft Form and the Excel file. This is why we need to add tools. Tools allow the agent to access and work with external data sources such as Forms, Excel, and email.

In this post, we’ll explore the different types of tools available in Copilot Studio before adding the required tools to the Course Mentor Agent.

We will add and configure the following tools:

  • Get response details (Microsoft Form)
  • List rows present in a table
  • Add a row into a table
  • Send an email (V2)

Task: Add tools to agent

  1. Select tools
CopilotStudioTools1


2. Click + Add a tool

CopilotStudioTools2


You’ll find a number of tools to choose from. I have provided an explanation for each option in the table below.

CopilotStudioTools3

Tool optionWhat it doesExplanation
AllShows all available toolsDisplays every tool your agent can use in one place. Useful if you just want to browse everything that’s available.
ConnectorConnects to other servicesLets your agent connect to Microsoft or third‑party services (for example SharePoint, Dataverse, Outlook, or Teams) using built‑in connectors.
PromptAI‑based instructionAllows you to define a natural‑language prompt that the agent can run using AI, such as summarising text, rewriting content, or generating an explanation.
FlowRuns Power AutomateRuns a Power Automate flow from your agent, such as saving data to Excel, sending an automated email, or creating a ticket.
REST APICalls external APIsAllows the agent to call an external REST API directly to send or retrieve data from custom or third‑party systems.
Model Context Protocol (MCP)Connects to MCP serversMCP is an open‑source standard for connecting agents to external tools and data through an MCP server. When you connect to an MCP server, Copilot Studio automatically discovers the tools and data it provides (including names, inputs, and outputs). In many cases this feels plug‑and‑play as you don’t need to build anything yourself unless you want to expose your own systems. The MCP server provides the context and capabilities, and the agent uses them as needed.

There are over 1,000 tools available that allow an agent to connect to both Microsoft and third-party products to automate business processes. I’ve added a few images below that show the different types of tools available. This is just a small sample, there are many more available.

CopilotStudioTools5
CopilotStudioTools5
CopilotStudioTools6
CopilotStudioTools7
CopilotStudioTools8


Task: Add tool – Get response details (Microsoft Forms)



3. Search for and select Get response details, or use the search box if the tool is not visible.

CopilotStudioTools9


4. Click the Add and configure button, as shown in the image below

5. If a connection is not already established, click Create connection and sign-in

This will allow the agent to retrieve the Microsoft Form response, but we need to select the Microsoft Form created in part 1.

CopilotStudioTools10


6. Click additional details, as shown in the image below.

Agent10


7. I’ll be changing End user credentials to Maker-provided credentials, as shown in the image below.

CopilotStudioTools12


Why change this setting?

If I leave as the default End user credentials option enabled, users will be prompted to sign-in before the agent can retrieve form responses. This may work fine for internal only forms, but it can cause problems if the form is shared publicly, as not everyone will be able to sign-in. By switching to Maker‑provided credentials, the agent uses my connection to Microsoft Forms instead of the end user’s credentials. This allows the agent to retrieve form responses automatically, even when the form is available to external or anonymous users.

This setting depends on your scenario and how you want users to interact with your form.

CopilotStudioTools13


8. Next, scroll down to Inputs. This is where I select which Microsoft Form to use. I chose the form I created earlier in this blog post series (Part 1).

Click Dynamically fill with AI and select custom value

CopilotStudioTools15


9. Click inside the Unique identifier of the form field. A list of available Microsoft Forms will appear. I select the form I created earlier in part 1 of this series.

CopilotStudioTools16



10. The Response Id field will be left set to Dynamically fill with AI. This is because each time a trainer submits the form, a new and unique form response ID is generated, so it isn’t possible to provide a fixed value.

CopilotStudioTools17


11. Click Save

CopilotStudioTools18


Task: Add tool – List rows present in a table (Excel Online Business)


Next, I need to add an Excel tool so that my agent can access my Mentors Excel file, which includes a list of all course mentors.

12. Select Tools and search for Excel. Select List rows present in a table, as shown in the image below. This allows the agent to read all rows from the Mentors table and dynamically determine which mentors are qualified based on the course code is associated with them. The agent can then use this information later to select a suitable mentor for the request.

CopilotStudioTools19


13. If a connection is not already established, click Create new connection

CopilotStudioTools20


14. Click Create

CopilotStudioTools21


15. Sign-in

CopilotStudioTools22


16. Check that the connection is enabled.

CopilotStudioTools23


17. Again, as we did earlier with the Microsoft Forms tool, click the Add and configure button, as shown in the image below.

CopilotStudioTools24


18. Click Additional details and change the credentials to Maker-provided credentials, so the tools uses my credentials. Leave the name and description set to their defaults.

CopilotStudioTools25


19. Scroll down to Inputs

For Location, click the dropdown under Fill using, select Custom value. Click inside the Value box, and choose OneDrive for Business from the list.

For Document library, click the drop down under Fill using and select Custom value. Click directly inside the Value box, and select OneDrive from the list.

For File: Click and select the file. This would be my file named Mentors.xlsx

If you received the following error message: You are not authorized to use this connection. Please consider using a different connection. Manually type the name of the Excel file, such as Mentors.xlsx. This is common if you have only just created or uploaded the file.


20. Select Table1, or manually type Table1 if it does not appear.

CopilotStudioTools33


Note: the table name comes from Excel when your data is formatted as a table. With the table selected in your Excel file, go to Table Design at the top of the Excel spreadsheet. You’ll find the table name there, which usually defaults to Table1.

21. Click Save

22. You should now have two tools added to the agent

CopilotStudioTools27


Task: Add tool – Add a row into a table


23. We also need the agent to record the outcome of each mentoring request. This includes logging the requester’s details and the mentor who has been assigned.

To achieve this, we’ll add the Add a row into a table Excel tool, which will be used to add a row to the RequestLogs.xlsx file after a mentor has been selected.

In addition, we’ll add an email tool later in this post so the assigned mentor is notified when a new mentoring request has been assigned to them.

CopilotStudioTools28


24. Select Tools and choose Add a tool. Search for Add a row into a table (Excel Online Business), and select it from the list.

CopilotStudioTools29


25. Click Add and configure

CopilotStudioTools29


26. Click Additional details and change the authentication setting to Maker‑provided credentials, so the tool uses my account.

27. Click Inputs and configure the following settings:

Location: Select Custom value from the drop box, click in the Value box, and choose OneDrive for Business.

Document Library: Select Custom value from the dropdown, click inside the Value box and choose OneDrive.

File: Select Custom value from the dropdown, click inside the Value box, and browse to select file RequestLogs.xlsx.

Table: Select table1

Row: Leave this set to the default (if not already greyed out). We can’t specify a specific row, as new rows will be added dynamically by the agent.

Note: If you’re unable to browse to the file, manually type the name of the Excel file. This can happen if the file has not yet been indexed.

CopilotStudioTools34


28. Click save

Task: Add tool – Send an email


29. Select Tools, then click Add a tool. Search for and select Send an email V2 (Office 365 Outlook)

Agent8


30. If a connection is not already established, click Create connection and sign in

31. Click Add and configure

32. Click Additional details and change the authentication setting from End user credentials to Maker‑provided credentials, so the tool uses my account.

33. Scroll down to Inputs and configure the following:

To: Leave this field dynamic. The agent will determine who to send the email to by analysing the MentorEmail field in the Excel spreadsheet (Mentors.xlsx).

Subject: Select Custom value from the drop down and add a subject, Course Mentor Request

Body: Leave this field dynamic. The agent will generate a suitable email message based on the mentoring request.

That’s it, we’ve successfully added four tools, as shown in the image below.

Agent9


In the next post, we’ll return to the agent instructions we described in part 3 and make some amendments to instruct the agent to use the tools we’ve just created.

Click the following link to continue: Building an Autonomous AI Agent in Copilot Studio – Part 8: Amend Existing Agent Instructions to Use Tools – Cloud Build

Building an Autonomous AI Agent in Copilot Studio – Part 6: Create a Trigger in Copilot Studio

Reading Time: 4 minutes

Welcome to part 6 of this blog post series.

If you missed the previous parts, visit the links below:

In this blog post, I will create a trigger to detect when the Microsoft Form I created in part 1 is submitted by a trainer requesting a mentor to help with preparing for a course delivery.

What is a trigger in Copilot Studio?

A trigger in Copilot Studio defines when an agent should run.

Instead of waiting for a user to start a chat, a trigger allows the agent to run automatically when something happens. For example, when a Microsoft Form is submitted, a trigger can detect that event and start the agent without any user interaction.

Triggers are commonly used for autonomous agents, where the agent reacts to events such as:

  • A Microsoft Form being submitted
  • Data being created or updated
  • A scheduled or system event occurring
  • And many more

When the trigger fires, Copilot Studio passes the event information to the agent, and the agent responds according to the instructions it has been given.

Task: Create a trigger in the Course Mentor Agent to detect and process Microsoft Form submissions.

  1. Select the Overview tab and click Add trigger
Copilot studio9


2. You will find a library of triggers from Power Automate which can be used in Copilot Studio, including:

  • When an item is created or modified in SharePoint
  • When a new response is submitted in Microsoft Forms
  • When a file is created/modified in OneDrive for Business
  • When a feed item is published in RSS
  • When an event is added to a calendar in Google Calendar
  • When a pull request is closed (Git) in Azure DevOps
  • When a task is completed in Planner
  • When a Teams messages is posted or if @mentioned
  • When a new email arrives
  • and many more

Explore the different triggers available. There were 843 triggers available at the time of writing this post.

3. I’ll be selecting When a new response is submitted (Microsoft Forms). Click Next

Copilot studio10


4. The trigger will run using my currently signed‑in account. This can be changed if required.

This trigger uses the apps listed in the image below. A green check means the required connection is set up and ready to use.

Click Next

Copilot studio11


5. Now that I’m connected to Microsoft Forms using my account, the form I created in Part 1 of this blog series is available to select. I select the form and click Create trigger.

Copilot studio12


6. Click Close

Copilot studio13


7. Select the Overview tab. You’ll see that the trigger is now visible.

Copilot studio14


8. I test the trigger to confirm all is ok

Copilot studio15

Copilot studio16


There is still further work to complete before we have a fully functioning autonomous agent. In the next post, I will add tools to my agent, so it has permissions to read the data inside the form, read my Mentors.xlsx file, add a row in my log file RequestLogs.xlsx, and send an email to the assigned mentor.

Click the following link to continue to part 7: Building an Autonomous AI Agent in Copilot Studio – Part 7: Add Tools to a Copilot Studio Agent – Cloud Build

Building an Autonomous AI Agent in Copilot Studio – Part 5: Create an Excel Log File to Record Mentor Requests

Reading Time: < 1 minute


Welcome to part 5 of this blog post series.

If you missed the previous parts, visit the links below:

In this blog post, I’ll create another Excel file and include the columns shown in the screenshot below. We will soon instruct the agent to update the spreadsheet when a form is submitted and a mentor is assigned. This log file will include the requester details and the mentor who was assigned.

I’ve named my Excel file RequestLogs.xlsx and store it in my OneDrive for Business.

Agent7


I now have two Excel files:

  • Mentors.xlsx (Created in Part 4)
  • RequestLogs.xlsx

Join me in the next post, where I will create a trigger in Copilot Studio to detect and retrieve information submitted via the Microsoft Form we created in part 1 of this blog post series.

Click the following link to continue to part 6: Building an Autonomous AI Agent in Copilot Studio – Part 6: Create a Trigger in Copilot Studio – Cloud Build