Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 8, 2026

SDK Parity: Scope and Domain Overrides

Porting changes from .NET PR #133 to enable pre-production testing.

Implementation Plan

  • Understand the .NET PR changes
  • Add environment variable support for A365_OBSERVABILITY_SCOPE_OVERRIDE in environment_utils.py
  • Update get_observability_authentication_scope() to check override
  • Add environment variable support for A365_OBSERVABILITY_DOMAIN_OVERRIDE in agent365_exporter.py
  • Update exporter to use domain override when available
  • Add tests for scope override in test_environment_utils.py
  • Add tests for domain override in test_agent365_exporter.py
  • Run tests to verify changes (all 22 tests passing)
  • Address code review feedback:
    • Added validation for empty/whitespace strings in both overrides
    • Added validation for domain format (no protocol or path separators)
    • Moved domain override reading to init to avoid repeated env var reads
    • Improved test cleanup using setUp/tearDown methods
    • Added better URL format assertions in tests
    • Added comprehensive documentation about expected format
    • Added 3 new validation tests for domain override
    • Added 3 new validation tests for scope override
  • Run CodeQL security scan (0 alerts)

Changes Summary

Scope Override (environment_utils.py):

  • Added support for A365_OBSERVABILITY_SCOPE_OVERRIDE environment variable
  • Modified get_observability_authentication_scope() to check override before returning default
  • Added validation to strip whitespace and ignore empty strings
  • Added documentation about expected format

Domain Override (agent365_exporter.py):

  • Added support for A365_OBSERVABILITY_DOMAIN_OVERRIDE environment variable
  • Updated export logic to use domain override when available
  • Domain override is read once in init for performance
  • Added validation to ensure domain doesn't contain protocol or path separators
  • Bypasses PowerPlatformApiDiscovery when override is present

Testing:

  • Added 6 new tests for scope override functionality (including validation)
  • Added 5 new tests for domain override functionality (including validation)
  • Improved test cleanup with setUp/tearDown methods
  • All existing tests continue to pass (backward compatibility verified)

Security Summary

CodeQL security scan completed with 0 alerts. No security vulnerabilities introduced.

Original prompt

This section details on the original issue you should resolve

<issue_title>[SDK Parity] Python for PR microsoft/Agent365-dotnet#133</issue_title>
<issue_description>## SDK Parity Update Required

This issue was automatically created by the AI-First Polling workflow to maintain SDK parity.

Source PR Information

Original PR: microsoft/Agent365-dotnet#133 - [Observability] Scope and domain overrides
PR URL: microsoft/Agent365-dotnet#133
PR Author: @threddy

PR Description

Why? To enable 1P testing in pre-prodWhat? Enable overrides for scope and domain via environment variables "A365_OBSERVABILITY_DOMAIN_OVERRIDE" and "A365_OBSERVABILITY_SCOPE_OVERRIDE".------This PR introduces configuration-based overrides for the observability domain and authentication scope to enable testing against pre-production environments. The changes add two new configuration keys (A365_OBSERVABILITY_DOMAIN_OVERRIDE and A365_OBSERVABILITY_SCOPES_OVERRIDE) that allow runtime customization of Power Platform API endpoints and authentication scopes without code changes.Key ChangesAdded EnvironmentUtils.Initialize() method to cache scope override from configurationExtended PowerPlatformApiDiscovery and Agent365ExporterCore to accept optional domain overridesCreated comprehensive test coverage for both override mechanisms


Parity Task

Changes detected in: .NET/C# SDK
Target SDK: Python

Action Required

