[Agents extension] Filter our model query by the supported hosted agents regions#8517
[Agents extension] Filter our model query by the supported hosted agents regions#8517trangevi wants to merge 2 commits into
Conversation
Signed-off-by: trangevi <trangevi@microsoft.com>
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
There was a problem hiding this comment.
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 updatesInitAction.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")
}
- 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>
therealjohn
left a comment
There was a problem hiding this comment.
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.
|
Confirmed, no such restriction |
Fixes #8516