Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
After you get started with the AI Foundry the VS Code extension, you can work with Azure AI Foundry Agent Service. Agents are "smart" microservices that:
- Answer questions using their training data or search other sources with Retrieval Augmented Generation (RAG)
- Perform specific actions
- Automate complete workflows
Agents combine AI models with tools to access and interact with your data.
Azure AI Foundry developers can stay productive by developing, testing, and deploying agents in the familiar and powerful environment of VS Code.
Important
Items marked (preview) in this article are currently in public preview. This preview is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
Create and edit Azure AI Agents within the designer view
Follow these steps to create an Azure AI Agent:
First, finish the Get Started section to sign in to your Azure resources and set your default project.
Deploy a model to use with your agent.
In the Azure AI Foundry Extension view, find the Resources section.
Select the + (plus) icon next to the Agents subsection to create a new AI Agent.
In the Save As dialog box, select a directory and enter a name for your new AI Agent .yaml file.
Select the Save Agent File button to save your AI Agent file.
Interact with your agent in the designer
After you choose your save location, both the agent .yaml file and the Designer view will open to edit your AI Agent.
Perform the following tasks in the agent designer:
Enter a name for your agent in the prompt.
Enter your model deployment name. The deployment name you chose when you deployed an existing model.
Configure the following fields. The ID is generated by the extension:
- Add a description for your agent
- Set system instructions
- Configure tools for agent use
To save the .yaml file, select File > Save in the VS Code menu bar.
Explore the Azure AI Agent YAML definition
Your AI Agent .yaml file was opened at the same time the designer was. This file contains the details and setup information for your agent, similar to the following .yaml file example:
# yaml-language-server: $schema=https://aka.ms/ai-foundry-vsc/agent/1.0.0
version: 1.0.0
name: my-agent
description: Description of the agent
id: ''
metadata:
authors:
- author1
- author2
tags:
- tag1
- tag2
model:
id: 'gpt-4o-1'
options:
temperature: 1
top_p: 1
instructions: Instructions for the agent
tools: []
Add tools to the Azure AI Agent
Azure AI Agent Service has a set of knowledge and action tools that you can use to interact with your data sources.
Available tools for Azure AI Agents
The following tools are available:
Knowledge tools:
Action tools:
Azure AI Foundry Agent Service has a set of knowledge and action tools that you can use to interact with your data sources, such as:
- Grounding with Bing search
- Azure AI Search
- Azure Functions
- File retrieval
- Code interpreter
- OpenAPI Specified tools
- Azure Functions
Configure the tools YAML file
The Agent Designer adds tools to an AI Agent via .yaml files.
Create a tool configuration .yaml file using the following steps:
Choose a tool from the available tools for Azure AI Agents. Perform any setup steps that might be required. For example, Grounding with Bing search.
Once you complete the setup, create a yaml code file that specifies the tool's configuration. For example, this format for Grounding with Bing Search:
type: bing_grounding options: tool_connections: - >- /subscriptions/<Azure Subscription ID>/resourceGroups/<Azure Resource Group name>/providers/Microsoft.MachineLearningServices/workspaces/<Azure AI Foundry Project name>/connections/<Bing connection name>
Replace the placeholders in the connection string under the
tool_connections
section with your information:- Azure Subscription ID
- Azure Resource Group name
- Azure AI Foundry Project name
- Bing connection name
To save the .yaml file, select File > Save in the VS Code menu bar.
Connect the tools file to the AI Agent
Add a tool to the AI Agent with the following steps:
Select the + (plus) icon next to the TOOL section in the designer.
In the file explorer that appears, select the .yaml tool file to use. Select the Select a tool file button to add the tool to the agent.
The tool is displayed in the TOOL section.
To save the .yaml file, select File > Save in the VS Code menu bar.
Deploy Azure AI Agents to the Azure AI Foundry Studio
Deploy your agent directly to Azure AI Foundry with the following steps:
Select the Deploy to Azure AI Foundry button in the bottom-left of the designer.
In the VS Code navbar, refresh the Azure Resources view. The deployed agent is displayed under the Agents subsection.
View the deployed AI Agent details
Selecting the deployed agent opens the Agent Preferences page in a view only mode.
Select the Open Yaml File to view the yaml definition of the agent.
Select the Open Playground button to open the Agent Playground.
Interact with Agents using agents playground
Open the Agents Playground using the following steps:
Right-click on your deployed agent and select the Open Playground option This action starts a thread with your agent and let you send messages.
Alternatively, select the Agent Playground link in the Tools subsection, and select your agent from the top-center list.
The Playground page is displayed.
Type your prompt and see the outputs. 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.
Explore Threads
The Threads subsection displays the threads created during a run with your agent. In the Azure Resources Extension view, select the caret icon in front of the Threads subsection to view the list of threads.
View thread details
Select a thread to see the Thread Details page.
A Thread is a conversation session between an agent and a user. Threads store Messages and automatically handle truncation to fit content into a model's context.
A Message is a single interaction between the agent and the user. Messages can include text, images, and other files. Messages are stored as a list on the Thread.
A Run is a single execution of an agent. Each run can have multiple threads, and each thread can have multiple messages. The agent uses its configuration and Thread's Messages to perform tasks by calling models and tools. As part of a Run, the agent appends Messages to the Thread.
View run details
Select the View run info button in the Thread Details page to see the run information in a JSON file.
Cleanup resources
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.
Delete your agents
Tip
Because you can customize the left pane in the Azure AI Foundry portal, you might see different items than shown in these steps. If you don't see what you're looking for, select ... More at the bottom of the left pane.
Delete the deployed agent in the online AI Foundry portal. Select Agents from the navigation menu on the left, select your agent, then select the Delete button.
Delete your models
In the VS Code navbar, refresh the Azure Resources view. Expand the Models subsection to display the list of deployed models.
Right-click on your deployed model to delete and select the Delete option.
Delete your tools
Delete the connected tool with the following steps:
- Open the Azure portal
- Select the Azure Resource Group containing the tool.
- Select the Delete button.
Next steps
- Learn about the tools you can use with Azure AI Agents, such as file search, or code interpreter.