Please apply the changes described in the original PR (microsoft/Agent365-dotnet#133) to the Python SDK to maintain feature parity across all SDKs.

Before implementing:

  • First, check if this feature already exists in the Python SDK
  • If the feature is already implemented, close this issue with the wontfix label and add a comment explaining that parity already exists

For bug fixes (IMPORTANT):

  • Bug fixes require extra caution - only act if the same bug exists in the Python SDK
  • Carefully analyze whether the bug described in the original PR replicates in the target platform
  • If the bug does NOT exist in the Python SDK, close this issue with the wontfix label and explain that the bug is not present
  • Stay strictly in context - only fix the specific bug described, do not make additional changes or "improvements"
  • Do not port bug fixes that are specific to the source SDK's language or platform constraints

When creating the PR for this implementation:

  • Assign the PR to @threddy (the author of the original PR)
  • Reference this issue in the PR description
  • Ensure the PR description explains what parity changes were made

Implementation Guidelines for Python

When implementing this feature in the Python SDK:

  • Review existing code in python/libraries/ to understand the codebase structure and patterns
  • Follow the coding style, naming conventions, and architectural patterns used in the Python SDK
  • Check for configuration files (e.g., pyproject.toml, .flake8, mypy.ini) that define coding standards
  • Ensure your implementation is consistent with existing SDK components
  • Include appropriate tests following the testing patterns in the Python SDK

Related Information


This is an automated issue. Please close with wontfix label if parity is not needed.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@sergioescalera
Copy link
Contributor

🤖 Auto-Assignment

This PR was automatically assigned to @threddy for review.

Reason: This is a parity implementation for issue #106, which was triggered by @threddy's original PR (microsoft/Agent365-dotnet#133).

Next Steps:

  • @threddy: Please review this implementation to ensure it matches your intent
  • Validate the parity changes are correct and complete
  • Approve and merge when satisfied

Automated by AI-First Polling Workflow

Copilot AI changed the title [WIP] Update SDK parity for observability in Python [SDK Parity] Add scope and domain overrides for observability pre-prod testing Jan 8, 2026
Copilot AI requested a review from sergioescalera January 8, 2026 19:21
@sergioescalera sergioescalera marked this pull request as ready for review January 8, 2026 22:29
@sergioescalera sergioescalera requested review from a team as code owners January 8, 2026 22:29
Copilot AI review requested due to automatic review settings January 8, 2026 22:29
Copy link
Contributor

Copilot AI left a comment

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 adds environment variable overrides for observability authentication scope and domain to enable testing against pre-production environments, maintaining SDK parity with .NET PR microsoft/Agent365-dotnet#133.

Key Changes:

  • Added A365_OBSERVABILITY_SCOPE_OVERRIDE environment variable to override the default authentication scope
  • Added A365_OBSERVABILITY_DOMAIN_OVERRIDE environment variable to bypass PowerPlatformApiDiscovery and target custom endpoints
  • Included comprehensive test coverage for both override mechanisms

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/environment_utils.py Modified get_observability_authentication_scope() to check for scope override before returning default
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py Modified export() method to use domain override when present, bypassing PowerPlatformApiDiscovery
tests/runtime/test_environment_utils.py Added two new tests for scope override functionality
tests/observability/core/test_agent365_exporter.py Added two new tests for domain override functionality
Comments suppressed due to low confidence (1)

libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py:101

  • If the domain override includes a protocol prefix (e.g., "https://preprod.example.com"), the URL construction will result in malformed URLs like "https://https://preprod.example.com/...". Consider either documenting that the override should be hostname-only, or strip any protocol prefix from the override value before using it.
                domain_override = os.getenv("A365_OBSERVABILITY_DOMAIN_OVERRIDE")
                if domain_override:
                    endpoint = domain_override
                else:
                    discovery = PowerPlatformApiDiscovery(self._cluster_category)
                    endpoint = discovery.get_tenant_island_cluster_endpoint(tenant_id)
                endpoint_path = (
                    f"/maven/agent365/service/agents/{agent_id}/traces"
                    if self._use_s2s_endpoint
                    else f"/maven/agent365/agents/{agent_id}/traces"
                )
                url = f"https://{endpoint}{endpoint_path}?api-version=1"

juliomenendez
juliomenendez previously approved these changes Jan 8, 2026
threddy
threddy previously approved these changes Jan 9, 2026
@nikhilNava nikhilNava dismissed stale reviews from threddy and juliomenendez via 4d8a171 January 9, 2026 12:31
@nikhilNava nikhilNava enabled auto-merge (squash) January 9, 2026 14:53
@nikhilNava nikhilNava merged commit f47b62b into main Jan 9, 2026
8 checks passed
@nikhilNava nikhilNava deleted the copilot/update-sdk-parity-python-again branch January 9, 2026 14:54
@tirthdoshi009
Copy link

🧹 Deployment Cleanup Complete

The Azure Container App deployment for this PR has been cleaned up.

  • Container App: agent-framework-pr-107
  • Resource Group: agent365-samples-rg
  • Status: Deleted

Thank you for contributing! 🎉

1 similar comment
@tirthdoshi009
Copy link

🧹 Deployment Cleanup Complete

The Azure Container App deployment for this PR has been cleaned up.

  • Container App: agent-framework-pr-107
  • Resource Group: agent365-samples-rg
  • Status: Deleted

Thank you for contributing! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SDK Parity] Python for PR microsoft/Agent365-dotnet#133

7 participants