How to Add Power Automate Actions to AI-Enabled Copilot Studio Agents.
As I continue learning about Copilot Studio, I’m documenting my findings. In this article, I’ll explain how to add Power Automate actions to our previously created agent.
For instructions on creating the base agent, please refer to:
Actions (formerly known as plugins) are used to register “functionalities” to your agent.
The following can be registered as actions:
Connectors/Custom Connectors
Power Automate
AI Builder Prompts
Skills (Azure Bot Framework)
As an example of a Power Automate action, we’ll implement functionality to retrieve a specified user’s schedule in an agent with generative AI enabled.
Note: As of December 26, 2024, setting the agent’s language to “English” is required to enable “Use AI in conversation.”
For information on building actions using connectors, please refer to:
First, open your agent with generative AI enabled and click [Add action].
Then select [New Power Automate flow] from [Add action].
This opens the Power Automate editor, displaying a flow with a trigger that can be called from Copilot and an action to return responses to Copilot. Since we’re adding an action to retrieve a specified user’s schedule, click [Add input] in the trigger,
Add the following parameters. Since agents with generative AI enabled can read parameter descriptions and automatically set arguments when calling actions, it’s important to write detailed descriptions for each parameter.
Note: While we’ve kept the descriptions simple for this example, for better accuracy, consider either providing more detailed descriptions or carefully designing the parameters.
mail: Email address of the user whose schedule you want to retrieve
start: Start date for schedule retrieval (yyyy-MM-dd)
end: End date for schedule retrieval (yyyy-MM-dd)
Next, add an action to retrieve the specified user’s schedule.
Note: Since this API is not the main focus, we’ll skip the detailed explanation. It retrieves appointments for the specified user within the given start and end dates.
Then, parse the JSON results from the schedule retrieval action,
And return the parsed results to Copilot.
Note: While best practice would be to return only the minimum necessary information for the function, for this example, we’ll pass all values to Copilot.
Give it an appropriate name, click [Save] → [Publish], then close this screen.
Note: In a production environment, you would perform unit testing of the flow at this point.
Return to the Copilot screen and click [Refresh],
Select the flow we just created.
Carefully describe when the agent (generative AI) should use this functionality, verify that the parameters and outputs are properly reflected, then complete the implementation by clicking [Add action].
Note: This is fundamentally similar to GPT models’ “Tools” (formerly Function calling).
Testing (Creating Connections)
Add some sample appointments to another user’s calendar.
When asking Copilot about the user’s schedule, you’ll see a message about adding (updating) a connection. Click [Connect],
Go to [Manage connections], click [Connect], and set it to [Connected].
When asking the same question again, the agent will respond with the user’s schedule.
Issues like UTC time display and “Busy” status in schedules could be due to various factors:
Insufficient agent instructions (suboptimal system prompt)
Unfiltered response content (raw API results)
Inadequate response descriptions
In a production environment, these aspects should be properly designed and configured for better accuracy.
While we manually entered email addresses to specify users in this example, since we’re using AI, it would be more convenient to retrieve schedules using Japanese user names.
In the next article, we’ll explore using orchestration features to retrieve schedules using user names.
コメント