Infinity AI Agents for Power Apps & Dynamics 365 Documentation

Infinity AI Agents for Power Apps & Dynamics 365 is a powerful no-code add-on that seamlessly embeds Generative AI capabilities directly into your Dataverse records.

Installation

  1. Download the latest solution. The solution will be emailed through to you automatically within a few minutes.

  2. Install the solution.

    1. Navigate to your Power Apps environment via https://make.powerapps.com

    2. Go to Solutions and click Import solution.

    3. Browse and select the downloaded solution file.

    4. During the import process, you will be prompted for environment variables.

      • AI Key: TRIAL (automatically updated after activating your license, or enter your existing Subscription Key)

      • API Version: Latest (allows for targeting specific versions)

    5. Follow the on-screen prompts to complete the solution import.

Creating an AI Agent

Once the solution is installed, you can begin configuring your AI Agents. Watch this quick 5 minute video or follow the steps below.

Open the AI Agents App

  1. From your Power Apps environment, launch the AI Agents model-driven app.

  2. On the command bar, click + New to create a new AI Agent.

If this is the first time accessing the app, you’ll be prompted to activate your license. This will automatically generate a Subscription Key for your organisation.

Configure General Settings

  • Name: Provide a descriptive name for your AI Agent (e.g., "Email Sentiment").

  • Table Name: Select the Dataverse table that this AI Agent will operate on (e.g., account).

  • Display Area: Choose where the AI Agent button will appear within your Power Apps/Dynamics 365 interface, or if it should run automatically.

    • Form (Update Form): Displays the button on the record's update form.

    • Form (Create Form): Displays the button on the record's creation form.

    • View (Single Record): Displays the button when a single record is selected in a view.

    • View (Multiple Records): Displays the button when multiple records are selected in a view.

    • Run On Load (Update Form): Automatically triggers the agent when an update form loads.

    • Run On Load (Create Form): Automatically triggers the agent when a create form loads.

  • Display Name: A different name to display on the button/menu if desired, otherwise uses the Name by default.

  • Group Name: Group multiple AI Agents under a single menu item.

  • Icon: Choose an icon to visually represent your AI Agent.

  • Status Reason: Initially set to Draft. Change to Activated when you are ready to use the agent.

Define the Prompt

  • Prompt: This is the core instruction for your AI Agent. Clearly describe what you want the AI to do using natural language. If you need help feel free to get in touch with us.

  • Filter Profanity: (For text outputs) Check this box to filter out inappropriate language from the AI's response.

  • Professional: (For text outputs) Check this box to encourage a professional tone in the AI's response.

Configure the Response

  • Response Format: Select how the AI Agent's output will be displayed or used.

    • Multiple Lines of Text: Standard text output.

    • Single Line of Text: For short text fields.

    • HTML / Rich Text: For rich text fields or web resources.

    • Chart / Visualisation: Generates a chart based on the data.

    • JSON Object: Returns structured JSON data, useful for Power Automate.

    • Code (JavaScript): Returns JavaScript code, useful for advanced integrations.

  • Output Options: Choose where the generated response will appear.

    • Output to Dialog: Displays the response in a pop-up dialog.

    • Output to Column: Writes the response directly into a specified Dataverse column.

    • Output to Side Pane: Displays the response in a dedicated side panel.

    • Output to Notification: Shows the response as a global notification.

    • Output to JS (Preview): Executes custom JavaScript with the response (advanced).

  • Response Example: Provide an example output which the AI can use to structure the response. Useful for JSON outputs, or text outputs that need to follow a set format.

Build the Data Schema (Schema Builder)

Click Schema Builder on the command bar. This is crucial for defining exactly which data from your Dataverse records will be provided to the AI Agent.

Tip: Providing only relevant, high-quality data significantly improves AI accuracy and reduces credit usage.

  • Main Table:

    • The primary table (e.g., Account) is pre-selected.

    • Add specific columns from this table that the AI Agent should include.

  • Related Tables:

    • Click the + icon under "Related" to add related Dataverse tables.

    • LinkFrom/LinkTo: These fields will typically auto-populate based on the relationship.

    • Related Fields: Click the + icon under "Fields" for the related table to specify which columns from the related table should be included.

    • Advanced Filters (for Related Tables): Click Advanced Filters to refine the data from related tables.

    • FilterXml: Enter custom FetchXML conditions to filter the related records.

    • Example: To only include emails from the last 6 months, add: <condition attribute="createdon" operator="last-x-years" value="6" />

    • OrderBy: Select a field to sort the related records (e.g., Actual End (actualend)).

    • Order: Choose Ascending or Descending.

    • Top: Limit the number of related records returned (up to 5000).

    • Aggregate: Select an aggregate for simple queries to include a SUM, COUNT, or another aggregate.

  • Nested Related Tables: You can add further nested related tables within a related table.
    Adding nested tables may cause results to become increasingly large. Use the advanced filters to keep queries small.

