Skip to main content
Microsoft Agent Framework is Microsoft’s open-source SDK for building production AI agents: chat, tools, multi-agent orchestration. The framework emits raw OpenTelemetry spans using GenAI semantic conventions; the openinference-instrumentation-agent-framework span processor reshapes them into the OpenInference format Phoenix expects.
This example was tested with agent-framework-openai 1.17.0 and openinference-instrumentation-agent-framework 0.1.13. Microsoft Agent Framework evolves quickly; if a newer release changes the API, pin the version with pip install "agent-framework-openai==1.17.0".

Install

Install only the connector you need. The agent-framework meta-package pulls in every provider connector through agent-framework-core[all] and can fail with resolution-too-deep. For another provider, install its connector instead: agent-framework-anthropic, agent-framework-gemini, agent-framework-bedrock, agent-framework-mistral, agent-framework-ollama, or agent-framework-foundry for Azure AI Foundry. The tracing setup below is the same for all of them.

Setup

Set your API keys as environment variables:
Instrument Agent Framework with the openinference-instrumentation-agent-framework processor plus enable_instrumentation(), regardless of model provider (OpenAI, Anthropic, Azure). Do not use a provider instrumentor such as AnthropicInstrumentor or OpenAIInstrumentor. Agent Framework drives the model through its own client layer and emits its own OpenTelemetry spans, so a provider instrumentor captures no traces.
enable_instrumentation() must run after register(), and the two add_span_processor calls must stay in this order. If spans reach Phoenix with raw gen_ai.* attributes instead of OpenInference ones, the processor was added after the exporter.

Run Microsoft Agent Framework

Observe

Each agent.run() call appears in Phoenix as one trace: an AGENT span named invoke_agent wrapping an LLM span for the chat call, carrying the system and user messages, the response, the model name, and token usage. Without enable_sensitive_data=True, prompts and responses are stripped from the spans. The processor maps Agent Framework operations to OpenInference span kinds: Agents that share a gen_ai.conversation.id are grouped into a Phoenix session.

Resources