Skip to content

Commit 94fd258

Browse files
authored
Merge pull request #7656 from ShawnJackson/azure-ai-foundry-agent-service-how-to
[AQ] edit pass: Azure AI Foundry Agent Service how-to articles
2 parents 3907f53 + c61a2c9 commit 94fd258

File tree

3 files changed

+367
-382
lines changed

3 files changed

+367
-382
lines changed
Lines changed: 87 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Trigger an Azure AI Foundry agent using Logic Apps
2+
title: Trigger an Azure AI Foundry Agent Using Logic Apps
33
description: Use this article to learn how to trigger an AI agent when an event occurs.
44
ms.date: 06/30/2025
55
ms.topic: how-to
@@ -9,157 +9,153 @@ ms.service: azure-ai-foundry
99
ms.subservice: azure-ai-foundry-agent-service
1010
---
1111

12-
# Trigger an agent using Logic Apps (Preview)
12+
# Trigger an agent by using Logic Apps (preview)
1313

14-
To streamline your workflow, you might want to automatically invoke your AI agent when an event occurs, such as receiving a new email, or getting a new customer ticket so that your AI agent can immediately respond to the new event without manual invocation.
14+
To streamline your workflow, you might want to automatically invoke your AI agent when an event occurs. The event might be receiving a new email. Or it might be getting a new customer ticket so that your AI agent can immediately respond to the new event without manual invocation.
1515

16-
To automatically invoke an agent, you can select among hundreds of [triggers](/azure/logic-apps/logic-apps-workflow-actions-triggers) in Azure Logic Apps, and the Azure AI Foundry Agent Service connector.
16+
To automatically invoke an agent, you can select among hundreds of [triggers](/azure/logic-apps/logic-apps-workflow-actions-triggers) in Azure Logic Apps, along with using the Azure AI Foundry Agent Service connector.
1717

18+
## What is a trigger?
1819

19-
## What is a trigger?
20+
A trigger is the first item that you need to add to your workflow. It allows you to connect to a specific service. When a specific event happens in the service, the trigger invokes connectors. In this case, it's a connector for Foundry Agent Service.
2021

21-
A trigger is the first item you need to add to your workflow, which allows you to connect to a specific service. When a specific event happens in this service, the trigger will invoke connectors, in this case a connector for the Azure AI Foundry Agent service.
22+
For example, consider a workflow with the Microsoft Forms connector (which has a trigger) that connects to a specific form. Whenever this form receives a new response, the trigger recognizes it and invokes the connectors by following it in the workflow. You can then pass the form response as a message to your AI agent and use its tools to respond or take proper actions.
2223

