Skip to main content
Node.js only — requires @langchain/core as a peer dependency, and the injected FiddlerCallbackHandler uses node:async_hooks for context propagation. Uses a WeakSet to track patched modules so frozen ESM exports are handled correctly.

Methods

constructor(client: FiddlerClient)

FiddlerClient
required
An initialized FiddlerClient used by the callback handler to create spans.

async instrument(): Promise<void>

Auto-instrument by dynamically importing @langchain/core/callbacks/manager and patching its CallbackManager.

isInstrumented(): boolean

Check whether the instrumentor has successfully patched a CallbackManager module.
true if auto-instrumentation is active.

manuallyInstrument(module: CallbackManagerModule)

Manually instrument a specific @langchain/core/callbacks/manager module reference. Use this in bundled environments (Webpack, esbuild, etc.) where dynamic import() of @langchain/core may not resolve correctly.
CallbackManagerModule
required
The imported @langchain/core/callbacks/manager module.

uninstrument()

Remove the patch and restore the original CallbackManager behavior. Safe to call even if the instrumentor was never activated.