Skip to main content
LangSmith can capture traces generated by AutoGen using OpenTelemetry 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.
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.

Installation

Install the required packages using your preferred package manager:

Setup

1. Configure environment variables

Sending traces to an agent requires langsmith>=0.14.9. Set your API keys, agent identifier, and environment:

2. Configure OpenTelemetry integration

In your AutoGen agent, configure the LangSmith OpenTelemetry integration along with the OpenAI instrumentor:

3. Create and run your AutoGen agent

Once configured, your AutoGen agent will automatically send traces to LangSmith. Pass the tracer provider to the runtime for full tracing coverage:

Advanced usage

Custom metadata and tags

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

Combining with other instrumentors

You can combine AutoGen tracing with other OpenTelemetry instrumentors:

Resources