Skip to content

Commit 8cbe70c

Browse files
Merge pull request #7599 from ms-johnalex/upd-aif-vsc-ext-agents-100825
Add multi-agent workflow to AIF-VS-EXT agents
2 parents ed67a5e + 5b242e0 commit 8cbe70c

File tree

2 files changed

+192
-28
lines changed

2 files changed

+192
-28
lines changed

articles/ai-foundry/how-to/develop/vs-code-agents.md

Lines changed: 182 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ content_well_notification:
88
- AI-contribution
99
ai-usage: ai-assisted
1010
ms.topic: how-to
11-
ms.date: 09/24/2025
11+
zone_pivot_groups: ai-foundry-vsc-extension-languages
12+
ms.date: 10/09/2025
1213
ms.reviewer: erichen
1314
ms.author: johalexander
1415
author: ms-johnalex
1516
---
1617

1718
# Work with Azure AI Foundry Agent Service in Visual Studio Code (Preview)
1819

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:
2021

2122
- Answer questions using their training data or search other sources with Retrieval Augmented Generation (RAG)
2223
- Perform specific actions
@@ -92,7 +93,7 @@ tools: []
9293
9394
Azure AI Agent Service has a set of tools that you can use to interact with your data sources.
9495
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
9697
9798
The following tools are available in the Azure AI Foundry VS Code extension:
9899
@@ -105,36 +106,36 @@ The following tools are available in the Azure AI Foundry VS Code extension:
105106
> [!NOTE]
106107
> For more information about using MCP tools, see [Use Model Context Protocol (MCP) tools with Azure AI Agents](./vs-code-agents-mcp.md).
107108
108-
#### Add a tool to the AI Agent
109+
### Add a tool to the AI Agent
109110
110111
Add a tool to the AI Agent with the following steps:
111112
112113
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.
113114
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":::
115116
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:
119118
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":::
125121
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":::
129130
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.
131132
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.
134135
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.
136137
137-
### Create Azure AI Agents on the Azure AI Foundry Studio
138+
## Create Azure AI Agents on the Azure AI Foundry Studio
138139
139140
Create your agent directly on Azure AI Foundry with the following steps:
140141
@@ -146,7 +147,7 @@ Create your agent directly on Azure AI Foundry with the following steps:
146147
147148
:::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":::
148149
149-
#### View the deployed AI Agent details
150+
### View the deployed AI Agent details
150151
151152
Selecting the deployed agent opens the **Agent Preferences** page in a view only mode.
152153
@@ -156,14 +157,14 @@ Selecting the deployed agent opens the **Agent Preferences** page in a view only
156157
157158
:::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":::
158159
159-
### Edit and update the deployed AI Agent
160+
## Edit and update the deployed AI Agent
160161
161162
To edit the deployed agent, select the **Edit Agent** button in the **Agent Preferences** page. The agent designer opens with the agent .yaml file.
162163
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.
163164
164165
:::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":::
165166
166-
### Explore the agent sample code
167+
## Explore the agent sample code
167168
168169
Create a sample code file using the following steps.
169170
@@ -183,13 +184,13 @@ Create a sample code file using the following steps.
183184
184185
:::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":::
185186
186-
#### Explore the sample code file
187+
### Explore the sample code file
187188
188189
This Python sample code file that demonstrates a basic call to interact with the agent through the AI Foundry projects API:
189190
190191
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/sample-agent-code-file.png" alt-text="Screenshot of generated agent sample code file." lightbox="../../media/how-to/get-started-projects-vs-code/sample-agent-code-file.png":::
191192
192-
### Interact with Agents using agents playground
193+
## Interact with Agents using agents playground
193194
194195
Open the **Agents Playground** using the following steps:
195196
@@ -204,6 +205,18 @@ Open the **Agents Playground** using the following steps:
204205
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.
205206
206207
:::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:
217+
218+
:::image type="content" source="../../media/how-to/get-started-projects-vs-code/sample-agent-code-file.png" alt-text="Screenshot of generated agent sample code file." lightbox="../../media/how-to/get-started-projects-vs-code/sample-agent-code-file.png":::
219+
207220
208221
## Explore Threads
209222
@@ -229,7 +242,149 @@ Select the **View run info** button in the **Thread Details** page to see the ru
229242
230243
:::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":::
231244
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.
260+
261+
::: zone pivot="python"
262+
263+
Install the following packages from source:
264+
```bash
265+
git clone https://github.com/microsoft/agent-framework.git
266+
pip install -e agent-framework/python/packages/azure-ai -e agent-framework/python/packages/core
267+
```
268+
::: zone-end
269+
270+
::: zone pivot="csharp"
271+
272+
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:
297+
298+
#### [Windows (PowerShell)](#tab/windows-powershell)
299+
300+
```powershell
301+
$env:AZURE_OPENAI_ENDPOINT="https://your-resource-name.openai.azure.com/"
302+
$env:MODEL_DEPLOYMENT_NAME="your-deployment-name"
303+
$env:AZURE_OPENAI_API_KEY="your-api-key"
304+
```
305+
306+
#### [Windows (Command Prompt)](#tab/windows-command-prompt)
307+
308+
```dos
309+
set AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
310+
set MODEL_DEPLOYMENT_NAME=your-deployment-name
311+
set AZURE_OPENAI_API_KEY=your-api-key
312+
```
313+
314+
#### [macOS/Linux (Bash)](#tab/macos-linux-bash)
315+
316+
```bash
317+
export AZURE_OPENAI_ENDPOINT="https://your-resource-name.openai.azure.com/"
318+
export MODEL_DEPLOYMENT_NAME="your-deployment-name"
319+
export AZURE_OPENAI_API_KEY="your-api-key"
320+
```
321+
322+
---
323+
324+
1. Run the application using the following commands:
325+
```bash
326+
dotnet build
327+
dotnet run
328+
```
329+
::: zone-end
330+
331+
::: zone pivot="python"
332+
333+
Update the `.env` file in the root directory of your project and add the following environment variables.
334+
335+
```
336+
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
337+
AZURE_OPENAI_API_KEY=your-api-key
338+
MODEL_DEPLOYMENT_NAME=your-deployment-name
339+
```
340+
341+
Run the application using:
342+
```bash
343+
python workflow.py
344+
```
345+
346+
### Visualize multi-agent workflow execution
347+
348+
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:
365+
> ```python
366+
> setup_observability(vs_code_extension_port=4318)
367+
> ```
368+
369+
## Configure visualizer for your own workflow
370+
371+
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
233388

234389
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.
235390

zone-pivots/zone-pivot-groups.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,4 +1647,13 @@ groups:
16471647
- id: import-data-new
16481648
title: Import data (new)
16491649
- id: import-data
1650-
title: Import data
1650+
title: Import data
1651+
# Owner: johalexander / ms-johnalex
1652+
- id: ai-foundry-vsc-extension-languages
1653+
title: Programming languages
1654+
prompt: Choose a programming language
1655+
pivots:
1656+
- id: python
1657+
title: Python
1658+
- id: csharp
1659+
title: C#

0 commit comments

Comments
 (0)