Skip to content

Add LangGraph auto-instrumentation for Braintrust hook imports#1897

Open
Stephen Belanger (Qard) wants to merge 1 commit intomainfrom
langgraph-auto-instrumentation
Open

Add LangGraph auto-instrumentation for Braintrust hook imports#1897
Stephen Belanger (Qard) wants to merge 1 commit intomainfrom
langgraph-auto-instrumentation

Conversation

@Qard
Copy link
Copy Markdown
Contributor

@Qard Stephen Belanger (Qard) commented Apr 22, 2026

Summary

  • Add LangChain/LangGraph auto-instrumentation to braintrust/hook.mjs so callback handlers are injected automatically without requiring @braintrust/langchain-js imports.
  • Keep the manual @braintrust/langchain-js API working while reusing the same span semantics through a vendored callback-handler surface.
  • Add config support for langchain, langchain-js, and langgraph disable aliases and export the new LangChain instrumentation configs.
  • Add a real provider-backed e2e scenario that verifies --import braintrust/hook.mjs captures LangGraph task spans and nested OpenAI spans end to end.

Testing

  • Passed focused Vitest coverage for the new LangChain plugin, config mapping, registry integration, and existing @braintrust/langchain-js tests.
  • Passed the new provider-backed LangGraph e2e scenario repeatedly with OPENAI_API_KEY set.
  • Passed the repo build, and the touched files were formatted successfully.

Fixes #1889

@Qard Stephen Belanger (Qard) force-pushed the langgraph-auto-instrumentation branch 4 times, most recently from 9a3b514 to 6db4d8f Compare April 23, 2026 05:29
@Qard Stephen Belanger (Qard) force-pushed the langgraph-auto-instrumentation branch 5 times, most recently from ab69d71 to 4e86a49 Compare April 24, 2026 01:05
Copy link
Copy Markdown
Member

@lforst Luca Forstner (lforst) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add e2e test ci summary for this.

@Qard Stephen Belanger (Qard) force-pushed the langgraph-auto-instrumentation branch from 4e86a49 to 2ffbf1b Compare April 24, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automatic instrumentation for the LangGraph SDK

2 participants