Skip to content

[Agents extension] Filter our model query by the supported hosted agents regions#8517

Closed
trangevi wants to merge 2 commits into
mainfrom
trangevi/models-env-filtering
Closed

[Agents extension] Filter our model query by the supported hosted agents regions#8517
trangevi wants to merge 2 commits into
mainfrom
trangevi/models-env-filtering

Conversation

@trangevi
Copy link
Copy Markdown
Member

@trangevi trangevi commented Jun 1, 2026

Fixes #8516

Signed-off-by: trangevi <trangevi@microsoft.com>
Copilot AI review requested due to automatic review settings June 1, 2026 21:35
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Review may take a bit longer — reach out to @rajeshkamal5050 or @kristenwomack if you'd like to discuss prioritization.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Azure AI Agents extension init flows so that “all regions” model catalog queries are constrained to the hosted-agents supported region allowlist (addressing issue #8516), preventing users from being offered models in regions where hosted agents can’t run.

Changes:

  • Introduces newModelSelector(...) and updates InitAction.getModelSelector(ctx) to eagerly fetch and cache the hosted-agents supported regions list.
  • Applies the supported-region allowlist to model catalog queries that previously used “all regions” (ListModels / PromptAiModel).
  • Adds tests covering selector construction, memoization behavior, and context-cancellation propagation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go Adds a supportedRegions field to modelSelector, plus a constructor and context-aware memoized getter.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go Uses the supported-region allowlist in “all models” catalog queries and updates some user-facing strings.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_models_test.go Adds unit tests validating supported-regions population, memoization, and cancellation behavior.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go Switches recovery path selector construction to newModelSelector(...) so it also respects supported regions.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go Documents agentModelFilter behavior regarding nil/empty locations and supported-regions filtering expectations.
Comments suppressed due to low confidence (1)

cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go:862

  • The prompt copy has been updated to "supported regions", but the wrapped error message still says "across all regions". Aligning this wording will make troubleshooting less confusing.
				}

				return nil, "", exterrors.FromPrompt(err, "failed to prompt for model selection across all regions")
			}

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_models_test.go
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go Outdated
@github-actions github-actions Bot added the ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions label Jun 1, 2026
- Rename 'All available models' choice to 'All models supported for hosted agents' and update the adjacent comment so users aren't misled into thinking they're browsing every Azure region.

- Reorder imports in init_models_test.go to follow stdlib -> external -> local convention.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@therealjohn therealjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will confirm if the models a hosted agent uses need to be limited to the regions you can deploy a hosted agent too - I do not think they are linked.

I believe a model deployment can technically be in a different region (supported or not of HA) of hosted agent.

@trangevi
Copy link
Copy Markdown
Member Author

trangevi commented Jun 3, 2026

Confirmed, no such restriction

@trangevi trangevi closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model query doesn't filter by supported regions

3 participants