-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codebugSomething isn't workingSomething isn't workingtriage
Description
Describe the bug
The ChatCompletionAgent is not emitting agent telemetry details, it is only emitting tracing for the chat_completion operation.
To Reproduce
Steps to reproduce the behavior:
- Setup OpenTelemetry Console sample: https://learn.microsoft.com/en-us/semantic-kernel/concepts/enterprise-readiness/observability/telemetry-with-console?tabs=Powershell-CreateFile,EnvironmentFile&pivots=programming-language-csharp
- Replace kernel invocation with:
var agent = new ChatCompletionAgent
{
Name = "Conference Room Agent",
Kernel = kernel,
Arguments = new KernelArguments(
new OpenAIPromptExecutionSettings {
ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions
}
)
};
ChatHistoryAgentThread agentThread = new();
var message = new ChatMessageContent(AuthorRole.User, "Reserve a conference room for me today.");
await foreach (ChatMessageContent response in agent.InvokeAsync(message, agentThread))
{
Console.WriteLine("Answer: " + response.Content);
}
- Observe
gen_ai.operation.name
ischat.completions
and nogen_ai.agent.name
is output.
Expected behavior
ChatCompletionAgent should be calling ModelDiagnostics.StartAgentInvocationActivity
similar to AzureAIAgent
and OpenAIAssistantAgent
Platform
- Language: C#
- Source: NuGet 1.61.0
- AI model: All models (using Azure OpenAI GPT 4.1)
- IDE: Rider
- OS: Mac
Additional context
-
seems this isn't called:
() => ModelDiagnostics.StartAgentInvocationActivity(this.Id, agentName, this.Description), -
telemetry console exporter output
Activity.TraceId: a9789e291cd884d3043831adea2acf59
Activity.SpanId: fe8a508e0c09b1cc
Activity.TraceFlags: Recorded
Activity.DisplayName: chat.completions mq-develop-gpt-4o-mini
Activity.Kind: Client
Activity.StartTime: 2025-07-24T19:53:28.4987000Z
Activity.Duration: 00:00:01.4005670
Activity.Tags:
gen_ai.operation.name: chat.completions
gen_ai.system: openai
gen_ai.request.model: mq-develop-gpt-4o-mini
gen_ai.usage.input_tokens: 72
gen_ai.usage.output_tokens: 16
gen_ai.response.finish_reason: ["ToolCalls"]
gen_ai.response.id: chatcmpl-BwwILU8JG0wqSTF7vk6rZDF7BNihv
Metadata
Metadata
Assignees
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codebugSomething isn't workingSomething isn't workingtriage