Use input and output variables to pass information
Use variables as input and output parameters to pass information between Power Automate flows and Copilot Studio agents.
Important
An agent can only receive up to 1 MB of data from a flow in a single action. However, there's no limit on how many variables or the amount of data an agent can send.
In this example, you create a flow with an input parameter and return it to an agent as an output parameter.
Prerequisites
- Understand how to create a flow from the Copilot Studio authoring canvas
Supported parameter types
Copilot Studio agents support the following types of input and output parameters for Power Automate flows:
- Number
- String
- Boolean
The following data types aren't supported:
- Object
- Date
- Timestamp
- List [String]
- List [Number]
- List [Boolean]
- List [Object]
- List [Date]
- List [Timestamp]
Create a topic and a flow
Go to the Topics page for your agent.
Create a new topic called Echo message.
Add the trigger phrase echo.
Add a Question node and enter the message "Tell me something and I'll say it back to you."
For Identify, choose User's entire response.
For Save user response as, rename the variable to userResponse.
Select the Add node icon
under the Question node, and select Add an action.
On the Basic actions tab, select New Power Automate flow.
In Power Automate, select the name of the flow and replace it with Echo parameter.
Add an input parameter to the flow
Select the Run a flow from Copilot flow trigger, and select Add an input.
Select Text and enter the name String_Input.
Add an output parameter to the flow
Select the Respond to Copilot response action, and select Add an output.
Select Text and enter the name String_Output.
For the value, enter a slash (
/
) in the box, select Insert dynamic content, and then select the String_Input variable.Select Save.
Call the flow from the topic
In Copilot Studio, select the Add node icon
under the Question node, and select Add an action.
On the Basic actions tab, select the flow you created earlier, Echo parameter.
Set the flow input parameter to the output variable from the Question node: String_Input (string) gets its value from the userResponse variable.
Add a Message node.
Select Insert variable, and then select String_Output.
Select Save.
Test your agent.