Edit

Share via


Add agent response with the form designer (preview)

[This article is prerelease documentation and is subject to change.]

Add the agent response component to a model-driven app form, which can directly call a Microsoft Copilot Studio topic and display the response to the user. This component builds on the Agent API executeEvent and simplifies usage by not requiring a new custom component. The implicit context of the app, page, and record are available in Copilot Studio.

This component supports the following responses from Copilot Studio:

  • Markdown
  • Adaptive card
  • Image
  • Video

Important

  • This is a preview feature.
  • Preview features aren’t meant for production use and might have restricted functionality. These features are subject to supplemental terms of use, and are available before an official release so that customers can get early access and provide feedback.

Prerequisites

Requires the Allow users to analyze data using an AI-powered chat experience in canvas and model-driven apps environment setting enabled for model-driven apps. More information: Copilot environment settings

Add an agent response component to a form

  1. Open the form designer to create or edit a form. More information: Create a form or Edit a form

  2. In the form designer, select Component on the command bar.

  3. In the Components pane, expand Artificial Intelligence

  4. Drag Agent Response onto the form canvas.

    Agent response in components pane.

  5. In the Add Agent Response dialog, enter the Event name from the topic in Copilot Studio in the Static value box. More information: Find the event name for a topic in Copilot Studio Configure agent response event name

    Note

    The Bind to table column option isn't supported for this component.

  6. Select Save and publish on the command bar.

  7. Open the form in a model-driven app to test the component.

    Note

    The form designer preview displays the warning message "Agent Response is only available when you play the app" since live preview isn't yet supported.

Find the event name for a topic in Copilot Studio

  1. Open the topic in Copilot Studio and find the Trigger node.

  2. Verify the trigger type is A custom client event occurs or Event received.

  3. Within the Trigger node, select Edit.

    Copilot Studio Trigger custom client event.

  4. Within the On Event Activity properties pane, copy the Event name property string value to be passed from the agent response component. More information: Change the trigger for a topic

    Copilot Studio Trigger On Event property pane.

Accessing app context

When the agent response component calls the Copilot Studio topic, it passes context for the app through a set of variables. The following are context variables available as Copilot Studio global variables.

Variable Description
Global.PA__Copilot_Model_PageContext.pageContext.id.guid ID of the table record on the main form
Global.PA__Copilot_Model_PageContext.pageContext.entityTypeName Logical name of the table in the main page
Global.PA__Copilot_Model_PageContext.pageContext.pageName Name of the main page
Global.PA__Copilot_Model_PageContext.pageContext.pageType Type of the main page
Global.PA__Copilot_Model_AppUniqueNameContext.appUniqueNameContext.appUniqueName Unique name of the model-driven app

Accessibility

When the Copilot Studio response is an Adaptive Card, ensure the following best practices are followed to have an accessible experience.

Limitations

  • Agent response component properties currently not supported:

    • Label
    • Hide label
    • Hide on phone
    • Lock
    • Read-only
    • Component width
    • Component height
    • Bind to table column
  • Agent response component doesn't support passing additional context to Copilot Studio. Create a custom component using Agent API executeEvent to support passing more context.

  • Agent response component only supports a read-only adaptive card. Create a custom component using Agent API executeEvent to support client side logic.

  • Agent response component isn't supported for mobile or tablets.

FAQ for Agent APIs and Agent response component

Agent API executeEvent

Overview of the model-driven form designer
Add, configure, move, or delete components on a form