---
title: Send Microsoft Agent Framework traces to Agent Analytics
description: "Export Microsoft Agent Framework OpenTelemetry spans to Agent Analytics, with session, user, and agent identity, and scrub content before it leaves your infrastructure."
product: general
lang: en
last_updated: 2026-10-28
token_estimate: 1662
---
# Send Microsoft Agent Framework traces to Agent Analytics

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

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](https://amplitude.com/docs/amplitude-ai/agent-analytics/privacy-modes).

## Set up with your AI coding agent (recommended)

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](#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

| Attribute | Value |
| --- | --- |
| `gen_ai.conversation.id` | The conversation, thread, or ticket ID. Use the same value on every turn. |
| `user.id` | The user ID product analytics already uses. Amplitude stores a missing user as `unknown`. |
| `gen_ai.agent.id` | A stable name for this agent. Set it with `Agent(id=...)`. Amplitude doesn't read `gen_ai.agent.name`. |

## What carries over

| Framework span | Amplitude event |
| --- | --- |
| Model invocation (`chat`) | `[Agent] AI Response`, plus an `[Agent] User Message` for each new user message after the last assistant message |
| Tool (`execute_tool`) | `[Agent] Tool Call` |
| Agent span (`invoke_agent`) | `[Agent] Span` |

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](https://github.com/amplitude/Amplitude-AI-Node/blob/main/docs/integrations/microsoft-agent-framework.md).

## 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](https://amplitude.com/docs/amplitude-ai/agent-analytics/sessions#how-sessions-close).

## Get started

Follow the [Microsoft Agent Framework integration guide](https://github.com/amplitude/Amplitude-AI-Node/blob/main/docs/integrations/microsoft-agent-framework.md). 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.

