Skip to content

Switch invocations_ws agent endpoint to path-based routing#9049

Merged
huimiu merged 4 commits into
mainfrom
yulin-li/ai-agent-show-invocations-ws
Jul 10, 2026
Merged

Switch invocations_ws agent endpoint to path-based routing#9049
huimiu merged 4 commits into
mainfrom
yulin-li/ai-agent-show-invocations-ws

Conversation

@yulin-li

@yulin-li yulin-li commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Updates the hosted-agent invocations_ws WebSocket endpoint that azd deploy registers and azd ai agent show displays, switching it from the preview dispatcher form to the GA path-based route, per coreai-microsoft/foundrysdk_specs#221.

Before (single literal path, project/agent in query string):

wss://<account>.services.ai.azure.com/api/projects/agents/endpoint/protocols/invocations_ws?api-version=v1&project_name=<project>&agent_name=<agent>

After (path-based, mirrors the HTTP invocations shape):

wss://<account>.services.ai.azure.com/api/projects/<project>/agents/<agent>/endpoint/protocols/invocations_ws?api-version=v1

Project and agent now travel as path segments; the only WebSocket query parameters are the required api-version and an optional agent_session_id. The preview foundry_features/project_name/agent_name query parameters are dropped.

Backward compatibility

The preview dispatcher URL is still active in the live hosted-agent environment tested on 2026-07-09: both the old URL and the new path-based URL completed a WebSocket upgrade with 101 Switching Protocols. The old URL was handled directly; there was no redirect.

However, the old dispatcher route is a preview compatibility surface, not part of the GA contract in foundrysdk_specs#221. The GA spec does not define a redirect or guarantee continued support for the old URL, so callers should migrate to the path-based URL. Once the service removes the preview route, callers using it should expect an error.

Changes

  • buildInvocationsWSProtocolURL now emits the path-based route (reusing the project endpoint's host + path, swapping the scheme to wss and the trailing segment to invocations_ws). The malformed-endpoint guard (returns "" so the entry is filtered) is preserved.
  • Trims trailing slashes from brownfield project endpoints before appending /agents/..., preventing a broken double-slash route.
  • Removed the now-unused path import.
  • Updated unit tests to assert the path-based URL and trailing-slash handling.
  • Added the change under the 1.0.0-beta.6 (Unreleased) changelog section following the beta.5 release.

This affects the value registered as AGENT_{KEY}_INVOCATIONS_WS_ENDPOINT on azd deploy and shown as Endpoint (invocations_ws) by azd ai agent show.

Testing

  • go build ./...
  • go test ./internal/project/... ./internal/cmd/... ./internal/pkg/agents/...
  • Live WebSocket handshake against an active hosted agent declaring invocations_ws: the generated path-based URL returned 101 Switching Protocols, both with and without agent_session_id.
  • gofmt / go vet clean

Fixes #9076

Ref: coreai-microsoft/foundrysdk_specs#221

Update the `invocations_ws` agent WebSocket URL from the preview
dispatcher form (single literal `/api/projects/agents/...` path with
`project_name`/`agent_name` query parameters) to the GA path-based
route, mirroring the HTTP `invocations` shape:

  wss://<account>.services.ai.azure.com/api/projects/<project>/agents/<agent>/endpoint/protocols/invocations_ws?api-version=v1

Project and agent are now carried as path segments; the only query
parameters are the required `api-version` and an optional
`agent_session_id`. This updates the URL registered as
`AGENT_{KEY}_INVOCATIONS_WS_ENDPOINT` on `azd deploy` and shown as
`Endpoint (invocations_ws)` by `azd ai agent show`.

Ref: coreai-microsoft/foundrysdk_specs#221

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 13:49
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates how the hosted-agent invocations_ws WebSocket endpoint URL is constructed in the azure.ai.agents extension. It migrates from the preview "dispatcher" form (project/agent carried as project_name/agent_name query parameters on a fixed /api/projects/agents/... path) to the GA path-based route where project and agent travel as path segments, mirroring the HTTP invocations route shape. This value is what azd deploy registers as AGENT_{KEY}_INVOCATIONS_WS_ENDPOINT and what azd ai agent show displays.

Changes:

  • buildInvocationsWSProtocolURL now reuses the project endpoint's host + path, swaps the scheme to wss, and appends /agents/<agent>/endpoint/protocols/invocations_ws?api-version=<version>; the malformed-endpoint guard (returns "" so the entry is filtered) is preserved, and the now-unused path import is removed.
  • Unit tests updated to assert the path-based URL and to drop the obsolete wantURLOmitAgent/query-parameter assertions.
  • Added a CHANGELOG entry under 1.0.0-beta.5 (Unreleased).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go Rewrites buildInvocationsWSProtocolURL to emit the path-based route, updates the doc comment, and removes the unused path import.
cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent_test.go Updates TestDisplayableProtocolFor, TestAgentInvocationEndpoints, and TestBuildInvocationsWSProtocolURL_TrimsWhitespace to assert the new path-based URL.
cli/azd/extensions/azure.ai.agents/CHANGELOG.md Adds a Bugs Fixed entry describing the endpoint format switch.

I reviewed the URL-construction logic, the preserved malformed-endpoint guard, encoding consistency with the sibling buildResponsesProtocolURL/buildInvocationsProtocolURL builders, and confirmed no other callers still rely on the old dispatcher form. The tests are updated consistently and the CHANGELOG format is correct. I did not find any issues that warrant a comment.

@github-actions github-actions Bot added the ext-agents azure.ai.agents extension label Jul 9, 2026

@jongio jongio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL construction is correct and now consistent with the sibling HTTP protocol builders. Tests properly updated. Note: this PR has merge conflicts that need resolving before merge.

Comment thread cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go Outdated
Resolve the post-beta.5 changelog conflict by placing this change in the
new beta.6 unreleased section. Trim trailing slashes from brownfield
project endpoint paths so the generated WebSocket route never contains
a double slash, with regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 02:12
@github-actions

Copy link
Copy Markdown

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Thank you for logging this issue; our team is reviewing it. If you need urgent prioritization, tag @RickWinter and @kristenwomack to let us know.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 02:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@huimiu
huimiu merged commit fd6638e into main Jul 10, 2026
27 checks passed
@huimiu
huimiu deleted the yulin-li/ai-agent-show-invocations-ws branch July 10, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.agents extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update invocations_ws endpoints to GA path-based routing

4 participants