Repository navigation
feat: gate Foundry agent previews independently - #10640
Open
Hui Miao (huimiu) wants to merge 20 commits into
Open
Hui Miao (huimiu) wants to merge 20 commits into
Hui Miao (huimiu) wants to merge 20 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 25 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Hui Miao (huimiu)
added this pull request to stack #10646
October 21, 2026 02:27
Hui Miao (huimiu)
force-pushed
the
hui/foundry-feature-flags-hosted-agent
branch
from
October 21, 2026 03:12
2643837 to
5b8acda
Compare
Hui Miao (huimiu)
removed this pull request from stack #10646
October 21, 2026 03:12
Hui Miao (huimiu)
changed the base branch from
hui/foundry-feature-flags-core
to
hui/foundry-shared-feature-access
October 21, 2026 03:12
Hui Miao (huimiu)
added this pull request to stack #10647
October 21, 2026 03:12
This was referenced Oct 21, 2026
Hui Miao (huimiu)
removed this pull request from stack #10647
October 21, 2026 12:36
Hui Miao (huimiu)
added this pull request to stack #10658
October 21, 2026 12:36
Hui Miao (huimiu)
marked this pull request as ready for review
October 21, 2026 14:16
Hui Miao (huimiu)
requested review from
JeffreyCA,
JerryYang (JerryYangKai),
FanH (Siglud),
Yimin-Jin,
Eric Chen (eriolchan),
Glenn Harper (glharper),
Zhijie Huang (hund030),
Wei Meng (m5i-work),
John Miller (therealjohn),
Travis Angevine (trangevi) and
JianW (v1212)
as code owners
October 21, 2026 14:16
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
One or more issues must be addressed before approval.
No open issues 🎉
What changed in this PR
Adds independent opt-ins for managed harness, voice, and long-running Foundry agent features, including centralized enforcement and help visibility controls.
Changes:
- Adds command, service, lifecycle, and definition-level feature gates.
- Updates help output, README/spec documentation, and interactive scenarios.
- Adds extensive unit, integration, and snapshot coverage.
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.agents/tests/cli-interactive-tester-scenarios/tier1/1.10-init-harness-region-restrictions.yaml | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/tests/cli-interactive-tester-scenarios/tier0/0.31-preview-help-visibility.yaml | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/tests/cli-interactive-tester-scenarios/tier0/0.18-invoke-long-running-validation.yaml | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/tests/cli-interactive-tester-scenarios/tier0/0.10-init-picker-navigation.yaml | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/tests/cli-interactive-tester-scenarios/tier0/0.02-help-root.yaml | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/README.md | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/project/preview_features.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/project/preview_features_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/project/deploy_precheck_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/featureflags/agents.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/featureflags/agents_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/exterrors/codes.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelpPreviewsOff-root.snap | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelpPreviewsOff-invoke.snap | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/testdata/TestAgentHelpPreviewsOff-init.snap | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/run.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/root.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/root_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/preview_features.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/preview_features_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/preview_central_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/optimize.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/optimize_deploy.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_voice_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_usage_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_usage_grpc_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_latency_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/invocations.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_voice_flag_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/helpers.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/helpers_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/help_test.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/agent_service_add.go | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/go.sum | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/docs/specs/preview-feature-flags.md | Updated as part of this pull request. |
| cli/azd/extensions/azure.ai.agents/cspell.yaml | Updated as part of this pull request. |
Review effort: Lite
When the preview gate would reject a command, run its local argument checks first so conflicts such as --no-wait without --long-running are reported before feature_not_enabled. Bind an explicit empty --environment so preview checks reject it before reading any source.
Contributor
azure.ai.agents PR buildNote This is an unsigned development build. Install it only if you trust this PR. Install the extension: azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/10640/azure-ai-agents.zip"
|
Travis Angevine (trangevi)
approved these changes
Oct 22, 2026
| defaultResolver func() (*azdext.TargetResource, error), | ||
| ) (*azdext.TargetResource, error) { | ||
| if err := p.adoptAndResolveServiceConfig(ctx, serviceConfig); err != nil { | ||
| if err := p.prepareGatedOperation(ctx, serviceConfig); err != nil { |
This branch has not been deployed
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 #10659
Summary
Make managed harness, voice, and long-running invocation separate opt-ins in the Foundry agents extension, and hide each one from help while it's off. This replaces the broad Hosted Agent gate. Regular hosted and plain prompt agents work without any opt-in.
Stacked on #10636 and uses its
IsEnabledcheck and feature registry. The SDK stays pinned tocli/azd v1.37.0with no local module replace. No core feature registry, RPC, or SDK version change. Telemetry still uses the SDK'sv1betatypes, and events and attributes are unchanged.Breaking change
The three previews are now off by default. Projects that used voice, managed harness, or long-running invocation must opt in to each one with
azd config set alpha.<ID> onor its env var.alpha.alldoesn't turn them on. CI runs that use these previews need the env var set. The CHANGELOG lists each key and variable.Changes
agents.managed_harnessmicrosoft_copilot_previewor legacygithub_copilot_previewAZD_FOUNDRY_EXT_ENABLE_AGENTS_MANAGED_HARNESSagents.voiceinvocations_wsAZD_FOUNDRY_EXT_ENABLE_AGENTS_VOICEagents.long_running--long-running/--no-waitAZD_FOUNDRY_EXT_ENABLE_AGENTS_LONG_RUNNINGazd config set alpha.<ID> on,azd env setwith its env var, or the process env var. Opt-ins are additive and a false value never cancels one from another source.alpha.alland unrelated config keys are ignored for agents previews. Core's global opt-in is unchanged. The selected command environment is passed through as is.previewCommand,previewFlagwith optional values,discoverCommand,gateAgentServices). The rootPersistentPreRunEreads them once after the SDK pre-run and callsRequirefor the selected environment. Existing pre-run chaining still works and-eis honored. Per-command checks and env binding are gone.invoke,run, andoptimize deployare markedgateAgentServices, soresolveAgentServicechecks the classified definition before returning, including the deployed-name fallback. Fallbacks never swallow gate errors.prepareGatedOperationstep for resource lookup, package, publish, and deploy, keyed off the existingproject.RequireAgentFeaturesclassification.initandagent adddefinitions from manifests or$reffiles, staged templates before adoption, the existing project before init writes, the remote definitionoptimize deployfetches, and the predeploy and preprovision hooks (they run outside a command). The spec lists each one and why.invoke --long-running,invoke --no-wait, theinvocationsgroup,init --voice, and theprompt-voicevalue ofinit --kind. The root has no azd client when the tree is built, so a help hook asks the host for feature state at render time for the selected environment. If that fails it falls back to the process env var. Command summaries and flag usages that stay visible name agents generically and leave out the hidden previews. Hidden commands and flags are still reachable and still refused while off. Extension metadata and shell completion come from the static tree and still list preview flags. Hiding only affects discovery.initandagent addreject disabled explicit inputs and inline or$refdefinitions before any avoidable auth or project writes. Staged templates are checked before adoption, and voice is left out of the init picker when off. Long-running flags on a prompt invocation are now refused instead of ignored.invokeandinit, such as--no-waitwithout--long-runningor--harnesswithout--kind prompt, now return their own error even while the preview is off. Commands register a local check that runs only when the gate would refuse.--environmentis rejected for preview checks instead of falling back to the default environment. Help still renders with process values in that case.cli/azd/extensions/azure.ai.agents. The opt-in guide hasazd config setandazd env setcommands for all three gates.Validation
Go 1.26.4 against the pinned published SDK:
go build ./...,go vet ./..., andgo test ./...pass.gofmtis clean.golangci-lintwith the repo config reports 0 issues. cSpell passes on touched files.0.31-preview-help-visibilityreplaces0.31-preview-init-help.0.02and0.18turn on the previews they show.E2E
azd and the extension were built from the #10657 head (
b52dddb2f). That head contains this PR (4e2bac721) and only addsconfig list-alpha. The extension binary was swapped into the local install. Help rows were rerun at the #10657 head21d001a69, which contains this PR at73c907743, with a fresh isolated azd config. Real Azure runs used a temporary Foundry project ineastus2withgpt-4.1-miniandgpt-realtime-mini. Off means a fresh user config with no opt-in. Refused means the command stopped withpreview feature "<id>" is disabledand the enable hint. All agents were deleted afterwards. The resource group was deleted and the account purged.The last fifteen rows ran after the review fixes. They used the #10657 head (
7cf859518), which contains this PR at833eb9e29, and were compared with the previous #10657 head (2da7a7a69), where every one of them returned the preview error. Each used an isolated azd config. Real Azure rows used a new temporary project ineastus2withgpt-4.1-mini.invocationshidden, command summaries name no previewinvoke --help, all off--long-running,--no-wait, and the voice and long-running sections hiddeninit --help, all off--voice,prompt-voice, the voice section, and voice or--harnessnotes in--acr-connection,--instructions, and--modelhiddenadd,delete,show, andendpoint showhelp, all offalpha.agents.voice on--voice,prompt-voice, the voice sections, and the voice notes inadd,delete,endpoint show,--acr-connection, and--modelshown--long-running,--no-wait, its section, andinvocationsshown--harnessstays hidden, nothing else changesinit --kind prompt-voice, offinit --voice, offagent addwith a prompt-voice definition, offdeploy, offinvokeon a voice agent, offinit --kind prompt-voice, with and without--voice, voice onagent addwith a prompt-voice definition, voice ondeploywithalpha.agents.voice onorazd env setin the selected envinvokeon a voice agent, voice onendpoint updateon a hosted voice agent, offendpoint updateon a hosted voice agent, voice onendpoint updateon an ordinary hosted agent, all offinit --kind prompt --harness microsoft_copilot_preview, offinit -twith a harness service in the manifest, offagent addwith a harness definition, offdeploy, offinvoke, offinit,init -t, andagent add, harness ondeploy, harness oninvoke, harness onoptimize applyon a harness agent, offoptimize applyon a harness agent, harness oninvoke --long-runningor--long-running --no-waiton a hosted Responses agent, offinvoke --no-waitalone, offinvoke --long-runningon a prompt agent, offinvoke --long-runningon a hosted Responses agent, long-running oninvoke --long-running --no-wait, long-running oninvoke --long-runningon a prompt agent, long-running ontwo, run with-e twoorAZD_ENVIRONMENT=twoAZD_FOUNDRY_EXT_ENABLE_AGENTS_LONG_RUNNING=truealpha.agents.long_running true,alpha.all on, or processyesagent addanddeploywith only the other two features oninit,agent add, anddeploywith only the other two features oninvoke --long-runningwith only the other two features oninit,deploy,invoke,ai agent show,show,endpoint show, anddeleteinit -t,deploy,invoke,ai agent show, anddeleteai agent show,show,endpoint show, anddelete, offinvocations showandinvocations followfor a background response, offdownon a voice project, offinvoke --no-wait, previews off--no-wait requires --long-runninginvoke --long-running --local, previews offinvoke --long-running --timeout 5, previews offinvoke --protocol bogus --long-running, previews offinit --voice x --kind hosted, previews offinit --kind prompt-voice --deploy-mode code, previews offinit --kind hosted --harness microsoft_copilot_preview, previews off--harness is only valid with --kind promptinvoke --long-running, previews offinvoke --long-running -e ""and--environment "", opt-in only in the default envinvoke --no-wait -e ""invoke --help -e ""alpha.all onon a deployed prompt agent, real Azureinvoke --long-runningrefusedalpha.agents.long_running onon a deployed prompt agent, real Azure-e "", real Azureinvokeandinvoke -e ""on a prompt agent, no opt-in, real AzureHistorical E2E: previous head
d1efa2765These ran against the old broad Hosted Agent gate, before the three-gate split. They don't validate the current policy.
d1efa2765alpha.agents.hosted onalpha.agents.hosted true(noton)true-e envtwo, flag only inenvtwo.envazd package, flag offtrueAt that head only the Hosted Agent path was gated. Voice, managed harness, and long-running invocation still worked with every flag off, which is why it was replaced.
Enforcement limits
Explicit HTTP
--agent-endpointtargets aren't classified. The URL doesn't say the agent's kind or harness, and this PR adds no authenticated lookup of the remote definition, so the managed harness gate can't cover that route. The long-running gate still applies before invoke. Text invoke doesn't accept voice WebSocket endpoints.Template catalogs have no capability metadata. Entries stay visible, and the staged definition is checked before adoption instead of guessing from the template name.
azure.ai.routinesandazure.ai.evaluationssend requests to existing agents and aren't gated. They can't import this internal package.Read, show, endpoint show, invocation show/follow/cancel, delete, and down stay available with flags off.