ConstOptionaloptions: LangGraphOptionsimport * as Sentry from '@sentry/node';
Sentry.init({
integrations: [Sentry.langGraphIntegration()],
});
recordInputs: Whether to record input messages (default: respects sendDefaultPii client option)recordOutputs: Whether to record response text (default: respects sendDefaultPii client option)By default, the integration will:
sendDefaultPii is set to true in your Sentry client options// Record inputs and outputs when sendDefaultPii is false
Sentry.init({
integrations: [
Sentry.langGraphIntegration({
recordInputs: true,
recordOutputs: true
})
],
});
// Never record inputs/outputs regardless of sendDefaultPii
Sentry.init({
sendDefaultPii: true,
integrations: [
Sentry.langGraphIntegration({
recordInputs: false,
recordOutputs: false
})
],
});
The integration captures the following LangGraph operations:
StateGraph.compile()) - Creates a gen_ai.create_agent spanCompiledGraph.invoke()) - Creates a gen_ai.invoke_agent spanWhen recordInputs and recordOutputs are enabled, the integration captures:
Adds Sentry tracing instrumentation for LangGraph.
This integration is enabled by default.
When configured, this integration automatically instruments LangGraph StateGraph and compiled graph instances to capture telemetry data following OpenTelemetry Semantic Conventions for Generative AI.