[azure.ai.agents] Use v1 for endpoint requests#8347
Conversation
Use v1 for hosted agent endpoint protocol and session requests while preserving the preview version for management APIs. 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. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure AI Agents extension to use api-version=v1 for hosted agent endpoint protocol URLs and session lifecycle requests, while keeping agent management/deploy/eval/file/doctor APIs on 2025-11-15-preview (per issue #8329).
Changes:
- Introduces a single source of truth constant (
AgentEndpointAPIVersion = "v1") for hosted endpoint protocol + session requests. - Updates endpoint URL generation/help text to emit
api-version=v1and adjusts related unit tests. - Threads the endpoint API version through remote invoke session creation and LRO polling.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go | Switches displayed protocol endpoint URLs to use the hosted endpoint API version constant. |
| cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent_test.go | Updates endpoint URL expectations to api-version=v1 and improves symlink skip logic. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/paths/paths_test.go | Improves symlink skip logic for permission-related failures. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations_test.go | Updates session API version in tests to use the new endpoint API version constant. |
| cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/api_versions.go | Adds AgentEndpointAPIVersion = "v1" constant. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/show_test.go | Updates expected shown endpoint URLs to api-version=v1. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/session.go | Uses hosted endpoint API version for session create/show/delete/list commands. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go | Updates invoke help/example URLs and threads API version through version-session creation + LRO fallback polling. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_test.go | Updates URL validation and function seams to account for the new API version parameter. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/agent_endpoint_test.go | Updates parsed/built endpoint URL expectations to api-version=v1 and preserves custom versions. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/agent_context.go | Exposes AgentEndpointAPIVersion in cmd package as an alias to the agent_api constant. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed trangevi's latest review thread in commit 8dd49df. The OpenAI eval endpoints now carry
I also updated the command call sites and tests to use the cleaner signatures, while leaving the non-OpenAI eval APIs unchanged because they still send an Validation:
|
PR Azure#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>
…ion (#8441) 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>
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>
* feat(agents): opinionated defaults for azd ai agent init -m 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> * fix: add output for model confirm and version in deployment auto-select - 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> * fix: skip no-match prompt for -m, add precedence doc, rename test - 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> * fix: add output for no-match deploy-new, clarify container settings scope - 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> * refactor: replace fmt.Printf with log.Printf for consistent logging in agent initialization * feat(models): allow skipping model selection during deployment process * refactor: default to container deploy not code deploy * [azure.ai.agents] Fix 403 preview_feature_required on CreateAgentVersion 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> * fix(models): always prompt for existing-deployment match instead of silently 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> * Use opinionated defaults for all manifest paths Signed-off-by: trangevi <trangevi@microsoft.com> * feat(init): implement agent name resolution and manifest path handling * refactor: remove parseGitHubUrlNaive method wrapper, use package-level 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> --------- Signed-off-by: trangevi <trangevi@microsoft.com> Co-authored-by: Jian Wu <wujia@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: John Miller <johmil@microsoft.com> Co-authored-by: trangevi <trangevi@microsoft.com>
PR Azure#8347 moved `v1` into the openai protocol route path and dropped the `?api-version=` query parameter, causing `azd ai agent invoke` to fail with HTTP 400 "Missing required query parameter: api-version" on both the conversations and responses calls. Restore the query-parameter form (`openai/conversations?api-version=v1` and `openai/responses?api-version=v1`) while keeping the version value `v1`. The endpoint parser still accepts the legacy `openai/v1/responses` shape for backward compatibility and rebuilds it to the canonical form. Fixes Azure#8499 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR #8347 moved `v1` into the openai protocol route path and dropped the `?api-version=` query parameter, causing `azd ai agent invoke` to fail with HTTP 400 "Missing required query parameter: api-version" on both the conversations and responses calls. Restore the query-parameter form (`openai/conversations?api-version=v1` and `openai/responses?api-version=v1`) while keeping the version value `v1`. The endpoint parser still accepts the legacy `openai/v1/responses` shape for backward compatibility and rebuilds it to the canonical form. Fixes #8499 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
api-version=v1for Azure AI Agents hosted endpoint protocol and session requests2025-11-15-previewFixes #8329
Testing
go test ./...golangci-lint run ./...