Skip to main content
LangWatch integrates with PydanticAI through its built-in OpenTelemetry support to capture traces of agent runs and model interactions.

Installation

Usage

The LangWatch API key is configured by default via the LANGWATCH_API_KEY environment variable.
Initialize LangWatch and create your PydanticAI agent. PydanticAI’s built-in OpenTelemetry support will automatically send traces to LangWatch.
LangWatch automatically captures all PydanticAI agent runs and model interactions through PydanticAI’s built-in OpenTelemetry support. Use @langwatch.trace() decorators to add custom traces and metadata as needed.

Check it worked

Run the example. Then open your project in LangWatch: a new trace appears in the traces list within a few seconds. Open it to see the PydanticAI agent run and its model calls. If no trace appears, check that LANGWATCH_API_KEY is set in the environment the script runs in.
Last modified on October 29, 2026