Делите путем


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

  1. Go to the Topics page for your agent.

  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 user response as, rename the variable to userResponse.

    Screenshot of a Question node that collects the user's response.

  7. Select the Add node icon under the Question node, and select Add an action.

  8. On the Basic actions tab, select New Power Automate flow.

  9. In Power Automate, select the name of the flow and replace it with Echo parameter.

Add an input parameter to the flow

  1. Select the Run a flow from Copilot flow trigger, and select Add an input.

  2. Select Text and enter the name String_Input.

    Screenshot of the flow trigger input parameter.

Add an output parameter to the flow

  1. Select the Respond to Copilot response action, and select Add an output.

  2. Select Text and enter the name String_Output.

    Screenshot of the response action output parameter.

  3. For the value, enter a slash (/) in the box, select Insert dynamic content, and then select the String_Input variable.

  4. Select Save.

Call the flow from the topic

  1. In Copilot Studio, select the Add node icon under the Question node, and select Add an action.

  2. On the Basic actions tab, select the flow you created earlier, Echo parameter.

  3. Set the flow input parameter to the output variable from the Question node: String_Input (string) gets its value from the userResponse variable.

    Screenshot of the Action node that calls the 'Echo parameter' flow.

  4. Add a Message node.

  5. Select Insert variable, and then select String_Output.

    Screenshot of the message node that echoes the user input.

  6. Select Save.

  7. Test your agent.

    Screenshot of an agent conversation.