Prerequisites
- A Foundry project with a deployed model, or an Azure OpenAI resource.
- The Microsoft Foundry Toolkit for Visual Studio Code extension installed.
- The project’s managed identity with the Foundry User and AcrPull roles assigned. Also assign the
acrPullrole to the managed identity of the Foundry project where you plan to deploy the Hosted agent.
The Foundry RBAC roles were recently renamed. Foundry User, Foundry Owner, Foundry Account Owner, and Foundry Project Manager were previously named Azure AI User, Azure AI Owner, Azure AI Account Owner, and Azure AI Project Manager. You might still see the previous names in some places while the rename rolls out. The role IDs and core permissions are unchanged by the rename.
- A supported region for Hosted agents.
Create a hosted agent workflow
You can use the Microsoft Foundry Toolkit for Visual Studio Code extension to create Hosted agent workflows. A Hosted 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.- Open the command palette (Ctrl+Shift+P).
-
Run this command:
>Foundry Toolkit: Create a New Hosted Agent. - Select a programming language
- Choose a framework, either Copilot SDK, Microsoft Agent Framework, or Bring your own.
- Choose a protocol, either Responses API or Invocations API.
- Choose a template from the list.
- Select the “Next” button.
- Select a folder where you want to save your new Hosted Agent.
- For Environment Setup, selecting “Skip for now” will skip Foundry project and model setup, which requires you to manually configure them in the code later. Selecting “Configure with Microsoft Foundry” will auto-populate your project and model information with the existing Foundry Project.
Install dependencies
Install the required dependencies for your Hosted agent project. The dependencies vary based on the programming language that you selected when you created the project.Run your hosted workflow locally
Deploy the hosted agent
After testing your Hosted agent locally, deploy it to your Foundry workspace so other team members and applications can use it.Make sure you give the necessary permissions to deploy Hosted agents in your Foundry workspace, as stated in the Prerequisites. You might need to work with your Azure administrator to get the required role assignments.