Setup
Install LangGraph alongside Braintrust and the LangChain packages you use:Trace with LangGraph
Braintrust traces LangGraph through the LangChain callback system. Enable it without code changes through auto-instrumentation, or configure the callback handler manually. See Trace LLM calls for more about auto-instrumentation.TypeScript auto-instrumentation
To trace LangGraph graphs without modifying your application code, initialize Braintrust normally, then run your app with Braintrust’s import hook to patch@langchain/core at runtime. Requires @langchain/langgraph v1 or later.
trace-langgraph-auto.js
node --import can run the file directly. The Braintrust APIs work the same in TypeScript projects — compile your TypeScript to JavaScript, then run the compiled file with the import hook.
If you’re using a bundler, see Trace LLM calls for plugin and loader setup.
Python auto-instrumentation
trace-langgraph-auto.py
Manual callback setup
If you want explicit control over the LangChain handler, configure it directly:trace-langgraph.ts
