You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Trigger an Azure AI Foundry agent using Logic Apps
2
+
title: Trigger an Azure AI Foundry Agent Using Logic Apps
3
3
description: Use this article to learn how to trigger an AI agent when an event occurs.
4
4
ms.date: 06/30/2025
5
5
ms.topic: how-to
@@ -9,157 +9,153 @@ ms.service: azure-ai-foundry
9
9
ms.subservice: azure-ai-foundry-agent-service
10
10
---
11
11
12
-
# Trigger an agent using Logic Apps (Preview)
12
+
# Trigger an agent by using Logic Apps (preview)
13
13
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.
15
15
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.
17
17
18
+
## What is a trigger?
18
19
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.
20
21
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.
22
23
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.
26
25
27
26
## Prerequisites
28
27
29
28
*[An existing agent](../quickstart.md)
30
29
31
-
## Set up
30
+
## Set up
32
31
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.
35
34
36
35
### Assign proper RBAC permissions
37
36
38
-
**Logic App resource**
37
+
For a Logic Apps resource:
39
38
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.
42
41
1. Copy the object (principal) ID.
43
42
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:
53
44
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**.
55
50
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.
57
52
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 Serviceconnectors to your workflow
59
54
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**.
61
56
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":::
63
58
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.
69
60
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**
71
66
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:
75
68
69
+
1.**Create Run**
70
+
1.**Get Run**
71
+
1.**List Messages**
76
72
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**.
80
77
81
78
## Create a connection
82
79
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:
86
81
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>`.
88
84
89
-
## Configure the "list thread" connector
85
+
## Configure the List Agents connector
90
86
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.
92
88
93
-
## Configure the "create thread" connector
89
+
## Configure the Create Thread connector
94
90
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:
96
92
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?*"
98
94
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.
100
96
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:
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.
125
121
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:
127
123
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.
129
125
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":::
131
127
132
-
**Assistant id (required)**: the ID of the agent you have created.
128
+
***Assistant_id**(required): The ID of the agent that you created.
133
129
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?*"
135
131
136
132
> [!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.
138
134
139
-
## Configure the "get run" connector
135
+
## Configure the Get Run connector
140
136
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:
142
138
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.
144
140
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.
146
142
147
-
## Configure the "list messages" connector
143
+
## Configure the List Messages connector
148
144
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:
150
146
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.
152
148
153
-
## Get a response from the Foundry Agent Service
149
+
## Get a response from Foundry Agent Service
154
150
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:
156
152
157
-
1. Add the **compose** connector.
153
+
1. Add the **Compose** connector.
158
154
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:
:::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":::
164
160
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