Skip to main content
LangSmith can capture traces generated by Microsoft Agent Framework using its built-in OpenTelemetry instrumentation. This guide shows you how to automatically capture traces from your Microsoft Agent Framework agents and send them to LangSmith for monitoring and analysis.
In an agent-based workspace, create an agent once before sending traces. Use agent addressing to select its identifier and environment. If an integration requires project_name, use the selected environment’s tracer_session_name as a compatibility value.

Installation

Install the required packages:

Setup

1. Configure environment variables

Enable OpenTelemetry instrumentation of the agent and set the OpenTelemetry environment variables to point to the LangSmith OTEL endpoint:

2. Enable OpenTelemetry in your agent

In your Microsoft Agent Framework code, enable OpenTelemetry tracing using the built-in configure_otel_providers function:
Setting enable_sensitive_data=True allows capturing input and output content in traces. Set to False if you want to exclude sensitive data from traces.

3. Create and run your agent

Once configured, your Microsoft Agent Framework agents will automatically send traces to LangSmith: