Prerequisites
- A model deployed in Microsoft Foundry. If you don’t have a model, first complete Quickstart: Set up Microsoft Foundry resources.
- The required language runtimes, global tools, and Visual Studio Code extensions as described in Prepare your development environment.
Get your project endpoint
Copy your project endpoint from the welcome screen in the Foundry portal. The code samples in this quickstart declare their values as constants at the top of each file. Before you run a sample, replace these placeholders:your_project_endpoint: Your project endpoint, in the formathttps://<resource-name>.services.ai.azure.com/api/projects/<project-name>.your_agent_name: A name for your agent, such asMyAgent.
Install packages and authenticate
Make sure you install the correct version of the packages as shown here.- Python
- C#
- TypeScript
- Java
- REST API
- Foundry portal
-
Install the current version of
azure-ai-projects. This version uses the Foundry projects (new) API. The samples authenticate by usingDefaultAzureCredential, which comes fromazure-identity. -
Sign in using the CLI
az logincommand to authenticate before running your Python scripts.
Create a prompt agent
Create a prompt agent using your deployed model. The agent uses aPromptAgentDefinition with instructions that define the agent’s behavior. You can update or delete agents anytime.
- Python
- C#
- TypeScript
- Java
- REST API
Chat with the agent
Use the agent you created to interact by asking a question and a related follow-up. The conversation maintains history across these interactions.- Python
- C#
- TypeScript
- Java
- REST API
Clean up resources
If you no longer need any of the resources you created, delete the resource group associated with your project.- In the Azure portal, select the resource group, and then select Delete. Confirm that you want to delete the resource group.