On this page

For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

Send Microsoft Agent Framework traces to Agent Analytics

The Microsoft Agent Framework emits OpenTelemetry GenAI spans. Point that exporter at Amplitude. You don't need the Amplitude AI SDK in the agent process. AutoGen users follow this page.

This page covers agent-framework-core 1.23.0 and agent-framework-openai 1.17.0 on Python, and Microsoft.Agents.AI 1.26.0 with Microsoft.Agents.AI.OpenAI 1.26.0 on .NET. Amplitude stores the spans you export. Scrub personal data before it leaves your infrastructure. Refer to Agent Analytics privacy modes.

Paste this prompt into your AI coding agent, such as Cursor, Claude Code, Windsurf, GitHub Copilot, or Codex.

text
Connect this Microsoft Agent Framework agent to Amplitude Agent Analytics with native OpenTelemetry.

Fetch https://raw.githubusercontent.com/amplitude/Amplitude-AI-Node/main/docs/integrations/microsoft-agent-framework.md
and follow "Part 2: Coding agent procedure".
If @amplitude/ai is installed, the same file is under node_modules/@amplitude/ai/docs/integrations/.
Also follow https://raw.githubusercontent.com/amplitude/Amplitude-AI-Node/main/docs/integrations/privacy.md
and scrub content before export.
Follow links in the guide. If your source isn't listed, start at https://raw.githubusercontent.com/amplitude/Amplitude-AI-Node/main/docs/integrations/README.md

Review the changes, then verify with the steps in Get started.

What this means for you

  • You run: The Agent Framework process, with its OpenTelemetry exporter pointed at Amplitude. Stamp identity in the exporter. The framework overwrites the conversation id after the span starts.
  • You need: agent-framework-core==1.23.0, agent-framework-openai==1.17.0, your Amplitude project API key, and a stable agent id, conversation id, and product-analytics user ID.
  • Protocol: OTLP over HTTP. Amplitude accepts protobuf and JSON. Amplitude doesn't accept gRPC.
  • Privacy: Amplitude doesn't scrub content after receipt. Leave ENABLE_SENSITIVE_DATA unset for metadata only. The session, user, agent, tool name, model, and token counts still arrive. Message text and tool arguments don't. Mask or drop content attributes before export when it is on.

Export

Set these variables before the process imports the framework. In Python, encode the space in the header value as %20. Leave Authorization= as written.

bash
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.amplitude.com/otlp/v1/traces
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20<project API key>"
OTEL_SERVICE_NAME=order-support
OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
ENABLE_SENSITIVE_DATA=true
ENABLE_INSTRUMENTATION=true

EU data residency uses https://api.eu.amplitude.com/otlp/v1/traces.

Call enable_instrumentation(enable_sensitive_data=True) once, on the agent only. Pass id to Agent so gen_ai.agent.id is a stable name rather than a generated UUID. Stamp user.id, session.id, gen_ai.conversation.id, and gen_ai.agent.id in an exporter wrapper. A span processor's on_start runs before the framework writes the provider response id onto gen_ai.conversation.id, and Amplitude reads that conversation id first.

Identity

What carries over

Tool output is [Agent] Tool Output. The continuation span in this capture carries the tool result, so the first user message isn't emitted again.

.NET

Microsoft.Agents.AI 1.26.0 emits chat and execute_tool on the activity source Experimental.Microsoft.Agents.AI. Set EnableSensitiveData so message text and tool arguments are on the spans. Left at the default, the session, user, agent, model, token counts, and tool name still arrive, and the message text and tool arguments don't. Set user.id, gen_ai.agent.id, and gen_ai.conversation.id on every span. The steps are in the Microsoft Agent Framework integration guide.

Session close

[Agent] Session End is optional and recommended. A native Agent Framework export doesn't send it. Amplitude closes the session after 30 minutes without a qualifying agent event by default, and 24 hours from the session start when no per-session override is set. The first close is the one that counts. Enrichment, including the Session Record and content-based signals, runs once after that close. The OpenTelemetry translator doesn't read an idle-timeout attribute from a span. Refer to How sessions close.

Get started

Follow the Microsoft Agent Framework integration guide. Send two turns with the same conversation id, then confirm in Live Events:

  1. Session ID is the conversation id, not the provider response id and not a trace ID.
  2. User ID is the product-analytics user, not unknown.
  3. Agent ID is the agent id you set, not a generated UUID.
  4. With sensitive data enabled, the turn shows User Message text, the tool call, and AI Response text, with the model name and both token counts. With EnableSensitiveData left off, the message text and the tool arguments don't arrive.
  5. The second turn doesn't duplicate the first user message.

Guide last verified on October 28, 2026, against agent-framework-core 1.23.0, agent-framework-openai 1.17.0, and Microsoft.Agents.AI 1.26.0. Microsoft Agent Framework is a trademark of its owner. Amplitude isn't affiliated with or endorsed by that owner.

Was this helpful?