Skip to content

migrate langchain into braintrust pkg without auto instrumentation#150

Open
ViaDézo1er / cedric (viadezo1er) wants to merge 7 commits intomainfrom
cedric/migrate-langchain-into-braintrust-pkg-without-auto-instrumentation
Open

migrate langchain into braintrust pkg without auto instrumentation#150
ViaDézo1er / cedric (viadezo1er) wants to merge 7 commits intomainfrom
cedric/migrate-langchain-into-braintrust-pkg-without-auto-instrumentation

Conversation

@viadezo1er
Copy link
Contributor

@viadezo1er ViaDézo1er / cedric (viadezo1er) commented Mar 25, 2026

Fix #27

Migrates braintrust-langchain to the main braintrust python pkg.

Migration Guide: braintrust-langchain to braintrust

Before

pip install braintrust-langchain
from braintrust_langchain import BraintrustCallbackHandler, set_global_handler
handler = BraintrustCallbackHandler()
set_global_handler(handler)

After

pip install braintrust
from braintrust.integrations.langchain import BraintrustCallbackHandler, set_global_handler

What to update

  • Change imports from braintrust_langchain to braintrust.integrations.langchain
  • Remove braintrust-langchain from your dependencies — braintrust now includes LangChain support with no extra package

Coming soon

Auto-instrumentation support for the langchain integration

Copy link
Member

Choose a reason for hiding this comment

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

Can we use git mv on the code in https://github.com/braintrustdata/braintrust-sdk-python/tree/main/integrations/langchain-py/src/braintrust_langchain? That way we maintain git history for the moved files.

We can do the same thing we did in adk-py, and just leave a deprecation warning + move the files https://github.com/braintrustdata/braintrust-sdk-python/blob/main/integrations/adk-py/src/braintrust_adk/__init__.py

self, response: list[Document], *, run_id: UUID, parent_run_id: UUID | None = None, **kwargs: Any
) -> Any:
pass
__all__ = ["BraintrustCallbackHandler", "BraintrustTracer", "set_global_handler", "clear_global_handler"]

Choose a reason for hiding this comment

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

Removing BraintrustTracer is a breaking change. We can do this, but I would prefer not to do it. Instead let's leave a note at the top of the file that braintrust.integrations.langchain is the new import, and update the _logger.warning in BraintrustTracer to have the new deprecation.

@viadezo1er ViaDézo1er / cedric (viadezo1er) force-pushed the cedric/migrate-langchain-into-braintrust-pkg-without-auto-instrumentation branch from a7b390e to b3f9f03 Compare March 26, 2026 23:15
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.

Migrate braintrust-langchain into main braintrust package.

2 participants