microsoft / microsoft/agent-framework
.NET: Investigation: .NET OTel auto-instrumentation convention for Agent Framework
@rogerbarreto is already working on this.
Since May 14, 2026.
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 2.3k
- Avg merge
- 2d 45m
- Merged PRs (30d)
- 358
Description
## Objective
Big OTel rock in .NET land. Tribe pattern say: `AddXxxInstrumentation()` on provider, kill switch env var, separate package. Tribe use ASP.NET Core, Azure SDK, EF Core. Same shape.
Agent Framework today: must wrap each agent by hand with `UseOpenTelemetry()`. No tribe pattern. No kill switch. No one-line activate.
Need investigate. Not code yet. Lay stone first:
- Where instrumentation live? Core? New `Microsoft.Agents.AI.OpenTelemetry` package? Contrib `OpenTelemetry.Instrumentation.AgentFramework` (open-telemetry tribe own `OpenTelemetry.*` prefix on nuget, can't take)?
- How activate? DI auto-decorate `AIAgent`? Provider builder extension? Both? Idempotent?
- Kill switch env var name? `OTEL_DOTNET_AGENTFRAMEWORK_INSTRUMENTATION_ENABLED`?
- Source name rename? Today `Experimental.Microsoft.Agents.AI`. Tribe say `Microsoft.Agents.AI`.
- Workflows source `Microsoft.Agents.AI.Workflows` same package?
- Long term: move emit into base `AIAgent` BCL `ActivitySource` listener-driven (like `HttpClient`)? Skip wrapper?
- Future: contrib package shim post-GA, post-stable gen-AI semconv?
Land ADR with options + decision before any code. Existing ADR 0003 stay. New ADR add on top.
## Outcome
ADR `docs/decisions/0026-agent-otel-auto-instrumentation.md` proposed, reviewed, accepted. Then implementation issue spin off.
## Refs
- ADR 0003 (current `OpenTelemetryAgent` wrapper)
- https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md
- https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/config.md
- https://www.nuget.org/packages/OpenTelemetry.Instrumentation.AspNetCore
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.