Learn how to create an AI Agent with deployed Microsoft Foundry models using Python in Visual Studio Code.
Try it yourself in Microsoft Foundry: ai.azure.com
- A Microsoft Foundry project
- Navigate to the folder:
cd Samples/Create-Agent - Install dependencies:
- pip install azure-ai-projects --pre
- pip install openai azure-identity python-dotenv
- Use the Azure CLI command
az loginoraz login --use-device-codeto authenticate. - Set up environment variables:
copy .env.example .env - Run the script:
python create-agent.py
Note
Running the create-agent.py file is a prerequisite for the chat-with-agent.py file since the agent's name from the create-agent.py file is referenced in the chat-with-agent.py file. However, if you have an existing agent that you'd like to use instead, replace the value for the AZURE_AI_FOUNDRY_AGENT_NAME environment variable with your agent's name.
- Navigate to the folder:
cd Samples/Create-Agent - Install dependencies:
- pip install azure-ai-projects --pre
- pip install openai azure-identity python-dotenv
- Use the Azure CLI command
az loginoraz login --use-device-codeto authenticate. - Set up environment variables:
copy .env.example .env - Run the script:
python chat-with-agent.py