Installation
The integration is enabled by default in Node.js:Basic Usage
Just use LangChain normally:Configuration
Default Behavior
By default, inputs and outputs are not captured:Capture Inputs and Outputs
- Global Setting
- LangChain Only
Enable for all AI integrations:
Integration Options
boolean
default:"sendDefaultPii"
Capture input messages and prompts
boolean
default:"sendDefaultPii"
Capture responses and outputs
Automatic Instrumentation
The integration automatically instruments:LLM and Chat Models
Chains
Tools
Captured Events
The integration captures these LangChain lifecycle events:1
LLM/Chat Start
When a language model call begins
2
LLM/Chat End
When a language model call completes
3
LLM/Chat Error
When a language model call fails
4
Chain Start
When a chain execution begins
5
Chain End
When a chain execution completes
6
Chain Error
When a chain execution fails
7
Tool Start
When a tool is invoked
8
Tool End
When a tool execution completes
9
Tool Error
When a tool execution fails
Manual Callback Handler
You can also manually add the Sentry callback handler:Practical Examples
Question Answering Chain
RAG (Retrieval-Augmented Generation)
Agent with Tools
Streaming Responses
Provider Integration
When using LangChain, provider integrations are skipped:Viewing LangChain Data
LangChain operations appear as spans in traces:Performance Monitoring
- Chain Execution Time: Track complex workflow performance
- LLM Latency: Monitor model response times
- Tool Performance: Identify slow tool executions
- Error Rates: Track failures in chains and tools
Source Code
The LangChain integration is implemented in:packages/node/src/integrations/tracing/langchain/index.ts:11