openinference-instrumentation-langchain
OpenInference LangChain Instrumentation
What it is and what it does
This package wraps LangChain to automatically capture execution traces and send them to OpenTelemetry collectors like Arize Phoenix or Arize AX. It hooks into langchain-core to intercept calls across all LangChain packages (langchain-openai, langchain-anthropic, langchain-google-vertexai, etc.) and works with both the modern LangChain 1.x agent framework and the legacy LangChain Classic chains API.
Once instrumented, every LangChain operation—agent steps, tool calls, LLM invocations, prompt templates—generates a span that can be viewed in a web dashboard for debugging, performance analysis, and tracing AI application behavior. It requires an OpenTelemetry exporter and collector endpoint to function; Arize Phoenix is the recommended local option.
Use it for:
- Debug LangChain agent behavior by viewing step-by-step execution traces in Arize Phoenix.
- Monitor LLM API calls and token usage across langchain-openai, langchain-anthropic, and other partner packages.
- Trace tool execution and error propagation in multi-step agent workflows.
- Collect structured metadata and session information from LangChain runs for post-analysis.
- Migrate legacy LangChain Classic applications while maintaining observability during the transition to LangChain 1.x.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Auto-instruments LangChain applications to generate OpenTelemetry-compatible traces for observability and debugging, compatible with both LangChain 1.x and LangChain Classic.
Yes, if you are building or maintaining LangChain applications and need visibility into execution. The package is actively maintained, has no known vulnerabilities, installs with low friction, and integrates seamlessly with standard observability infrastructure. The Apache-2.0 license poses no barrier. Install it alongside an OpenTelemetry collector (Arize Phoenix is free and local) to enable immediate tracing.
Install
openinference-instrumentation-langchain on PyPI
pip
pip install openinference-instrumentation-langchainuv
uv add openinference-instrumentation-langchainpoetry
poetry add openinference-instrumentation-langchainInstalling openinference-instrumentation-langchain
Before you install
Low friction install with a pure-Python wheel. The package is actively maintained (last commit 2026-08-14, release 7 days old) and supports current Python versions (3.10–3.14). Six runtime dependencies are all standard observability libraries.
License in practice
Apache-2.0 permissive license allows use in commercial and proprietary projects with minimal restrictions; attribution required.
Quickstart
pip install openinference-instrumentation-langchain
from openinference.instrumentation.langchain import LangChainInstrumentor
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
tracer_provider = trace_sdk.TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter("http://localhost:6006/v1/traces")))
LangChainInstrumentor().instrument()
Requires an OpenTelemetry collector endpoint (e.g., Arize Phoenix) to receive and view traces; local Phoenix server can be started with `python -m phoenix.server.main serve`.
Verify before relying
- Whether instrumentation overhead is measurable for high-throughput LangChain applications.
- Support status and compatibility timeline for LangChain Classic vs. LangChain 1.x migration path.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — openinference-instrumentation, openinference-semantic-conventions, opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions, wrapt |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,470,274/month — #2,612 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: openinference_instrumentation_langchain-0.1.70-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
openinference-instrumentation-openaiAuto-instruments OpenAI Python SDK calls to…
permissive · top 5,000 on PyPI
openinference-semantic-conventionsDefines semantic conventions and standardized…
permissive · top 5,000 on PyPI
openinference-instrumentation-agnoAuto-instruments Agno Agent applications to…
permissive · top 15,000 on PyPI
openinference-instrumentation-google-genaiAutomatically instruments Google GenAI SDK…
permissive · top 15,000 on PyPI
openinference-instrumentation-google-adkAuto-instruments Google ADK applications to…
permissive · top 15,000 on PyPI
openinference-instrumentationProvides utility functions to convert typed…
permissive · top 5,000 on PyPI
openinference-instrumentation-claude-agent-sdkAuto-instruments Claude Agent SDK calls to emit…
permissive · top 15,000 on PyPI
openinference-instrumentation-llama-indexAuto-instruments LlamaIndex applications to…
permissive · top 15,000 on PyPI
openinference-instrumentation-openai-agentsAuto-instruments OpenAI Agents SDK to emit…
permissive · top 5,000 on PyPI
braintrust-langchainProvides a LangChain callback handler to log…
permissive · top 5,000 on PyPI