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
# Work with Azure AI Foundry Agent Service in Visual Studio Code (Preview)
18
19
19
-
After you [get started with the AI Foundry the VS Code extension](./get-started-projects-vs-code.md), you can work with [Azure AI Foundry Agent Service](/azure/ai-services/agents/overview). Agents are "smart" microservices that:
20
+
After you [get started with the AI Foundry the VS Code extension](./get-started-projects-vs-code.md), use [Azure AI Foundry Agent Service](/azure/ai-services/agents/overview) to build agents. Agents are "smart" microservices that:
20
21
21
22
- Answer questions using their training data or search other sources with Retrieval Augmented Generation (RAG)
22
23
- Perform specific actions
@@ -92,7 +93,7 @@ tools: []
92
93
93
94
Azure AI Agent Service has a set of tools that you can use to interact with your data sources.
94
95
95
-
#### Available tools for Azure AI Agents in the Azure AI Foundry VS Code extension
96
+
### Available tools for Azure AI Agents in the Azure AI Foundry VS Code extension
96
97
97
98
The following tools are available in the Azure AI Foundry VS Code extension:
98
99
@@ -105,36 +106,36 @@ The following tools are available in the Azure AI Foundry VS Code extension:
105
106
> [!NOTE]
106
107
> For more information about using MCP tools, see [Use Model Context Protocol (MCP) tools with Azure AI Agents](./vs-code-agents-mcp.md).
107
108
108
-
#### Add a tool to the AI Agent
109
+
### Add a tool to the AI Agent
109
110
110
111
Add a tool to the AI Agent with the following steps:
111
112
112
113
1. Select the **Add tool** button in the top-right corner of the **TOOL** section in the designer to show the dropdown. Choose the tool you want to add.
113
114
114
-
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-tool-plus.png" alt-text="Screenshot of the Agent designer TOOL section with the plus icon highlighted." lightbox="../../media/how-to/get-started-projects-vs-code/agent-tool-plus.png":::
115
+
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-tool-plus.png" alt-text="Screenshot of the Agent designer TOOL section with the plus icon highlighted." lightbox="../../media/how-to/get-started-projects-vs-code/agent-tool-plus.png":::
115
116
116
-
1. The designer displays the appropriate pane to configure the tool, as in the following images:
117
-
Code interpreter tool dialog box:
118
-
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-ci-tool-dialog.png" alt-text="Screenshot of the Code interpreter tool dialog box." lightbox="../../media/how-to/get-started-projects-vs-code/agent-ci-tool-dialog.png":::
117
+
1. The designer displays the appropriate pane to configure the tool, as in the following images:
119
118
120
-
File upload tool dialog box:
121
-
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-file-search-tool-dialog.png" alt-text="Screenshot of the File upload tool dialog box." lightbox="../../media/how-to/get-started-projects-vs-code/agent-file-search-tool-dialog.png":::
122
-
123
-
Grounding with Bing Search dialog box:
124
-
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-bing-tool-dialog.png" alt-text="Screenshot of the Grounding with Bing Search tool dialog box." lightbox="../../media/how-to/get-started-projects-vs-code/agent-bing-tool-dialog.png":::
119
+
- Code interpreter tool dialog box:
120
+
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-ci-tool-dialog.png" alt-text="Screenshot of the Code interpreter tool dialog box." lightbox="../../media/how-to/get-started-projects-vs-code/agent-ci-tool-dialog.png":::
125
121
126
-
OpenAPI 3.0 Specified dialog box:
127
-
128
-
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-openapi-tool-dialog.png" alt-text="Screenshot of the OpenAPI 3.0 Specified tool dialog box." lightbox="../../media/how-to/get-started-projects-vs-code/agent-openapi-tool-dialog.png":::
122
+
- File upload tool dialog box:
123
+
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-file-search-tool-dialog.png" alt-text="Screenshot of the File upload tool dialog box." lightbox="../../media/how-to/get-started-projects-vs-code/agent-file-search-tool-dialog.png":::
124
+
125
+
- Grounding with Bing Search dialog box:
126
+
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-bing-tool-dialog.png" alt-text="Screenshot of the Grounding with Bing Search tool dialog box." lightbox="../../media/how-to/get-started-projects-vs-code/agent-bing-tool-dialog.png":::
127
+
128
+
- OpenAPI 3.0 Specified dialog box:
129
+
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-openapi-tool-dialog.png" alt-text="Screenshot of the OpenAPI 3.0 Specified tool dialog box." lightbox="../../media/how-to/get-started-projects-vs-code/agent-openapi-tool-dialog.png":::
129
130
130
-
1. After entering the required information, select the **Upload and save** button in the bottom-left corner.
131
+
1. After entering the required information, select the **Upload and save** button in the bottom-left corner.
131
132
132
-
> [!NOTE]
133
-
> When you add a tool, you can also add any new assets it needs. For example, if you add a File Search tool, you can use an existing vector store asset or make a new asset for your vector store to host your uploaded files.
133
+
> [!NOTE]
134
+
> When you add a tool, you can also add any new assets it needs. For example, if you add a File Search tool, you can use an existing vector store asset or make a new asset for your vector store to host your uploaded files.
134
135
135
-
1. After entering the required information, select the **Create tool** button in the bottom-left corner.
136
+
1. After entering the required information, select the **Create tool** button in the bottom-left corner.
136
137
137
-
### Create Azure AI Agents on the Azure AI Foundry Studio
138
+
## Create Azure AI Agents on the Azure AI Foundry Studio
138
139
139
140
Create your agent directly on Azure AI Foundry with the following steps:
140
141
@@ -146,7 +147,7 @@ Create your agent directly on Azure AI Foundry with the following steps:
146
147
147
148
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-deployed.png" alt-text="Screenshot of the 'Azure Resources' view. The deployed agent is highlighted under the 'Agents' subsection." lightbox="../../media/how-to/get-started-projects-vs-code/agent-deployed.png":::
148
149
149
-
#### View the deployed AI Agent details
150
+
### View the deployed AI Agent details
150
151
151
152
Selecting the deployed agent opens the **Agent Preferences** page in a view only mode.
152
153
@@ -156,14 +157,14 @@ Selecting the deployed agent opens the **Agent Preferences** page in a view only
156
157
157
158
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/deployed-agent-view.png" alt-text="Screenshot of the Agent Preferences page with the 'Edit Agent', 'Open Code File', and 'Open Playground' buttons highlighted." lightbox="../../media/how-to/get-started-projects-vs-code/deployed-agent-view.png":::
158
159
159
-
### Edit and update the deployed AI Agent
160
+
## Edit and update the deployed AI Agent
160
161
161
162
To edit the deployed agent, select the **Edit Agent** button in the **Agent Preferences** page. The agent designer opens with the agent .yaml file.
162
163
Edit the agent's configuration, such as the model, tools, and instructions. After you finish editing, select the **Update on Azure AI Foundry** button in the lower left corner to save your changes.
163
164
164
165
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/update-agent.png" alt-text="Screenshot of the Agent Preferences page with the 'Update on Azure AI Foundry' button highlighted." lightbox="../../media/how-to/get-started-projects-vs-code/update-agent.png":::
165
166
166
-
### Explore the agent sample code
167
+
## Explore the agent sample code
167
168
168
169
Create a sample code file using the following steps.
169
170
@@ -183,13 +184,13 @@ Create a sample code file using the following steps.
183
184
184
185
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/choose-agent-authn-method.png" alt-text="Screenshot of the Choose authentication method dropdown for agent code file selection." lightbox="../../media/how-to/get-started-projects-vs-code/choose-agent-authn-method.png":::
185
186
186
-
#### Explore the sample code file
187
+
### Explore the sample code file
187
188
188
189
This Python sample code file that demonstrates a basic call to interact with the agent through the AI Foundry projects API:
Open the **Agents Playground** using the following steps:
195
196
@@ -204,6 +205,18 @@ Open the **Agents Playground** using the following steps:
204
205
1. Type your prompt and see the outputs. In this example, the **Grounding with Bing search** tool is used to search the web for information. The agent uses the model and tools you configured in the agent designer. The source of the information is displayed in the **Agent Annotations** section, highlighted in the following image.
205
206
206
207
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/agent-playground-run.png" alt-text="Screenshot of the Agents Playground page with agent annotations highlighted in VS Code." lightbox="../../media/how-to/get-started-projects-vs-code/agent-playground-run.png":::
208
+
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/choose-agent-language.png" alt-text="Screenshot of the Choose language dropdown for agent code file selection." lightbox="../../media/how-to/get-started-projects-vs-code/choose-agent-language.png":::
209
+
210
+
1. In the top center, select your preferred authentication method to use in the **Choose auth method** dropdown and press Enter.
211
+
212
+
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/choose-agent-authn-method.png" alt-text="Screenshot of the Choose authentication method dropdown for agent code file selection." lightbox="../../media/how-to/get-started-projects-vs-code/choose-agent-authn-method.png":::
213
+
214
+
### Explore the sample code file
215
+
216
+
This Python sample code file that demonstrates a basic call to interact with the agent through the AI Foundry projects API:
@@ -229,7 +242,149 @@ Select the **View run info** button in the **Thread Details** page to see the ru
229
242
230
243
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/run-file.png" alt-text="Screenshot of the run details .json file." lightbox="../../media/how-to/get-started-projects-vs-code/run-file.png":::
231
244
232
-
## Cleanup resources
245
+
## Work with Multi-Agent Workflows
246
+
The AI Foundry VS Code extension enables you to create multi-agent workflows. A multi-agent workflow is a sequence of agents that work together to accomplish a task. Each agent in the workflow can have its own model, tools, and instructions.
247
+
248
+
### Create a new multi-agent workflow
249
+
Create a new multi-agent workflow with the following steps:
250
+
1. Open Command Palette (`Ctrl+Shift+P`).
251
+
1. Run command: `>Azure AI Foundry: Create a New Multi-agent Workflow`.
252
+
1. Select programming language.
253
+
1. Select a folder to save your new workflow.
254
+
1. Enter a name for your workflow project.
255
+
1. A new folder is created with the necessary files for your multi-agent workflow project, including a sample code file to get you started.
256
+
257
+
### Install Dependencies
258
+
259
+
Install the required dependencies for your multi-agent workflow project. The dependencies vary based on the programming language you selected when creating the project.
C# workflows require nightly builds from Microsoft's GitHub Packages, follow these steps to set it up:
273
+
1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token (classic)
274
+
1. Create a GitHub Personal Access Token with the `read:packages` scope using these [instructions](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic)
275
+
1. Copy the generated token (it will start with `ghp_`) and save it securely - you won't be able to see it again.
276
+
277
+
278
+
279
+
#### Update NuGet Configuration
280
+
281
+
In `Nuget.Config`, replace the following placeholders:
282
+
```xml
283
+
<add key="Username" value="YOUR_GITHUB_USERNAME" /> <!-- Replace with your GitHub username -->
284
+
<add key="ClearTextPassword" value="YOUR_GITHUB_PERSONAL_ACCESS_TOKEN" /> <!-- Replace with your GitHub PAT -->
285
+
```
286
+
287
+
::: zone-end
288
+
289
+
### Run your multi-agent workflow locally
290
+
291
+
::: zone pivot="csharp"
292
+
293
+
Before running locally with `dotnet run`, ensure you have configured the required environment variables. You can obtain these values from the Azure AI Foundry portal.
294
+
Before running locally with `dotnet run`, ensure you have configured the required environment variables. You can obtain these values from the Azure AI Foundry portal.
295
+
296
+
1. Configure your environment variables based on your operating system:
Visualize your multi-agent workflows using the Azure AI Foundry VS Code extension. This allows you to see the interactions between different agents and how they collaborate to achieve the desired outcome.
349
+
350
+
To monitor and visualize your multi-agent workflow execution in real-time (currently available for Python interactive mode only):
351
+
352
+
1. Open the Command Palette (`Ctrl+Shift+P`)
353
+
1. Run the command: `>Azure AI Foundry: Visualize the Multi-Agent Workflow`
354
+
1. A new tab opens in VS Code displaying the execution graph
355
+
1. The visualization updates automatically as your workflow progresses, showing the flow between agents and their interactions.
356
+
357
+
> [!NOTE]
358
+
> For any port conflicts, change the visualization port by setting the `FOUNDRY_OTLP_PORT` environment variable, and update the observability port in the `workflow.py` file accordingly.
359
+
>
360
+
> For example, to change the port to `4318`:
361
+
> ```bash
362
+
>export FOUNDRY_OTLP_PORT=4318
363
+
>```
364
+
> In `workflow.py`, update the port number in the observability configuration:
Enable workflow visualization in your own workflows by adding the following code snippet:
372
+
373
+
```python
374
+
from agent_framework.observability import setup_observability
375
+
setup_observability(vs_code_extension_port=4317) # default port is 4317
376
+
```
377
+
378
+
The following steps outline how to monitor and visualize your multi-agent workflow execution in real-time (currently available for Python interactive mode only):
379
+
380
+
1. Open the Command Palette (`Ctrl+Shift+P`)
381
+
1. Run the command: `>Azure AI Foundry: Visualize the Multi-Agent Workflow`
382
+
1. A new tab will open in VS Code displaying the execution graph
383
+
1. The visualization updates automatically as your workflow progresses, showing the flow between agents and their interactions.
384
+
385
+
::: zone-end
386
+
387
+
## Clean up resources
233
388
234
389
The Azure resources that you created in this article are billed to your Azure subscription. If you don't expect to need these resources in the future, delete them to avoid incurring more charges.
0 commit comments