Skip to main content

Microsoft Agent Framework Documentation

Note on Agent Framework API Stability

Microsoft Agent Framework is in active beta development. API changes between versions are possible:
  • This instrumentation is tested against agent-framework==1.0.0b260130
  • The -latest test variant tracks breaking changes in new releases
  • If you encounter API compatibility issues, pin to the tested version:
    pip install agent-framework==1.0.0b260130
    

Install

pip install openinference-instrumentation-agent-framework

Setup

Microsoft Agent Framework emits telemetry using GenAI semantic conventions (gen_ai.* attributes). This package provides a SpanProcessor that transforms these spans to OpenInference format, enabling compatibility with observability tools that support the OpenInference standard.
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from agent_framework.observability import enable_instrumentation
from openinference.instrumentation.agent_framework import (
    AgentFrameworkToOpenInferenceProcessor
)

# Configure Arize endpoint
endpoint = "https://otlp.arize.com/v1/traces"

# Setup tracer with OpenInference processor
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(AgentFrameworkToOpenInferenceProcessor())
tracer_provider.add_span_processor(
    SimpleSpanProcessor(OTLPSpanExporter(endpoint=endpoint))
)
trace.set_tracer_provider(tracer_provider)

# Enable instrumentation
enable_instrumentation(enable_sensitive_data=True)

# Your agent code here
Note about sensitive data: Set enable_sensitive_data=True when calling enable_instrumentation() to capture message content in traces. This is required for full observability but may include PII.

Debug Mode

Enable debug mode to log transformation details:
processor = AgentFrameworkToOpenInferenceProcessor(debug=True)

Observe

Now that you have tracing setup, all Agent Framework requests will be streamed to Arize AX for observability and evaluation. Example integration notebook coming soon!

Resources