--- id: openinference-instrumentation-langchain version: "0.1.70" license: Apache-2.0 license_treatment: permissive maintenance: active --- # openinference-instrumentation-langchain — OpenInference LangChain Instrumentation License: permissive · Maintenance: active · Downloads: 3.5M/mo ## 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 above — 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 pip install openinference-instrumentation-langchain uv add openinference-instrumentation-langchain poetry add openinference-instrumentation-langchain ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 3.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags langchain tracing instrumentation, opentelemetry langchain, langchain observability, langchain span collection, langchain debugging traces, ai agent monitoring, llm application tracing, observability, langchain, opentelemetry [View on SkillFed](https://skillfed.io/packages/openinference-instrumentation-langchain) · [View on PyPI](https://pypi.org/project/openinference-instrumentation-langchain/)