Skip to content

Add parent_id support to ExecuteToolScope and InferenceScope#177

Merged
nikhilNava merged 2 commits intomainfrom
copilot/add-parent-id-support-execute-tools
Feb 11, 2026
Merged

Add parent_id support to ExecuteToolScope and InferenceScope#177
nikhilNava merged 2 commits intomainfrom
copilot/add-parent-id-support-execute-tools

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Extends parent span linking (from #164) to ExecuteToolScope and InferenceScope, enabling W3C Trace Context linking for tool execution and inference spans.

Changes

  • ExecuteToolScope: Added optional parent_id parameter to start() and __init__()
  • InferenceScope: Added optional parent_id parameter to start() and __init__()
  • Both pass parent_id to base class OpenTelemetryScope for context propagation
  • Added unit tests for parent span linking verification

Usage

parent_id = "00-{trace_id}-{span_id}-01"

with ExecuteToolScope.start(details, agent_details, tenant_details, parent_id=parent_id):
    ...

with InferenceScope.start(details, agent_details, tenant_details, parent_id=parent_id):
    ...

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • il-1234567812345678123456781234567.8.tenant.api.powerplatform.com
    • Triggering command: /home/REDACTED/work/Agent365-python/Agent365-python/.venv/bin/pytest pytest tests/observability/core/ -v --tb=short -m not integration (dns block)
    • Triggering command: /home/REDACTED/work/Agent365-python/Agent365-python/.venv/bin/pytest pytest tests/ -v --tb=short -m not integration (dns block)
  • il-testtenan.t.tenant.api.powerplatform.com
    • Triggering command: /home/REDACTED/work/Agent365-python/Agent365-python/.venv/bin/pytest pytest tests/observability/core/ -v --tb=short -m not integration (dns block)
    • Triggering command: /home/REDACTED/work/Agent365-python/Agent365-python/.venv/bin/pytest pytest tests/ -v --tb=short -m not integration (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 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.

…rent span linking

Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support to set parent Id on execute tools and inference spans Add parent_id support to ExecuteToolScope and InferenceScope Feb 11, 2026
Copilot AI requested a review from nikhilNava February 11, 2026 15:21
@nikhilNava nikhilNava marked this pull request as ready for review February 11, 2026 15:35
@nikhilNava nikhilNava requested a review from a team as a code owner February 11, 2026 15:35
Copilot AI review requested due to automatic review settings February 11, 2026 15:35
@github-actions
Copy link

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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

Extends existing W3C Trace Context parent span linking to ExecuteToolScope and InferenceScope by adding an optional parent_id parameter and propagating it into OpenTelemetryScope so spans can be created under an upstream parent context.

Changes:

  • Added optional parent_id argument to ExecuteToolScope.start()/__init__() and passed it to OpenTelemetryScope.
  • Added optional parent_id argument to InferenceScope.start()/__init__() and passed it to OpenTelemetryScope.
  • Added unit tests asserting spans inherit the parent trace/span IDs when parent_id is provided.

Reviewed changes

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

File Description
tests/observability/core/test_inference_scope.py Adds a unit test validating parent linking behavior for InferenceScope.
tests/observability/core/test_execute_tool_scope.py Adds a unit test validating parent linking behavior for ExecuteToolScope.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/inference_scope.py Plumbs parent_id through InferenceScope creation into the base OTel scope.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/execute_tool_scope.py Plumbs parent_id through ExecuteToolScope creation into the base OTel scope.

@nikhilNava nikhilNava merged commit c7b2497 into main Feb 11, 2026
15 checks passed
@nikhilNava nikhilNava deleted the copilot/add-parent-id-support-execute-tools branch February 11, 2026 16:33
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.

4 participants