23-
For example, consider a workflow with the *Microsoft Forms* connector (which has a trigger) that connects to a specific form. Whenever this form receives a new response, the trigger will recognize it and invoke the connectors following it in the workflow. You can then pass the form response as a message to your AI agent and leverage its tools to respond or take proper actions.
24-
25-
To check if a specific connector has a trigger capability, view its documentation and see if it has a **Trigger** section. For example, the [Triggers](/connectors/microsoftforms/#triggers) section of the *Microsoft Forms* connector.
24+
To check if a specific connector has a trigger capability, view its documentation and see if it has a **Triggers** section. For example, view the [Triggers](/connectors/microsoftforms/#triggers) section of the Microsoft Forms connector.
2625

2726
## Prerequisites
2827

2928
* [An existing agent](../quickstart.md)
3029

31-
## Set up
30+
## Set up
3231

33-
1. Go to the Logic Apps page in the [Azure portal](https://portal.azure.com/#browse/Microsoft.Logic%2Fworkflows).
34-
1. Create a Logic Apps resource. Provide all required information, and select the **consumption - multi-tenant** type.
32+
1. In the [Azure portal](https://portal.azure.com/#browse/Microsoft.Logic%2Fworkflows), go the page for Logic Apps.
33+
1. Create a Logic Apps resource. Provide all required information, and select the **Consumption - multi-tenant** type.
3534

3635
### Assign proper RBAC permissions
3736

38-
**Logic App resource**
37+
For a Logic Apps resource:
3938

40-
1. Navigate to the **identity** page in your Logic App resource.
41-
1. Enable system assigned managed identity.
39+
1. In your Logic Apps resource, go to the **Identity** page.
40+
1. Enable a system-assigned managed identity.
4241
1. Copy the object (principal) ID.
4342

44-
**AI Foundry project**
45-
46-
1. In the Azure portal, navigate to the AI Foundry project that has the AI agent you want to use.
47-
1. Select **access control** and click **add role assignment**.
48-
1. Select at least **Azure AI Project Manager** and click **Next**.
49-
1. Select **User, group, or service principal** and select members
50-
1. Paste the object ID you got from the Logic App resource to search for your Logic App resource. Then select **Finish**.
51-
52-
Once you have assigned the RBAC roles, go back to Logic App resource and click **Logic App designer**. You can add a trigger of your choice to your workflow.
43+
For an Azure AI Foundry project:
5344

54-
## Add Azure AI Foundry Agent Service connectors
45+
1. In the Azure portal, go to the Azure AI Foundry project that has the AI agent that you want to use.
46+
1. Select **Access control** > **Add role assignment**.
47+
1. Select at least **Azure AI Project Manager**, and then select **Next**.
48+
1. Select **User, group, or service principal**, and then select members.
49+
1. Paste the object ID that you got from the Logic Apps resource to search for your Logic Apps resource. Then select **Finish**.
5550

56-
Start by adding the Azure AI Foundry Agent service connectors to your workflow.
51+
After you assign the role-based access control (RBAC) roles, go back to the Logic Apps resource and select **Logic App designer**. You can add a trigger of your choice to your workflow.
5752

58-
1. Click **add an action** and then search for **Azure AI Foundry Agent Service**. This will let you add connectors to your workflow.
53+
## Add Foundry Agent Service connectors to your workflow
5954

60-
:::image type="content" source="../media\triggers\connectors.png" alt-text="A screenshot of the actions added to a workflow." lightbox="../media\triggers\connectors.png":::
55+
1. Select **Add an action**, and then search for **Azure AI Foundry Agent Service**.
6156

62-
1. Depending on your use-case, choose the actions you need.
57+
:::image type="content" source="../media\triggers\connectors.png" alt-text="Screenshot of actions added to a workflow." lightbox="../media\triggers\connectors.png":::
6358

64-
If you want to create a new [thread](../concepts/threads-runs-messages.md#threads) for each new event of your trigger, add the following in sequence:
65-
1. Create thread
66-
1. Create run
67-
1. Get run
68-
1. List messages
59+
1. Depending on your use case, choose the actions that you need.
6960

70-
If you want to create a new [run](../concepts/threads-runs-messages.md#runs) in the same thread for each new event, add the following in sequence:
61+
If you want to create a new [thread](../concepts/threads-runs-messages.md#threads) for each new event of your trigger, add the following connectors in sequence:
62+
1. **Create Thread**
63+
1. **Create Run**
64+
1. **Get Run**
65+
1. **List Messages**
7166

72-
1. Create run
73-
1. Get run
74-
1. List messages
67+
If you want to create a new [run](../concepts/threads-runs-messages.md#runs) in the same thread for each new event, add the following connectors in sequence:
7568

69+
1. **Create Run**
70+
1. **Get Run**
71+
1. **List Messages**
7672

77-
> [!TIP]
78-
> * Since the AI Foundry Agent Service takes time to respond, we recommend adding a **delay** connector between **create run** and **get run**.
79-
> * You can click **parameters** on the top to create reusable parameters for Subscription ID and other values to avoid repetitive work.
73+
> [!TIP]
74+
>
75+
> * Because Foundry Agent Service takes time to respond, we recommend that you add a **Delay** connector between **Create Run** and **Get Run**.
76+
> * To create reusable parameters for the subscription ID and other values so that you can avoid repetitive work, select **Parameters**.
8077
8178
## Create a connection
8279

83-
To create a connection, provide the following information.
84-
85-
* **Connection name**: give your connection a name.
80+
To create a connection, provide the following information:
8681

87-
* **Project name**: your AI Foundry project endpoint. The format is `http://<aiservicename>.services.ai.azure.com/api/projects/<project name>`.
82+
* **Connection name**: The name of your connection.
83+
* **Project name**: Your Azure AI Foundry project endpoint. The format is `http://<aiservicename>.services.ai.azure.com/api/projects/<project name>`.
8884

89-
## Configure the "list thread" connector
85+
## Configure the List Agents connector
9086

91-
The **List Agent** connector only lists all the agents you have in your AI project, you don't need to provide any information for this connector.
87+
The **List Agents** connector only lists all the agents in your AI project. You don't need to provide any information for this connector.
9288

93-
## Configure the "create thread" connector
89+
## Configure the Create Thread connector
9490

95-
The **create thread** connector creates a new [thread](../concepts/threads-runs-messages.md#threads), which is a conversation session between an Agent and a user. Threads store [messages](../concepts/threads-runs-messages.md#messages) and automatically handle truncation to fit content into a model's context. You can configure the **create thread** connector with the following:
91+
The **Create Thread** connector creates a new [thread](../concepts/threads-runs-messages.md#threads), which is a conversation session between an agent and a user. Threads store [messages](../concepts/threads-runs-messages.md#messages) and automatically handle truncation to fit content into a model's context. You can configure the **Create Thread** connector with the following information:
9692

97-
**messages (optional)**: You can add the message you want the AI agent to respond to. Add the role as **user** for the message you want the agent to respond to. It can be the event payload from the trigger, for example a form response field. It can also be a constant message, for example always triggering with the phrase "*what is the latest AI news this week?*"
93+
* **Messages** (optional): You can add the message that you want the AI agent to respond to. Add the role as **user** for the message. The message can be the event payload from the trigger; for example, a form response field. It can also be a constant message; for example, always triggering with the phrase "*what is the latest AI news this week?*"
9894

99-
**Metadata (optional)**: The set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format and querying for objects via an API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
95+
* **Metadata** (optional): You can attach a set of 16 key/value pairs to an object. This approach can be useful for storing additional information about the object in a structured format and querying for objects via an API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
10096

101-
**Tool resources (optional)**: In addition to the tool resources you have provided in your agent, you can provide updated tool resources only applicable to your Thread. An example of tool resource:
97+
* **Tool resources** (optional): In addition to the tool resources that you provided in your agent, you can provide updated tool resources applicable only to your thread. Here's an example of tool resource:
10298

103-
```json
104-
[
105-
{
106-
"type": "bing_grounding",
107-
"bing_grounding": {
108-
"search_configurations": [
109-
{
110-
"connection_id": "/subscriptions/<subscription-id>/resourceGroups/<your_resource_group_name>/providers/Microsoft.CognitiveServices/accounts/<your_ai_service_name>/projects/<your_project_name>/connections/<your_connection_name>",
111-
"count": 7,
112-
"market": "en-US",
113-
"set_lang": "en",
114-
"freshness": "7d"
115-
}
116-
]
99+
```json
100+
[
101+
{
102+
"type": "bing_grounding",
103+
"bing_grounding": {
104+
"search_configurations": [
105+
{
106+
"connection_id": "/subscriptions/<subscription-id>/resourceGroups/<your_resource_group_name>/providers/Microsoft.CognitiveServices/accounts/<your_ai_service_name>/projects/<your_project_name>/connections/<your_connection_name>",
107+
"count": 7,
108+
"market": "en-US",
109+
"set_lang": "en",
110+
"freshness": "7d"
111+
}
112+
]
113+
}
117114
}
118-
}
119-
]
120-
```
115+
]
116+
```
121117

122-
## Configure the "create run" connector
118+
## Configure the Create Run connector
123119

124-
The **create run** connector creates a new [run](../concepts/threads-runs-messages.md#runs), which is an activation of an Agent to begin running based on the contents of the thread. The agent uses its configuration (such as tool resources) and the thread's messages to perform tasks by calling models and tools. As part of a run, the agent appends messages to the thread.
120+
The **Create Run** connector creates a new [run](../concepts/threads-runs-messages.md#runs), which is an activation of an agent to begin running based on the contents of the thread. The agent uses its configuration (such as tool resources) and the thread's messages to perform tasks by calling models and tools. As part of a run, the agent appends messages to the thread.
125121

126-
To configure the **create run** connector, click on it and provide the following information:
122+
To configure the **Create Run** connector, select it and provide the following information:
127123

128-
**Thread ID (required)**: the thread ID of the thread you just created. Click the function icon to select the **ID** parameter from your previous **create thread** connector output.
124+
* **The ID Of The Thread To Create A Message For** (required): The ID of the thread that you created. Select the function icon to select the **id** parameter from your previous **Create Thread** connector output.
129125

130-
:::image type="content" source="../media\triggers\create-run.png" alt-text="A screenshot of the create run connector" lightbox="../media\triggers\create-run.png":::
126+
:::image type="content" source="../media\triggers\create-run.png" alt-text="Screenshot of the Create Run connector." lightbox="../media\triggers\create-run.png":::
131127

132-
**Assistant id (required)**: the ID of the agent you have created.
128+
* **Assistant_id** (required): The ID of the agent that you created.
133129

134-
**Messages (optional)**: you can add the message you want the AI agent to respond to. Add the role as **user** for the message you want the agent to respond to. It can be the event payload from the trigger, for example a form response field. It can also be a constant message, for example always triggering with the phrase "*what is the latest AI news this week?*"
130+
* **Messages** (optional): The message that you want the AI agent to respond to. Add the role as **user** for the message. It can be the event payload from the trigger; for example, a form response field. It can also be a constant message; for example, always triggering with the phrase "*what is the latest AI news this week?*"
135131

136132
> [!TIP]
137-
> Make sure you have added the message either in the run or thread connector. Otherwise, you will run into issues.
133+
> To avoid problems, be sure to add the message in either the run or the thread connector.
138134
139-
## Configure the "get run" connector
135+
## Configure the Get Run connector
140136

141-
The **get run** connector gets and retrieves the run you just created.
137+
The **Get Run** connector gets and retrieves the run that you created. Configure the connector by providing the following information:
142138

143-
**Thread ID parameter (required)**: The thread ID of the thread you just created. Click the function icon to select the **ID** parameter from your previous **create thread** connector output.
139+
* **Thread ID parameter** (required): The ID of the thread that you created. Select the function icon to select the **id** parameter from your previous **Create Thread** connector output.
144140

145-
**Run ID (required)**: the run ID of the run you just created. Click the function icon to select the **ID** parameter from your previous **create run** connector output.
141+
* **Run ID** (required): The ID of the run that you created. Select the function icon to select the **id** parameter from your previous **Create Run** connector output.
146142

147-
## Configure the "list messages" connector
143+
## Configure the List Messages connector
148144

149-
The **list Messages** connector lists all messages in the current thread.
145+
The **List Messages** connector lists all messages in the current thread. Configure the connector by providing the following information:
150146

151-
**Thread ID parameter (required)**: The thread ID of the thread you just created. Click the function icon to select the **id** parameter from your previous **create thread** connector output.
147+
* **Thread ID parameter** (required): The ID of the thread that you created. Select the function icon to select the **id** parameter from your previous **Create thread** connector output.
152148

153-
## Get a response from the Foundry Agent Service
149+
## Get a response from Foundry Agent Service
154150

155-
To get a response, you need a custom function to retrieve the exact response body from **list message** connector.
151+
To get a response, you need a custom function to retrieve the exact response body from the **List Messages** connector:
156152

157-
1. Add the **compose** connector.
153+
1. Add the **Compose** connector.
158154

159-
1. Add the following string function to get just the response back:
155+
1. Add the following string function to get just the response back:
160156

161-
`body('List_Messages')['data'][0]['content'][0]['text']['value']`
157+
`body('List_Messages')['data'][0]['content'][0]['text']['value']`
162158

163-
:::image type="content" source="../media\triggers\get-response.png" alt-text="A screenshot showing the compose connector." lightbox="../media\triggers\get-response.png":::
159+
:::image type="content" source="../media\triggers\get-response.png" alt-text="Screenshot that shows the Compose connector." lightbox="../media\triggers\get-response.png":::
164160

165-
1. Add other connectors if needed. You can click **run** and click **run history** to check the status of your runs.
161+
1. Add other connectors if necessary. To check the status of your runs, select **Run** > **Run history**.

0 commit comments

Comments
 (0)