-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Description
Create IChatClient:
string endpoint = _config.GetRequired("AZURE_OPENAI_ENDPOINT");
string deploymentName = _config.GetRequired("AZURE_OPENAI_DEPLOYMENT_NAME");
string apiKey = _config.GetRequired("AZURE_OPENAI_API_KEY");
AzureOpenAIClient azureOpenAIClient = new(new(endpoint), new ApiKeyCredential(apiKey));
IChatClient chatClient = azureOpenAIClient
.GetChatClient(deploymentName)
.AsIChatClient();
IChatClient otelChatClient = new ChatClientBuilder(chatClient)
.UseOpenTelemetry(sourceName: _otelConfig.SourceName)
.Build();
Create AIAgent:
AIAgent agent = _chatClient
.AsAIAgent(
name: Name,
description: Description,
instructions: Instructions,
tools: _toolRepository.Tools)
.AsBuilder()
.UseOpenTelemetry(sourceName: _otelConfig.SourceName)
.Build()
Trigger agent directrly - Otel is emitted:
agent.RunStreamingAsync("Tell me a joke about a pirate.")
Activity.TraceId: 84a8eedb8cbe1407ee0ed882abed7714
Activity.SpanId: cb81234e17b71277
Activity.TraceFlags: Recorded
Activity.DisplayName: invoke_agent Orchestrator-Agent(39f55520b807458e96865cc3bb8502ee)
Activity.Kind: Client
Activity.StartTime: 2026-02-06T09:47:18.9291545Z
Activity.Duration: 00:00:12.2744279
Activity.Tags:
gen_ai.operation.name: invoke_agent
gen_ai.request.model: gpt-5.2
gen_ai.provider.name: openai
server.address: oai-ai-viul-sandbox-swed.cognitiveservices.azure.com
server.port: 443
gen_ai.agent.id: 39f55520b807458e96865cc3bb8502ee
gen_ai.agent.name: Orchestrator-Agent
gen_ai.agent.description: Performs arithmetic calculations
gen_ai.response.finish_reasons: ["stop"]
gen_ai.response.id: chatcmpl-D6CiuhonjXur3lIEf3x6tVaqMbyF2
gen_ai.response.model:
gen_ai.usage.input_tokens: 75
gen_ai.usage.output_tokens: 28
Instrumentation scope (ActivitySource):
Name: a2a-poc
Resource associated with Activity:
service.name: a2a-poc-service
service.instance.id: 98570eeb-d4ed-4a55-ace5-1f29367966b4
telemetry.sdk.name: opentelemetry
telemetry.sdk.language: dotnet
telemetry.sdk.version: 1.15.0
Setup AGUI server:
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddAGUI();
...
WebApplication app = builder.Build();
app.MapAGUI("/", agent);
await app.RunAsync();
Trigger through AGUI Client:
string serverUrl = "http://localhost:5001";
AGUIChatClient chatClient = new(new(), serverUrl);
AIAgent aguiAgent = chatClient.AsAIAgent();
aguiAgent.RunStreamingAsync("Tell me a joke about a pirate.");
Telemetry is not emitted.
Code Sample
Error Messages / Stack Traces
Package Versions
1.0.0-preview.260128.1
.NET Version
No response
Additional Context
No response
Reactions are currently unavailable