Prompt for existing Foundry project when agent manifest has no model resources#7589
Prompt for existing Foundry project when agent manifest has no model resources#7589
Conversation
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
69d9402 to
021cb4d
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes azd ai agent init behavior for agent manifests that omit the resources section by ensuring users can choose between reusing an existing Microsoft Foundry project or creating new resources (instead of always defaulting to new resource creation).
Changes:
- Add a “Use an existing Foundry project / Create new resources” prompt when the manifest has no model resources and
--project-idis not provided. - Add table-driven unit tests for
manifestHasModelResourcesacross common manifest/resource combinations. - Update the Application Insights connection prompt docs line to render as a hyperlink.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go |
Adds a Foundry project configuration prompt for resource-less manifests and routes to existing-project selection or new-resource provisioning. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_test.go |
Adds coverage for manifestHasModelResources decision logic. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go |
Updates App Insights docs display to use output.WithHyperlink. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go
Show resolved
Hide resolved
jongio
left a comment
There was a problem hiding this comment.
Issues to address:
- init.go:666 - subscription prompt says "to provision" in the "existing" path, but user just chose to use an existing project. Match the model-resources path convention and reference finding/selecting.
Otherwise clean. The new prompt flow mirrors the model-resources "existing" path correctly, error handling uses exterrors.FromPrompt, and tests cover manifestHasModelResources well.
When an agent manifest has no model resources and no --project-id flag, prompt the user to choose between using an existing Foundry project or creating new resources, instead of only asking for subscription + location. This ensures hosted agents without model resources (like the echo-agent example) can still be deployed to an existing Foundry project. Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/c0ddc37f-ff73-4eb7-8cd7-b839d50b19b3 Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
5f96e56 to
1024f66
Compare
Co-authored-by: John Miller <tharealjohn@gmail.com>
jongio
left a comment
There was a problem hiding this comment.
Looks good. The new prompt flow for resource-less manifests correctly mirrors the model-resources "existing/new" path - same helpers, proper fallback when no project is found, and exterrors.FromPrompt for error handling (which is actually cleaner than the manual cancellation check in the model-resources path).
Tests for manifestHasModelResources cover the important cases well.
Two minor observations (non-blocking):
- init.go:657-658: "Foundry project" (lowercase) vs "Foundry Project" (uppercase) across the two choice labels. The model-resources path uses lowercase consistently.
- init.go:701:
default:handles the "new" case -case "new":would be more explicit, matching the model-resources switch at line 775.
jongio
left a comment
There was a problem hiding this comment.
Clean PR. The new prompt flow for resource-less manifests correctly mirrors the model-resources "existing/new" path - same helpers, proper fallback when no project is found, and exterrors.FromPrompt for error handling.
Two minor consistency notes (non-blocking):
- init.go:
defaulthandles the "new" case;case "new":would match the model-resources switch style - init.go:
defaultIdxvsdefaultIndexnaming
Fixes #7539
When
azd ai agent initprocesses a manifest with noresourcessection (e.g. a hosted agent manifest with onlyname,description,metadata, andtemplate), the init flow previously skipped the Foundry project selection prompt entirely — it only asked for subscription and location, meaning it would always create new resources.This PR adds a "Use an existing Foundry project / Create a new Foundry Project" prompt to the no-model-resources path in
configureModelChoice(), aligning it with both the code-first init flow and the--project-idpath which already handle this correctly.Changes
Foundry project prompt for resource-less manifests — When
manifestHasModelResources()returns false and no--project-idis provided, users now see:Selecting "existing" calls
ensureSubscription→selectFoundryProject, with a graceful fallback to "create new" if no projects are found. Selecting "create new" preserves the originalensureSubscriptionAndLocationbehavior.Unit tests — Added table-driven tests for
manifestHasModelResourcescovering: prompt agent, hosted with model resource, tool-only resources, no resources, nil resources, empty slice, and mixed resources.Minor formatting fixes — Updated hyperlinks in ACR and App Insights connection prompts to use cyan matching our the style guide.