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 the amount of data an agent can send or how many variables an agent can pass.
In this example, you'll 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
Copilots can use the following types of inputs and outputs with Power Automate flows:
- Number
- String
- Boolean
The following types aren't supported:
- Object
- Date
- Timestamp
- List [String]
- List [Number]
- List [Boolean]
- List [Object]
- List [Date]
- List [Timestamp]
Create a topic and 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 response as, select the pencil icon and rename the variable to userResponse.
On the authoring canvas, select Add node (+). Select Call an action, and then select Create a flow.
In the Power Automate portal, name the flow Echo parameter.
Add input parameters to the flow
In the Microsoft Copilot Studio flow trigger, select Add an input.
Select Text and enter the name String_Input.
Add output parameters to the flow
In the Return value(s) to Microsoft Copilot Studio response action, select Add an output.
Select Text and enter the name String_Output.
For the value of String_Output, select the String_Input variable.
Select Save.
Select variables in the agent topic
On the Microsoft Copilot Studio authoring canvas, select Add node (+), and then select Call an action.
Select the flow you created earlier, Echo parameter.
For String_Input(text) gets value from, select userResponse.
Add a Message node. Select Insert variable, and then select String_Output.
Test your topic in the Test agent pane.
Optionally use literal values for input parameters
Alternatively, instead of using a variable as an action's input parameter, you can type the value directly into the "gets value from" box.