Test the AI Agent

  • Test Payload Schema:

    • From the Preview menu on the command bar, select Test Payload Schema.

    • Select a record to test against.

    • This will display the exact JSON data that will be sent to the AI Agent, allowing you to verify that your schema includes all the necessary and relevant data.

  • Preview AI Agent:

    • From the Preview menu on the command bar, select Preview AI Agent.

    • Select a record to test against.

    • This will execute the AI Agent with the specified data and display the output according to your configured response format and output options. The estimated credits used will be displayed in the dialog heading.

If you’re getting unexpected responses from the AI Agent or you need any help setting up your prompts, get in touch with us and we will help you get exactly what you need out of this AI Agent.


Activate AI Agent

Once you are satisfied with the AI Agent's configuration and output, change the Status Reason to Activated and Save the AI Agent. Once activated, the AI Agent will appear for users in the AI Agents command bar menu for the configured Display Area of the primary table.

Running the AI Agent

Once your AI Agent is activated, it's ready for use within your Power Apps or Dynamics 365 environment.

  1. Navigate to Your App: Open any relevant model-driven app (e.g., Sales Hub).

  2. Open a Record: Go to the record type you configured for your AI Agent (e.g., an Account record).

  3. AI Agents Menu: On the command bar, you will see an AI Agents menu.

  4. Select Your Agent: Click the AI Agents menu and select your configured AI Agent (e.g., "Email Sentiment").
    A global notification will appear, indicating that the AI Agent is processing your request.

  5. View Response: Once the AI Agent completes its task, the response will be displayed in the configured output area (e.g., a dialog, or in the side pane).

Advanced Concepts

Using Parameters

Parameters allow you to make your AI Agents more dynamic and user-interactive by enabling users to provide additional context or specific instructions at runtime.

  • Add Parameters to Your Prompt:

    When editing the AI Agent's prompt, you can insert placeholders for user input.

    Either click the Add Parameter button next to the prompt field, or simply type the parameter name enclosed in double curly brackets, e.g., {{Year}} or {{Customer Name}}.

    Example: Instead of "Summarize the account," you could use "Summarize the account for the last {{Months}} months."

  • User Input at Runtime:

    When you run or preview an AI Agent that contains parameters, a dialog box will appear, prompting the user to enter a value for each defined parameter.

    The user's response will be inserted directly into the prompt at the position of the placeholder before the request is sent to the AI.



Power Automate Integration

For complex, automated workflows, AI Agents can be triggered via Power Automate flows. When configuring the 'Response Format' to 'JSON Object', the AI Agent's output can be easily consumed and processed by Power Automate, enabling powerful backend automation.

  1. From a Power Automate Flow, add an Action for Dataverse: Perform an unbound action.

  2. Select the action: mag_GetResponseFromAIAction.

  3. Enter the parameters for your AI Agent.

    • AIAgentId (required): The ID (GUID) of the AI Agent record to run. Note: This is just the ID, without any OData notation.

    • RecordIds: The ID (GUID) of the primary table row to run the AI Agent on. Pass through multiple record IDs using a comma separator. Note: This is just the IDs, without any OData notation.

    • Parameters: If the AI Agent prompt contains dynamic parameters/placeholders, values can be passed through as a JSON object containing key/value pairs with the parameter ID and value, e.g.:

      { "Months": "6", "Year": "2025" }
  4. The output from the AI Agent will become available from the Response output parameter, which can be used by Power Automate.
    If your output format is JSON, you can use the Parse JSON action to access your properties.



Custom JavaScript (JS) Output

The 'Output to JS (Preview)' option provides advanced users and developers the ability to execute custom JavaScript functions with the AI Agent's response. This allows for highly customized UI updates or integrations beyond the standard output options. It’s important to understand the risks of running AI generated code in your system. Ensure your prompt and examples are well defined.

Tips for Best Results

Be Specific in Your Prompts: The more detailed and precise your prompt, the better the AI's understanding and the more accurate and relevant its output will be.

Curate Your Data: Use the Schema Builder to include only the necessary fields and related tables. Avoid providing excessive or irrelevant data, as this can confuse the AI and increase processing time and costs.

Leverage Filters: Utilize FetchXML filters, OrderBy, and Top options in the Schema Builder to narrow down the dataset provided to the AI, ensuring it focuses on the most relevant information.

Thorough Testing: Always preview your AI Agent with various sample records to ensure the data schema is correctly configured and the AI's output consistently meets your expectations.


Need any help?

Get in touch with our team if you need any help setting up your AI Agents or getting started.