Skip to content

Conversation

@threddy
Copy link
Contributor

@threddy threddy commented Jan 16, 2026

Why?

  1. Clients can configure their own custom sources in Agent Framework. Also see this. Spans from custom sources do not flow through logic we have in AgentFrameworkSpanProcessor.
  2. Input and output messages for invoke_agent and chat spans follow the role + parts + content + type format.

What?

  1. Allow specifying custom sources. Usage
    builder.AddA365Tracing(config => { config.WithAgentFramework(additionalSources: "myCustomSource"); });
  2. Clean up input and output messages attribute to keep only the actual messages.

Testing
Before change
image
gen_ai.input.messages
gen_ai.output.messages

With change
image

@threddy threddy requested a review from a team as a code owner January 16, 2026 05:53
Copilot AI review requested due to automatic review settings January 16, 2026 05:53
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 pull request enhances the Agent Framework observability extension to support custom activity sources and simplifies input/output message attributes by extracting only text content.

Changes:

  • Adds support for custom activity sources via an optional additionalSources parameter in WithAgentFramework()
  • Implements message filtering and text extraction logic to clean up gen_ai.input.messages and gen_ai.output.messages tags
  • Introduces comprehensive test coverage for the new message processing functionality

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 27 comments.

Show a summary per file
File Description
Microsoft.Agents.A365.Observability.Extension.Tests.csproj Adds project reference to AgentFramework extension for testing
AgentFrameworkSpanProcessorHelperTests.cs New test file with comprehensive coverage for message filtering and text extraction
AgentFrameworkSpanProcessorHelper.cs New helper class implementing message filtering logic to extract text content from user/assistant messages
AgentFrameworkMessageContent.cs New model classes for deserializing Agent Framework message structure
Microsoft.Agents.A365.Observability.Extensions.AgentFramework.csproj Adds InternalsVisibleTo for test project access
BuilderExtensions.cs Updates WithAgentFramework to accept custom sources and updates copyright header format (inconsistent)
AgentFrameworkSpanProcessor.cs Adds constructor parameter for custom sources and implements source filtering for invoke_agent, chat, and execute_tool operations

@threddy threddy merged commit 0222fb1 into main Jan 20, 2026
5 checks passed
@threddy threddy deleted the users/threddy/cleanup-agent-framework-input-output branch January 20, 2026 19:24
pontemonti pushed a commit that referenced this pull request Feb 5, 2026
Port from Node.js SDK PR #183 - adds x-ms-agentid header to all
outbound HTTP requests to the MCP platform for agent identification.

Header priority:
1. Agent Blueprint ID from TurnContext (agenticAppBlueprintId)
2. Agent Blueprint ID from token (xms_par_app_azp claim)
3. Entra Application ID from token (appid or azp claim)
4. Application name from entry assembly

Changes:
- Add GetAgentIdFromToken() and GetApplicationName() to Runtime Utility
- Add AgentIdHeader constant to Tooling Constants
- Update HttpContextHeadersHandler to add x-ms-agentid header
- Pass authToken to HttpContextHeadersHandler for header resolution
- Add InternalsVisibleTo for test access
- Add comprehensive unit tests for new methods
- Add PRD documentation
pontemonti added a commit that referenced this pull request Feb 5, 2026
Port from Node.js SDK PR #183 - adds x-ms-agentid header to all
outbound HTTP requests to the MCP platform for agent identification.

Header priority:
1. Agent Blueprint ID from TurnContext (agenticAppBlueprintId)
2. Agent Blueprint ID from token (xms_par_app_azp claim)
3. Entra Application ID from token (appid or azp claim)
4. Application name from entry assembly

Changes:
- Add GetAgentIdFromToken() and GetApplicationName() to Runtime Utility
- Add AgentIdHeader constant to Tooling Constants
- Update HttpContextHeadersHandler to add x-ms-agentid header
- Pass authToken to HttpContextHeadersHandler for header resolution
- Add InternalsVisibleTo for test access
- Add comprehensive unit tests for new methods
- Add PRD documentation

Co-authored-by: Johan Broberg <johanb@microsoft.com>
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.

3 participants