Skip to main content
Change the AI model your hosted agent uses after initial deployment. Update the model deployment in azure.yaml, set the azd environment value that your agent reads at runtime, and redeploy the Microsoft Foundry hosted agent.

Prerequisites

Choose a model

When selecting a model, consider:

Update the environment variable

There is no dedicated command for updating the model yet. Start by updating the model deployment name in your azd environment:

Update azure.yaml

Model selection for hosted agents is defined in two places in azure.yaml:
  • The azure.ai.project service defines the model deployment in its deployments list.
  • The azure.ai.agent service defines the runtime environment variable that your agent code reads from the env map.
Update both entries to use the target deployment name:
The model deployment name in the azd environment should match the deployment name in services.<project-service>.deployments[].name.

Redeploy the project

Run azd up:
Use azd up, not just azd deploy, if the new model deployment needs to be provisioned. If the model deployment already exists in your Foundry project, azd deploy is sufficient.
Run azd env get-values to see all current environment variables.

Configure different models per environment

You can configure different models for development and production using azd environments:
Each environment maintains its own set of variables in .azure/<env-name>/.env.