Skip to main content
Create, test, and deploy hosted Foundry Agent workflows by using the Microsoft Foundry Toolkit for Visual Studio Code extension. The toolkit supports agent creation from templates, local testing and debugging with the Agent Inspector for visualization and trace support, and direct deployment to Foundry Agent Service from VS Code. Hosted workflows let multiple agents collaborate in sequence, each with its own model, tools, and instructions. Before you start, build an agent in Foundry Agent Service by using the extension. You can then add hosted workflows to that agent. This article covers creating a workflow project, running it locally, visualizing the execution, and deploying it to your Foundry workspace.

Prerequisites

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.

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.
  1. Open the command palette (Ctrl+Shift+P).
  2. Run this command: >Foundry Toolkit: Create a New Hosted Agent.
  3. Select a programming language
  4. Choose a framework, either Copilot SDK, Microsoft Agent Framework, or Bring your own.
  5. Choose a protocol, either Responses API or Invocations API.
  6. Choose a template from the list.
  7. Select the “Next” button.
  8. Select a folder where you want to save your new Hosted Agent.
  9. 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.
The files for your Hosted agent project are generated in your selected folder based on the framework, template and language you selected to get you started. You can remove or modify that code as needed.

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.