Set up Visual Studio Code for agent development
Unit 5 of 10 · Module 7: Develop AI agents with Microsoft Foundry and Visual Studio Code
Go deeper
Unlocks when you've watched the lesson.
Read this lesson
Install and connect
Foundry Toolkit turns VS Code into a place to build, test, and deploy agents, without leaving your editor. It's the new name for the AI Toolkit, and it now includes what the separate Microsoft Foundry extension used to do, in three sections: My Resources, Developer Tools, and Help and Feedback. Installing it takes a few minutes. Open VS Code, and open the Extensions view from the left pane, or press Control Shift X, or Command Shift X on a Mac. Search for Foundry Toolkit, pick the one published by Microsoft, and select Install. When it finishes, the Foundry Toolkit icon appears in the activity bar on the left. Next, connect to Azure. This part trips people up, because two extensions work together: the Azure extension signs you in and finds your subscriptions, and Foundry Toolkit works with your project. Select the Azure icon in the activity bar, and sign in if you're asked. Your account holds subscriptions, a subscription holds your Foundry resources, and those hold your projects, so in Foundry Toolkit, under My Resources, you select Set Foundry Project. Select Switch project, pick the subscription, then pick the right project, and the toolkit remembers it as your default. Now My Resources shows that project's agents, models, tools, and knowledge sources.
Deploy a model
Agents need a deployed model to run on. If you don't have one yet, open the Model Catalog under Developer Tools, and deploy one to your project. Choose a model, such as GPT five mini. Then configure three settings. The deployment name is the label your agents use to find this deployment, so make it descriptive. The model version pins which release of the model you get, so its behavior doesn't change under you unexpectedly. And capacity sets throughput: how much traffic, measured in tokens per minute, the deployment can handle before requests start being limited. Select Deploy. When it's done, the deployment appears in the dropdowns you use to configure agents.
One agent, two windows
Agents are often created in the Foundry portal, and then managed in VS Code. Once you create one in the portal, it appears automatically under My Resources. That's because the agent lives in your Foundry project in the cloud, not on either screen. The portal and VS Code are two windows onto the same agent, and when you select Save to Foundry, your changes save back as a new version. As your projects grow, you'll manage several agents. Browse them under My Resources, and switch between them by selecting one. Compare configurations by opening their YAML files side by side. Duplicate an agent to try a variation without starting over. And archive agents you no longer use, to keep your workspace tidy.
Facts from Microsoft's documentation: Microsoft Foundry Toolkit for Visual Studio Code overview (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.