Microsoft Agent Framework Integration
Updated on Aug 14, 2026
Use this integration when your app is implemented in .NET with IAgent.
Setup
- Install SDK
bash
dotnet add package Progress.Observability.Instrumentation
- Instrument your app
The minimal form below captures agent-level spans. Add .AddObservability() on the chat client (shown in the complete example) to also capture LLM calls.
cs
try
{
ObservabilityTracer.Initialize(new ObservabilityOptions()
{
AppName = Environment.GetEnvironmentVariable("OBSERVABILITY_APP_NAME")!,
ApiKey = Environment.GetEnvironmentVariable("OBSERVABILITY_API_KEY")!
});
chatClient.AsAIAgent(instructions: "You are a friendly assistant.")
.AsBuilder()
.UseOpenTelemetry(sourceName: "Progress.Observability.AgentMonitoring")
.Build();
// Your code here.
}
finally
{
// Call the Shutdown() method before exiting your agent to flush any remaining data.
ObservabilityTracer.Shutdown();
}
- Complete example
cs
using System.ComponentModel;
using DotNetEnv;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
using OpenAI;
using Progress.Observability.Extensions.AI;
using OpenAI.Chat;
[Description("Get the weather for a given location.")]
static string GetWeather([Description("The location to get the weather for.")] string location)
=> $"The weather in {location} is cloudy with a high of 15°C.";
try {
Env.Load(".env");
// INITIALIZE PROGRESS OBSERVABILITY
ObservabilityTracer.Initialize(new ObservabilityOptions()
{
AppName = "Microsoft Agent Framework",
ApiKey = Environment.GetEnvironmentVariable("OBSERVABILITY_API_KEY")!
});
List<AITool> tools = [AIFunctionFactory.Create(GetWeather)];
AIAgent agent = new OpenAIClient(
Environment.GetEnvironmentVariable("OPENAI_API_KEY")!)
.GetChatClient("gpt-4o-mini")
.AsIChatClient()
// ADD LLM OBSERVABILITY
.AddObservability((options) =>
{
options.AppName = "Microsoft Agent Framework";
options.ApiKey = Environment.GetEnvironmentVariable("OBSERVABILITY_API_KEY")!;
})
.AsAIAgent(instructions: "You are a helpful assistant.", tools: tools)
.AsBuilder()
// ADD AGENT OBSERVABILITY by using the default source name
.UseOpenTelemetry(sourceName: "Progress.Observability.AgentMonitoring", configure: agent =>
{
// To send input/output/tools data to Progress Observability.
// Set to false if you don't want to send potentially sensitive data.
agent.EnableSensitiveData = true;
})
.Build();
Console.WriteLine(await agent.RunAsync("What is the weather like in Amsterdam?"));
}
finally
{
ObservabilityTracer.Shutdown();
}