Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Learn how to use a cloud flow in Copilot Studio by giving an agent the ability to produce a weather forecast on request. In this first example, you create a flow that fetches a weather forecast. In the next example, you set up a topic to call the flow as an action so the agent can respond with the forecast when a customer asks about the weather.
To work as a tool with agents, an agent flow requires the following:
- Have the When an agent calls the flow trigger and a response action of Respond to the agent.
- Be configured to respond in real time, not asynchronously. The Asynchronous reponse toggle must be set to Off under Networking in the Respond to the agent action settings.
- Respond to the agent within the 100 second action limit. Optimize the flow logic, queries, and the amount of data returned so that a typical run is below this 100 second limit. Actions in the flow that need to run longer can be placed after the Respond to Copilot action to continue to run up to the flow run duration limit of 30 days. For guidance on how to speed up your flows, see Speed up agent flow execution with express mode.
When you create an agent flow in Copilot Studio as a new tool added to an agent, the required flow trigger and response action are added for you. You can modify an existing flow for use with agents by updating it to use this trigger and this response action.
Prerequisites
- Access to Copilot Studio with a license that includes the use of flows in Copilot Studio.
Create a flow you can use with an agent
In this example, you create a flow that fetches the current weather forecast from MSN Weather. You add the flow as a tool to an existing agent topic.
Add an empty new agent flow to a topic and save it
Go to the Topics page for your agent.
Open the topic from which you want to call a flow.
Select the Add node icon
below any node, and select Add a tool.On the Basic tools tab, select New Agent flow.
The Agent flows page opens, with a starter flow template open in the agent flows designer for editing. The flow includes the required When an agent calls the flow trigger and Respond to the agent action.
Select Publish to save the flow before making any changes. A notification appears when the flow is created successfully.
Select Go back to agent to return to your topic. A new Action node is added to your topic for the flow.
Select Save to finish adding the flow as a tool to your agent.
Add actions and configure the flow
With a basic template created for the flow, and the flow added to your agent topic, you can now return to add actions to your flow. In this example, you add an action that fetches the current forecast from MSN Weather.
On the Action node with the flow, select the View flow details link to return to the agent flow.
On the Overview page, under Details, edit the name of the flow to something meaningful, such as "Get weather forecast".
Go to the designer, select the When an agent calls the flow flow trigger, and add the following input parameters:
- City (Text)
- ZIP code (Number)
Select the Add icon below the When an agent calls the flow flow trigger.
In Add an action, search for "MSN weather", and select the Get forecast for today action.
In the Get forecast for today panel, in the Location box, enter a slash (
/), select Insert dynamic content, and then select your City input parameter.Proceed in the same fashion to add your ZIP code input parameter.
In the Respond to the agent action, add the following output parameters and variables:
Output parameter Type Variable day_summaryText Day Summary locationText Location chance_of_rainNumber Day Rain Chance
Select Publish. A notification appears when the flow is created successfully.
To continue, follow the instructions in Call an agent flow from an agent.
Manage which connections are used by the flow
In a supported authenticated agent, cloud flows can be configured to use user credentials when they're run as part of a generative orchestration plan or called from a topic. Using the flow in a supported channel doesn't require any special configuration in your agent. Customers are able to manage their connections while using the agent.
Cloud flows in environments using customer-managed keys (CMK) can't yet be run with customer credentials as part of generative orchestration plans or from topics. Ensure the run-only settings for cloud flows in CMK environments are set to specific connections instead of Provided by run-only user.