Tracing Microsoft Agent Framework Agents in C# with OpenTelemetry and Claude

A new guide explains how to use OpenTelemetry tracing to observe what happens during an agent run built with Microsoft Agent Framework. Each model call, tool call and workflow step is recorded as a span, with token counts attached, so developers can see the work behind a single answer. The framework counts tokens, while converting them into costs requires a price table maintained by the developer. The tutorial demonstrates tracing a kitchen assistant agent and a planner-to-reviewer workflow using Claude Haiku, with spans printed to the console or sent to the Aspire dashboard. It lists the package versions used, including .NET 10, Agent Framework 1.24.0 and OpenTelemetry 1.19.1, and notes that the code depends only on IChatClient, so other providers can be substituted.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in