Skip to main content
Helicone integrates with LangChain to provide comprehensive observability for your LLM applications, agents, and chains.

Integration Methods

AI Gateway

Use the AI Gateway for unified access to all providers with automatic fallbacks.

Proxy Integration

Route LangChain requests through Helicone’s proxy.

Async Logging

Zero-latency logging using OpenLLMetry.

Custom Headers

Add Helicone headers to existing LangChain applications.

Quick Start

1

Install dependencies

2

Configure with Helicone proxy

Using the AI Gateway

The AI Gateway provides a unified interface for all providers:
Learn more about the AI Gateway.

Chains

Track LangChain chains with full visibility:

Agents

Monitor LangChain agents and tool usage:
View the full agent execution trace in your Helicone dashboard, including:
  • All LLM calls
  • Tool invocations
  • Intermediate steps
  • Total cost and latency

Retrieval (RAG)

Track RAG pipelines with custom properties:

Session Tracking

Track multi-step LangChain workflows:
Learn more about Session Tracking.

Custom Properties

Add context to your LangChain requests:

Streaming

Helicone supports LangChain streaming:

Anthropic with LangChain

Use Anthropic Claude with LangChain:

Zero-Latency Integration

For production applications, use async logging:
Learn more about Async Logging.

Best Practices

Track complete workflows with session IDs:
Use custom properties to organize requests:
Label agent tool calls:
Track embedding and completion costs separately:

Python Examples

Basic Usage

Chains in Python

Troubleshooting

  1. Verify your Helicone API key is correct
  2. Check the Helicone-Auth header format: Bearer sk-helicone-...
  3. Ensure you’re using the correct base URL
  4. Check that defaultHeaders is in the configuration object
  • Ensure you’re using the same session ID across requests
  • Session IDs must be UUIDs or unique strings
  • Include Helicone-Session-Id in every request of the session
In LangChain, headers must be in the configuration object:

Next Steps

AI Gateway

Use multiple providers with automatic fallbacks

Session Tracking

Track complex workflows

Async Logging

Zero-latency integration

Custom Properties

Add custom metadata