Skip to main content

Initializing HoneyHive Tracer

Use the following code to initialize HoneyHive tracing in your project:
Install the LangChain integration extra: pip install "honeyhive[openinference-langchain]" langchain-openai. The same package also traces LangGraph.
HoneyHive’s Python SDK uses the OpenInference LangChain instrumentor to trace all agents, chains, tools, and LLM calls automatically.
See the modern LangChain integration guide for full examples, tested versions, and the Traceloop (OpenLLMetry) alternative.
If you’re using these code examples verbatim, then make sure to set the appropriate environment variables (HH_API_KEY, HH_PROJECT, and for TypeScript, HH_SESSION_NAME) before running your application.

Supported LangChain Versions

  • Python: LangChain >= 1.0.0 (tested LKGV 1.2.15), openinference-instrumentation-langchain 0.1.62. Requires Python 3.11+.
  • JavaScript/TypeScript: LangChain ^0.2.0 and above.
For the latest tested versions and compatibility details, see the modern LangChain integration guide.

Nesting

Nesting is handled automatically by the HoneyHive tracing system. When you use traced components within other traced components, the system will create a hierarchical structure of spans, reflecting the nested nature of your LangChain operations.

Enriching Properties

For information on how to enrich your traces and spans with additional context, see our enrichment documentation.

Adding Evaluators

Once traces have been logged in the HoneyHive platform, you can then run evaluations with either Python or TypeScript.

Cookbook Examples

Python Example

TypeScript Example

These examples demonstrate how to integrate HoneyHive tracing with LangChain in both Python and TypeScript environments, covering document loading, text splitting, embedding creation, vector store operations, and question-answering chains.