Learn how to instrument Langchain applications with the LangWatch TypeScript SDK.
LangWatchCallbackHandler
that deeply integrates with Langchain’s event system.
setupObservability()
: Initializes LangWatch with default configuration.getLangWatchTracer()
: Creates a tracer instance for your application.tracer.withActiveSpan()
: Creates a parent LangWatch trace with automatic error handling and span management.LangWatchCallbackHandler
: A LangWatch-specific callback handler that captures Langchain events and converts them into detailed LangWatch spans.callbacks
option.invoke
, stream
, batch
, etc.).withActiveSpan()
.setupObservability()
can only be called once per process. Subsequent calls will throw an error.LangWatchCallbackHandler
instance to avoid span conflicts.withActiveSpan()
. The function handles span lifecycle automatically.setupObservability()
only once per processwithActiveSpan()
handle span lifecycle - don’t manually end spans