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 copilots.

Important

A copilot 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 a copilot can send or how many variables a copilot can pass.

In this example, you'll create a flow with an input parameter and return it to a copilot 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

  1. Go to the Topics page for your copilot.

  2. Create a new topic called Echo message.

  3. Add the trigger phrase echo.

  4. Add a Question node and enter the message Tell me something and I'll say it back to you.

  5. For Identify, choose User's entire response.

  6. For Save response as, select the pencil icon and rename the variable to userResponse.

    Screenshot of a Question node.

  7. On the authoring canvas, select Add node (+). Select Call an action, and then select Create a flow.

  8. In the Power Automate portal, name the flow Echo parameter.

Add input parameters to the flow

  1. In the Microsoft Copilot Studio flow trigger, select Add an input.

    Screenshot of a Microsoft Copilot Studio flow trigger, with Add an input highlighted.

  2. Select Text and enter the name String_Input.

    Screenshot of the flow trigger input.

Add output parameters to the flow

  1. In the Return value(s) to Microsoft Copilot Studio response action, select Add an output.

    Screenshot of the flow response action, with Add an output highlighted.

  2. Select Text and enter the name String_Output.

    Screenshot of the response action output.

  3. For the value of String_Output, select the String_Input variable.

    Screenshot of an input parameter selected as the value of an output parameter.

  4. Select Save.

Select variables in the copilot topic

  1. On the Microsoft Copilot Studio authoring canvas, select Add node (+), and then select Call an action.

  2. Select the flow you created earlier, Echo parameter.

  3. For String_Input(text) gets value from, select userResponse.

  4. Add a Message node. Select Insert variable, and then select String_Output.

    Screenshot of an Action node for the Echo parameter flow.

  5. Test your topic in the Test copilot pane.

    Screenshot of a copilot conversation.

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.

Screenshot of a literal value passed as an input parameter.