Skip to main content
LangSmith can capture traces generated by AutoGen using OpenInferenceโ€™s AutoGen instrumentation. This guide shows you how to automatically capture traces from your AutoGen multi-agent conversations and send them to LangSmith for monitoring and analysis.

Installation

Install the required packages using your preferred package manager:
Requires LangSmith Python SDK version langsmith>=0.4.26 for optimal OpenTelemetry support.

Setup

1. Configure environment variables

Set your API keys and project name:

2. Configure OpenTelemetry integration

In your AutoGen application, import and configure the LangSmith OpenTelemetry integration along with the AutoGen and OpenAI instrumentors:
You do not need to set any OpenTelemetry environment variables or configure exporters manuallyโ€”configure() handles everything automatically.

3. Create and run your AutoGen application

Once configured, your AutoGen application will automatically send traces to LangSmith:

Advanced usage

Custom metadata and tags

You can add custom metadata to your traces by setting span attributes in your AutoGen application:

Combining with other instrumentors

You can combine AutoGen instrumentation with other instrumentors (e.g., Semantic Kernel, DSPy) by adding them and initializing them as instrumentors:

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.