Skip to main content

Overview

OpenInference instrumentation for LangChain records LangChain and LangGraph operations as OpenTelemetry spans that use OpenInference semantic conventions. Use it to send traces to an OpenTelemetry-compatible collector or observability backend, including Arize AX and Arize Phoenix. The package hooks into langchain-core, which is shared by LangChain packages. It supports LangChain 1.x, LangChain Classic, and partner packages such as langchain-openai, langchain-anthropic, and langchain-google-vertexai.

Installation

Install the OpenInference instrumentation package with LangChain:
For LangChain Classic applications, install langchain-classic instead:

Use with an OpenTelemetry collector

Install the OpenTelemetry SDK and OTLP exporter (they are not pulled in by the instrumentation package alone), then configure a tracer provider and instrument LangChain before running your application:
The instrumentation records spans for LangChain runs and exports them through the configured tracer provider.

Use with Arize AX

Arize AX can receive traces from OpenInference instrumentation through OpenTelemetry. Install arize-otel with the instrumentation package:
Register an Arize AX tracer provider, then pass it to the LangChain instrumentor:

Resources