Registry / llm-agents / braintrust-langchain

braintrust-langchain

JSON →
library0.3.0pypypi✓ verified 23d ago

This library provided LangChain integration for Braintrust, a platform for evaluating and managing LLMs. It is now deprecated as of version 0.3.0. The LangChain integration has been moved into the main `braintrust` package. Users should install and use `braintrust` instead, which is actively developed with frequent releases.

pip install braintrust
INSTALL
IMPORT
SIG · BRAINTRUST-LANGCHA
B
braintrust-langchain
llm-agentspythonv0.3.0
Install
4.4s avg
Import
1426ms
Disk
125MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.210s · 90.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.4s · import 1.072s · 161MB
125MB installed
● package 125MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

auto_instrument
from braintrust import auto_instrument
from braintrust_langchain import set_global_handler
The global handler for LangChain is now part of the main `braintrust` package via `auto_instrument()`.
BraintrustCallbackHandler
from braintrust.langchain import BraintrustCallbackHandler
from braintrust_langchain import BraintrustCallbackHandler
The `BraintrustCallbackHandler` class has moved from `braintrust_langchain` to `braintrust.langchain`.

This quickstart demonstrates how to use Braintrust's LangChain integration with the main `braintrust` package. It initializes the Braintrust logger, enables automatic LangChain instrumentation, and then executes a simple LangChain example. All interactions will be automatically logged to your Braintrust project.

import os from braintrust import init_logger, auto_instrument from langchain_core.prompts import ChatPromptTemplate from langchain_openai import ChatOpenAI # Ensure your Braintrust API key is set os.environ['BRAINTRUST_API_KEY'] = os.environ.get('BRAINTRUST_API_KEY', 'YOUR_BRAINTRUST_API_KEY') # Initialize the logger with your project name (required) # and auto-instrument LangChain init_logger(project="My LangChain Project") auto_instrument() prompt = ChatPromptTemplate.from_template("What is 1 + {number}?") model = ChatOpenAI(model="gpt-3.5-turbo") chain = prompt | model response = chain.invoke({"number": "2"}) print(response.content) # The LangChain interaction will be automatically traced and logged to Braintrust.
Debug
Known issues
breakingThis `braintrust-langchain` package is deprecated. Its functionality has been migrated to the main `braintrust` SDK.
fix
Uninstall `braintrust-langchain` (`pip uninstall braintrust-langchain`) and `pip install braintrust` instead. All future updates and features will be in the main `braintrust` package.
affects: 0.3.0 and later for `braintrust-langchain` (as it became a stub/deprecated package).
breakingLangChain integration imports have changed. Direct imports from `braintrust_langchain` are no longer valid.
fix
Update imports to use `from braintrust import auto_instrument` for global instrumentation, or `from braintrust.langchain import BraintrustCallbackHandler` for manual callback handling. Refer to the `braintrust` SDK documentation for the latest usage.
affects: Functionality moved into `braintrust` SDK versions >= 0.12.0. Any code relying on `braintrust-langchain` will fail.
gotchaBraintrust requires an API key for authentication. If not provided, tracing and logging will not function.
fix
Ensure the `BRAINTRUST_API_KEY` environment variable is set before running your application. Alternatively, pass the `api_key` argument directly to `braintrust.init_logger()` or `braintrust.set_api_key()`.
affects: All versions of Braintrust SDKs.
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'braintrust_langchain'
The `braintrust-langchain` package is deprecated and likely not installed, or has been uninstalled during migration to the main `braintrust` package.
fix
First, uninstall the deprecated package if it's present (`pip uninstall braintrust-langchain`), then install the actively maintained `braintrust` package (`pip install braintrust`). Update your Python import statements to reflect the new location of LangChain integrations, for example, `from braintrust.integrations.langchain import BraintrustCallbackHandler`.
ImportError: cannot import name 'BraintrustCallbackHandler' from 'braintrust_langchain'
You are attempting to import `BraintrustCallbackHandler` from the deprecated `braintrust_langchain` package, but its functionality has been moved to the main `braintrust` package under a different import path.
fix
Ensure you have the `braintrust` package installed (`pip install braintrust`) and the `braintrust-langchain` package uninstalled (`pip uninstall braintrust-langchain`). Then, update your import statement to `from braintrust.integrations.langchain import BraintrustCallbackHandler`.
pip install braintrust-langchain
You are attempting to install the `braintrust-langchain` package, which is deprecated as of version 0.3.0. The LangChain integration has been moved into the main `braintrust` package.
fix
Instead, install the main `braintrust` package: `pip install braintrust`. If `braintrust-langchain` is already installed, you should uninstall it first: `pip uninstall braintrust-langchain`.
Upgrade
Version history
0.3.0latest on PyPI · released Apr 1, 2026
Audit
Dependencies
braintrustrequiredThis is the successor package where LangChain integration now resides.
langchain-corerequiredRequired for core LangChain functionalities when using the integration.
langchain-openaioptionalExample dependency for using OpenAI models with LangChain.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
braintrust-langchain — pip install braintrust-langchain · libregistry