Skip to content

feat: Migrate langchain functionality into braintrust package#150

Merged
Abhijeet Prasad (AbhiPrasad) merged 15 commits into
mainfrom
cedric/migrate-langchain-into-braintrust-pkg-without-auto-instrumentation
Mar 31, 2026
Merged

feat: Migrate langchain functionality into braintrust package#150
Abhijeet Prasad (AbhiPrasad) merged 15 commits into
mainfrom
cedric/migrate-langchain-into-braintrust-pkg-without-auto-instrumentation

Conversation

@viadezo1er
Copy link
Copy Markdown
Contributor

@viadezo1er Cedric / ViaDézo1er (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
Copy Markdown
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

Comment thread py/src/braintrust/wrappers/langchain.py Outdated
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"]
Copy link
Copy Markdown
Member

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 Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/migrate-langchain-into-braintrust-pkg-without-auto-instrumentation branch 2 times, most recently from cd63e1c to 37039ce Compare March 27, 2026 21:48
@viadezo1er
Copy link
Copy Markdown
Contributor Author

Cedric / ViaDézo1er (viadezo1er) commented Mar 27, 2026

Rebasing against main

@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/migrate-langchain-into-braintrust-pkg-without-auto-instrumentation branch from b578692 to e3f7a17 Compare March 30, 2026 16:59
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) changed the title migrate langchain into braintrust pkg without auto instrumentation feat: Migrate langchain functionality into braintrust package Mar 31, 2026
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Mar 31, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedbraintrust@​0.2.9 ⏵ 0.11.073 -22100100100100
Addedlangchain-core@​1.2.88084100100100
Addedjsonschema@​4.26.099100100100100
Addedlangchain-anthropic@​0.3.2299100100100100
Addedlangchain-anthropic@​1.3.1100100100100100
Addedlangchain-openai@​0.3.35100100100100100
Addedlangchain-openai@​1.1.7100100100100100
Addedlangchain-core@​0.3.8310084100100100

View full report

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit e09f625 into main Mar 31, 2026
29 checks passed
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the cedric/migrate-langchain-into-braintrust-pkg-without-auto-instrumentation branch March 31, 2026 20:22
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