How to Use Prompt Actions with AI Builder in Copilot Studio: Complete Tutorial for Generating AI Responses

This article explains how to use AI Builder’s “Prompts” from Copilot Studio.

スポンサーリンク

Using Generative AI from Copilot Studio

There are two straightforward ways to use generative AI from Copilot Studio:

  • Generative responses
  • Prompt actions (AI Builder)

While it’s also possible to connect to AI services like Azure OpenAI through custom connectors or Power Automate, starting with these two methods is probably the best approach.

In this article, I’ll explain how to use AI Builder’s “AI Prompts” from Copilot Studio actions (Prompt actions).

Prompt Actions

Prompt actions are a feature that allows you to call AI Builder’s “AI Prompts” from Copilot Studio,
Screenshot showing AI Builder prompt selection in Copilot Studio
They make it easy to use GPT-based AI (4o or 4o-mini) as actions.
Screenshot showing GPT model selection options in AI Builder
You can easily create simple question-answer interactions with AI from Copilot Studio,
Screenshot showing a sample prompt configuration with question-answer format
And by passing conversation history, you can enable context-aware conversations that consider previous interactions.
Screenshot showing conversation history configuration in prompt actions

Basic Usage

First, let’s try a simple example where we have the AI answer a user’s question. After the “Question” node, select [Call an action] and then [Create a prompt].
Screenshot showing how to select Create a prompt from Call an action menu
Add a text input by clicking [Add] in the top right,
Screenshot showing how to add text input from the Add menu
Set the input name (argument name),
Screenshot showing how to set the input name for the prompt
Click [Save custom prompt] to complete the basic prompt action setup.
Screenshot showing the save custom prompt button
Now simply pass the user input content obtained from Copilot Studio’s “Question” node directly to the prompt’s argument,
Screenshot showing how to pass user input to prompt argument
The AI’s response will be stored in a variable (res.text), so just display that in a message to complete the implementation.
Screenshot showing how to display the AI response variable
This enables easy conversation with AI.
Screenshot showing the conversation with AI in action
By the way, you can easily change the model from [Settings]. Choose the model that balances the accuracy required for your action with cost considerations to be budget-friendly.
Screenshot showing model selection options in settings

Generating Responses with Data Retrieved from Other Nodes

Using prompt actions, you can quickly build simple RAG implementations. For example, if you create a topic about asking for weather,
Screenshot showing a weather inquiry topic creation in Copilot Studio
Add a “Get today’s forecast” connector,
Screenshot showing how to add a weather forecast connector
Retrieve the weather forecast using the city name obtained through slot filling.
Screenshot showing slot filling configuration to get weather by city name
Then prepare a prompt like this,
Screenshot showing a weather forecast prompt template
Pass the return values from the weather forecast connector (morning and afternoon weather forecast summaries) to the prompt action.
Screenshot showing how to pass weather data to the prompt action
This easily creates a topic that provides the latest weather forecast.
Screenshot showing the final result of the weather forecast topic in action

Generating Responses with Data Retrieved from Dataverse

AI prompts can also integrate with Dataverse. For example, if you have a table like this,
Screenshot showing a Dataverse table with cat information
Prepare arguments like “cat name (cat_name)” and “today’s date (today)”, and create a prompt integrated with the cat table.
Screenshot showing prompt configuration with Dataverse integration
When you call the prompt action with user input and the Today function as arguments, it retrieves information from Dataverse and generates responses like this.
Screenshot showing the response generated from Dataverse data

Structured Output (JSON Mode)

Prompt actions also support structured output, allowing you to specify the format of the AI’s response (JSON schema).
Screenshot showing JSON schema configuration in prompt actions

Bonus: Prompts Can Be Included in Solutions

The prompt actions you create can be included in solutions, so they can be managed through Power Platform ALM.
Screenshot showing how to add prompt actions to a Power Platform solution

Related Articles

コメント

Copied title and URL