Add invocations_ws WebSocket protocol#46779
Open
007DXR wants to merge 13 commits intoAzure:feature/azure-ai-agentserver-invocations_wsfrom
Open
Add invocations_ws WebSocket protocol#46779007DXR wants to merge 13 commits intoAzure:feature/azure-ai-agentserver-invocations_wsfrom
007DXR wants to merge 13 commits intoAzure:feature/azure-ai-agentserver-invocations_wsfrom
Conversation
…text - Updated all test files to replace InvocationAgentServerHost with ConversationAgentServerHost. - Changed references from InvocationContext to ConversationContext. - Adjusted WebSocket endpoint paths from /invocations/ws to /conversations/ws. - Modified test assertions to check for conversation_id instead of invocation_id. - Ensured that all relevant tests for graceful shutdown, invoke actions, request limits, and tracing are consistent with the new conversation model.
…-6256859 (Azure#46749) * Configurations: 'specification/fileshares/resource-manager/Microsoft.FileShares/FileShares/tspconfig.yaml', and CommitSHA: '61f4dfae58f52c2c814ea7c6653ce77ac0cacd4a' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6256859 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. * update test files * Update pyproject.toml * Configurations: 'specification/fileshares/resource-manager/Microsoft.FileShares/FileShares/tspconfig.yaml', and CommitSHA: '75ca22c5387184fb1f0c3b115ed22a006813800d' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6257089 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. * update Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * update --------- Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com> Co-authored-by: Chenxi Jiang (WICRESOFT NORTH AMERICA LTD) <v-chenjiang@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rtions - Disable OpenTelemetry metrics exporter during tests to prevent noisy tracebacks. - Ensure clean shutdown of OpenTelemetry providers in pytest. - Update APPLICATIONINSIGHTS_CONNECTION_STRING in tests to a placeholder value. - Modify logging levels in tests to capture warnings instead of errors. - Adjust assertions in tracing tests to reflect expected behavior when tracing is not configured.
Contributor
|
Thank you for your contribution @007DXR! We will review the pull request and get back to you soon. |
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.
Summary
Add invocations_ws WebSocket protocol into azure-ai-agentserver-invocations so a single host can serve both the HTTP
invocationsand the WebSocketinvocations_wsprotocols.What's new
New public API (exported from
azure.ai.agentserver.invocations)InvocationWSAgentServerHost—AgentServerHostsubclass exposing a single persistent WebSocket endpoint at/invocations_ws/wsthat handlesinvoke,get_invocation, andcancel_invocationactions on one connection. Streaming is supported natively viaasyncgenerator handlers.InvocationWSContext— passed to handlers; carriesinvocation_idand resolvedsession_id.InvocationWSError(code, message)— raise from a handler to return a domain‑specific error frame to the client without leaking internals.Decorator‑based handler registration
@app.ws_invoke_handler(required) — supports bothasync def(non‑streaming) andasync defgenerators (streaming).@app.ws_get_invocation_handler(optional)@app.ws_cancel_invocation_handler(optional)Operational features
ws_ping_interval(default30s, set to0to disable) so connections survive Azure APIM / Load Balancer ~4‑minute idle timeouts. Symmetricping/pongactions in both directions.FOUNDRY_AGENT_SESSION_IDenv var → generated UUID.GET /invocations_ws/docs/openapi.json.invoke_agent,get_invocation,cancel_invocation) and attributes/error tags under theazure.ai.agentserver.invocations_ws.*namespace.Multi‑protocol composition
InvocationWSAgentServerHostandInvocationAgentServerHostuse cooperative multiple inheritance, so a single host class can register both@app.invoke_handler(HTTP) and@app.ws_invoke_handler(WebSocket) — see the "Combined HTTP + WebSocket host" section in README.md.Changes in this PR
InvocationWSAgentServerHost,InvocationWSContext, andInvocationWSErrortypes under azure-ai-agentserver-invocations/azure.streaming_ws_invoke_agentsample under samples/streaming_ws_invoke_agent demonstrating token‑by‑token streaming over both WebSocket and HTTP SSE.test_ws_invoke.py,test_ws_get_cancel.py,test_ws_decorator_pattern.py,test_ws_session_id.py,test_ws_keepalive.py,test_ws_tracing.py,test_ws_span_parenting.py,test_ws_server_routes.py,test_ws_edge_cases.py,test_ws_request_limits.py,test_ws_graceful_shutdown.py,test_ws_multimodal_protocol.py, plus a sharedconftest_ws.py.invocations_ws)" section, including client examples, session/streaming/long‑running patterns, and a combined HTTP+WS host example.