> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LangGraphInstrumentor

> Auto-instruments LangChain/LangGraph by monkey-patching

Auto-instruments LangChain/LangGraph by monkey-patching
`CallbackManager._configureSync` (or `.configure`) to inject a
FiddlerCallbackHandler into every invocation.

**Node.js only** — requires `@langchain/core` as a peer dependency and
uses `node:async_hooks` (via context) for context propagation.

Uses a WeakSet to track patched modules so frozen ESM exports
are handled correctly.

## Methods

### `constructor(client: FiddlerClient)`

<ParamField path="client" type="FiddlerClient" required={true}>
  An initialized FiddlerClient used by the
  callback handler to create spans.
</ParamField>

### `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.

<ResponseField name="return">
  `true` if auto-instrumentation is active.
</ResponseField>

### `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.

<ParamField path="module" type="CallbackManagerModule" required={true}>
  The imported `@langchain/core/callbacks/manager` module.
</ParamField>

### `uninstrument()`

Remove the patch and restore the original `CallbackManager` behavior.

Safe to call even if the instrumentor was never activated.
