feat(agents): opinionated defaults for azd ai agent init -m#8426
Merged
Conversation
When users provide a manifest explicitly via -m flag or positional argument, apply opinionated defaults to minimize interactive prompts: - Deploy mode: auto-select 'code' for Python/.NET projects - Runtime: auto-detect from project files (requirements.txt python_3_13, .csproj dotnet_10) - Entry point: auto-detect using existing detectDefaultEntryPoint logic - Dependencies: default to remote_build - Model confirmation: skip 'Use from manifest / Choose different' prompt - Model deployment: auto-select if exactly one matching deployment exists - Container resources: auto-select default tier (0.5 cores, 1Gi) This reduces the -m quickstart from 8+ prompts to 2 (subscription + project). All auto-resolved values are printed with a prefix so users see what was chosen. The existing interactive init (without -m) and --no-prompt mode are completely unchanged. The userProvidedManifest bool is captured before auto-detection can set manifestPointer, ensuring only explicit user intent triggers the streamlined flow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Print ' Model: <name> (from manifest)' when skipping model confirm prompt - Include version in deployment auto-select message for user clarity Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Auto-select 'deploy_new' when userProvidedManifest + no matching deployments (eliminates unnecessary prompt) - Document resolution precedence in promptDeployMode comment - Rename misleading test name to clarify what it actually tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cope - Print checkmark when auto-selecting deploy_new for no-match scenario - Add comment explaining populateContainerSettings trigger conditions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n agent initialization
PR #8347 switched hosted-agent management calls from api-version=2025-11-15-preview to api-version=v1. The preview API version had implicitly satisfied the Foundry preview-feature gate, so requests went through without an opt-in header. The v1 endpoint enforces the gate explicitly: POST /agents/{name}/versions with definition.kind=="hosted" now returns HTTP 403 preview_feature_required unless the caller sends 'Foundry-Features: HostedAgents=V1Preview'. Effect on users: 'azd deploy' fails for container (hosted) agents with the preview_feature_required error returned from the Foundry API. Confirmed via direct API probes against a live Foundry project: same URL/body/auth, only the api-version and header differ. api-version=2025-11-15-preview, no header -> 200 OK api-version=v1, no header -> 403 preview_feature_required api-version=v1, with header -> 200 OK Add the header inside CreateAgentVersion so all callers get the fix (service_target_agent.go deployHostedAgent and cmd/optimize_deploy.go). Scope: only CreateAgentVersion needs the change. Probed sibling v1 management calls (GetAgent, GetAgentVersion, ListAgents, ListAgentVersions, PatchAgent) against the same live project without the header - none returned 403. The write path that creates a hosted resource is the only one currently gated. Add a focused test that asserts CreateAgentVersion always sets the header, so this can't silently regress again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ilently auto-selecting
When `azd ai agent init -m <manifest>` selected a Foundry project that
already contained exactly one matching deployment for the manifest's
model resource, the code silently auto-selected that deployment with no
prompt. That made the model an invisible default and was inconsistent
with the Use/Change/Skip selector shown everywhere else.
This change replaces the silent path and the older
"Found N existing deployment(s)... Create new model deployment" selector
with a unified Use/Change/Skip-style prompt:
- "Use existing deployment 'name' (version: X)" (one per matching
deployment, sorted by name for deterministic ordering)
- "Deploy a new model" (falls through to the existing deploy-new path
which loads the model catalog)
- "Skip this model (do not deploy)" (returns errModelSkipped; the
resource is dropped from manifest.Resources by ProcessModels)
The selector uses stable `SelectChoice.Value` strings ("use:<name>",
"deploy_new", "skip") so behavior is keyed off values, not labels.
In `--no-prompt` mode the first sorted matching deployment is selected
automatically (no prompt) so headless/CI flows continue to work.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prototypes a streamlined azd ai agent init -m <manifest> experience by introducing “opinionated defaults” that auto-resolve several decisions (deploy mode/config, model selection, container resources) to reduce interactive prompts for quickstart scenarios.
Changes:
- Add
userProvidedManifestplumbing through the init flow, plus manifest “peeking” helpers to derive agent/project folder naming earlier. - Adjust deploy-mode / code-config prompting behavior to support auto-resolution paths.
- Refactor model deployment selection to be deterministic in
--no-prompt, add “skip model” support, and update tests accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go |
Adds manifest-peek + early agent-name resolution, threads userProvidedManifest, changes container tier prompting, and alters some stdout/log output behavior. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_test.go |
Adds unit tests covering manifest peek + early agent-name resolution + manifest-path absolutization. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go |
Adds model-skip sentinel, refactors deployment selection UI, and adjusts model processing to drop skipped resources. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go |
Extends deploy-mode and code-config prompting to accept userProvidedManifest and apply defaults. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code_test.go |
Adds coverage for the new userProvidedManifest behavior in deploy-mode/code-config prompting. |
trangevi
requested changes
May 29, 2026
…l function directly Per review feedback (trangevi): the InitAction.parseGitHubUrlNaive() method was just a passthrough to the package-level function. Remove the wrapper and call the package-level function directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
trangevi
approved these changes
May 29, 2026
Member
|
/check-enforcer override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8472
Summary
Streamlined
azd ai agent initexperience when driven by a manifest (via-m <url>or interactive template selection). Introduces opinionated defaults that auto-resolve several decisions to reduce interactive prompts for quickstart scenarios.Trigger:
userProvidedManifestis true when the init flow is driven by a manifest -- either explicitly via-mflag/positional argument, or when the user interactively selects a template that resolves to a manifest.About the
-mURL: The manifest URL comes fromazd ai agent sample list --output json(fields:manifestUrl,initCommand), dynamically sourced from the centrally-managed template catalog athttps://aka.ms/foundry-agents-samples. Users simply copy it from the catalog or quickstart docs.This PR is a prototype for team review -- validates the approach and UX before progressing to full product feature.
Before vs After
Before:
azd ai agent init -m <url>(8+ prompts)\
? How would you like to deploy your agent?
After:
azd ai agent init -m <url>(3 prompts)\
Downloading agent template...
? Select an Azure subscription
AI agent definition added to your azd project successfully!
\\
Prompt Count Comparison
Auto-Resolution Logic
--deploy-mode code--runtime <value>--entry-point <path>--no-promptauto-selects firstKey Design Decisions
--deploy-mode code-m <url>and interactive template selection--debug)Implementation
userProvidedManifestfield onInitAction-- captured when manifest is provided via-mor template selectionpromptDeployMode: auto-selects container when manifest-drivenpromptCodeConfig: auto-detects runtime + entry pointpopulateContainerSettings: auto-selects smallest tiergetModelDetails: skips model confirmation promptgetModelDeploymentDetails: shows Use/Change/Skip prompt (no silent auto-select); auto-deploys-new when no match foundparseGitHubUrlNaive: refactored from method to package-level function (per review feedback)Testing
TestPromptDeployMode_FlagOverridex5 +TestPromptCodeConfig_FlagOverridesx8)E2E Test Results (2026-05-29, North Central US)
Tested on branch
pr8426-latestwith Foundry projectwujia-aifproject-260527. All agents deployed and invoked successfully.-m+--project-id-m+--project-id-mwithout--project-id(interactive)-m+--project-id+--deploy-mode code --runtime --entry-point-mflag (unchanged)