Repository navigation
Discovery endpoint for MCS client - #630
Merged
Merged
Conversation
Rodrigo Brandão (rodrigobr-msft)
approved these changes
Oct 16, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Discovery introduces routing regressions for clients sharing settings and published agents using experimental endpoints.
2 open findings
What changed in this PR
Adds conversation endpoint discovery to the Copilot Studio client for published agents, while retaining legacy routing for explicit URLs and prebuilt agents.
Changes:
- Discovers, validates, and caches operation URLs.
- Adds discovery error handling and regression tests.
- Updates documentation and sample authentication and configuration.
| File | Description |
|---|---|
| tests/copilotstudio_client/test_copilot_client.py | Adjusts legacy-routing tests. |
| tests/copilotstudio_client/test_conversation_endpoint_discovery.py | Tests discovery, validation, caching, and retries. |
| tests/copilotstudio_client/test_console_sample.py | Tests token acquisition behavior. |
| test_samples/copilot_studio_client_sample/README.md | Documents setup and discovery. |
| test_samples/copilot_studio_client_sample/env.TEMPLATE | Adds cloud and discovery configuration. |
| test_samples/copilot_studio_client_sample/app.py | Updates authentication and entry point. |
| libraries/microsoft-agents-copilotstudio-client/readme.md | Explains discovery and overrides. |
| libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/power_platform_environment.py | Normalizes cloud base addresses. |
| libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/errors/error_resources.py | Adds discovery errors. |
| libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/copilot_client.py | Integrates discovery into conversation operations. |
| libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/_conversation_endpoint_discovery.py | Implements endpoint validation and substitution. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.

This pull request introduces conversation endpoint discovery to the Copilot Studio client, improving how the client locates and validates agent endpoints for published agents. The client now discovers, validates, and caches conversation operation URLs for published agents without a
direct_connect_url, and falls back to legacy routing for prebuilt agents or explicit URLs. Error handling and documentation are also enhanced. The most important changes are grouped below.Conversation Endpoint Discovery
_conversation_endpoint_discovery.pymodule implementing endpoint discovery, validation, and theConversationEndpointsdataclass for managing operation URLs. This includes strict validation of discovered URLs and error handling for invalid responses or missing data.CopilotClient, including asynchronous discovery, caching, and thread-safe initialization. All conversation operations (start_conversation,ask_question_with_activity,start_conversation_with_request,subscribe) now use the discovered endpoints when appropriate. [1] [2] [3] [4] [5] [6]readme.mdand sample README) to describe endpoint discovery, configuration, and usage, including sample environment variables and setup instructions. [1] [2] [3]Error Handling and Validation
Sample and Test Improvements
These changes modernize the client’s connection logic, improve robustness, and provide clearer guidance for users and developers.